Merge from Chromium at DEPS revision r190564

This commit was generated by merge_to_master.py.

Change-Id: Icadecbce29854b8fa25fd335b2c1949b5ca5d170
diff --git a/ppapi/DEPS b/ppapi/DEPS
index bab9452..7d9e75c 100644
--- a/ppapi/DEPS
+++ b/ppapi/DEPS
@@ -1,5 +1,6 @@
 include_rules = [
   "+media",
-  "+third_party/skia",
+  "+third_party/WebKit/Source/Platform/chromium/public",
   "+third_party/WebKit/Source/WebKit/chromium/public",
+  "+third_party/skia",
 ]
diff --git a/ppapi/PRESUBMIT.py b/ppapi/PRESUBMIT.py
index b350003..9b6f716 100644
--- a/ppapi/PRESUBMIT.py
+++ b/ppapi/PRESUBMIT.py
@@ -31,30 +31,15 @@
     if name_parts[0:2] == ['ppapi', 'generators']:
       generator_files.append(filename)
   if generator_files != []:
-    cmd = [ sys.executable, 'idl_gen_pnacl.py', '--wnone', '--test']
+    cmd = [ sys.executable, 'idl_tests.py']
     ppapi_dir = input_api.PresubmitLocalPath()
     results.extend(RunCmdAndCheck(cmd,
-                                  'PPAPI IDL Pnacl unittest failed.',
+                                  'PPAPI IDL unittests failed.',
                                   output_api,
                                   os.path.join(ppapi_dir, 'generators')))
   return results
 
 
-# If any .srpc files were changed, run run_srpcgen.py --diff_mode.
-def CheckSrpcChange(input_api, output_api):
-  if [True for filename in input_api.LocalPaths() if
-      os.path.splitext(filename)[1] == '.srpc']:
-    return RunCmdAndCheck([sys.executable,
-                           os.path.join(input_api.PresubmitLocalPath(),
-                                        'native_client', 'src',
-                                        'shared', 'ppapi_proxy',
-                                        'run_srpcgen.py'),
-                           '--diff_mode'],
-                          'PPAPI SRPC Diff detected: Run run_srpcgen.py.',
-                          output_api)
-  return []
-
-
 # Verify that the files do not contain a 'TODO' in them.
 RE_TODO = re.compile(r'\WTODO\W', flags=re.I)
 def CheckTODO(input_api, output_api):
@@ -66,7 +51,7 @@
     name_parts = name.split(os.sep)
 
     # Only check normal build sources.
-    if ext not in ['.h', '.cc', '.idl']:
+    if ext not in ['.h', '.idl']:
       continue
 
     # Only examine the ppapi directory.
@@ -126,8 +111,6 @@
 def CheckChange(input_api, output_api):
   results = []
 
-  results.extend(CheckSrpcChange(input_api, output_api))
-
   results.extend(RunUnittests(input_api, output_api))
 
   results.extend(CheckTODO(input_api, output_api))
@@ -157,13 +140,24 @@
   missing = []
   for filename in idl_files:
     if filename not in set(h_files):
-      missing.append('  ppapi/c/%s.idl' % filename)
+      missing.append('ppapi/api/%s.idl' % filename)
+
+  # An IDL change that includes [generate_thunk] doesn't need to have
+  # an update to the corresponding .h file.
+  new_thunk_files = []
+  for filename in missing:
+    lines = input_api.RightHandSideLines(lambda f: f.LocalPath() == filename)
+    for line in lines:
+      if line[2].strip() == '[generate_thunk]':
+        new_thunk_files.append(filename)
+  for filename in new_thunk_files:
+    missing.remove(filename)
 
   if missing:
     results.append(
         output_api.PresubmitPromptWarning(
             'Missing PPAPI header, no change or skipped generation?',
-            long_text='\n'.join(missing)))
+            long_text='\n  '.join(missing)))
 
   missing_dev = []
   missing_stable = []
@@ -172,6 +166,22 @@
     if filename not in set(idl_files):
       name_parts = filename.split(os.sep)
 
+      if name_parts[-1] == 'pp_macros':
+        # The C header generator adds a PPAPI_RELEASE macro based on all the
+        # IDL files, so pp_macros.h may change while its IDL does not.
+        lines = input_api.RightHandSideLines(
+            lambda f: f.LocalPath() == 'ppapi/c/%s.h' % filename)
+        releaseChanged = False
+        for line in lines:
+          if line[2].split()[:2] == ['#define', 'PPAPI_RELEASE']:
+            results.append(
+                output_api.PresubmitNotifyResult(
+                    'PPAPI_RELEASE has changed', long_text=line[2]))
+            releaseChanged = True
+            break
+        if releaseChanged:
+          continue
+
       if 'trusted' in name_parts:
         missing_priv.append('  ppapi/c/%s.h' % filename)
         continue
diff --git a/ppapi/api/dev/pp_video_dev.idl b/ppapi/api/dev/pp_video_dev.idl
index afeb4fb..936eede 100644
--- a/ppapi/api/dev/pp_video_dev.idl
+++ b/ppapi/api/dev/pp_video_dev.idl
@@ -40,7 +40,8 @@
 [assert_size(12)]
 struct PP_VideoBitstreamBuffer_Dev {
   /**
-   * Client-specified identifier for the bitstream buffer.
+   * Client-specified identifier for the bitstream buffer. Valid values are
+   * non-negative.
    */
   int32_t id;
 
@@ -53,7 +54,7 @@
   /**
    * Size of the bitstream contained in buffer (in bytes).
    */
-  int32_t size;
+  uint32_t size;
 };
 
 /**
@@ -64,7 +65,7 @@
   /**
    * Client-specified id for the picture buffer. By using this value client can
    * keep track of the buffers it has assigned to the video decoder and how they
-   * are passed back to it.
+   * are passed back to it. Valid values are non-negative.
    */
   int32_t id;
 
diff --git a/ppapi/api/dev/ppb_audio_input_dev.idl b/ppapi/api/dev/ppb_audio_input_dev.idl
index ba99acd..29c60cc 100644
--- a/ppapi/api/dev/ppb_audio_input_dev.idl
+++ b/ppapi/api/dev/ppb_audio_input_dev.idl
@@ -8,8 +8,11 @@
  * provides realtime audio input capture.
  */
 
+[generate_thunk]
+
 label Chrome {
-  M19 = 0.2
+  M19 = 0.2,
+  M25 = 0.3
 };
 
 /**
@@ -24,6 +27,19 @@
 /**
  * The <code>PPB_AudioInput_Dev</code> interface contains pointers to several
  * functions for handling audio input resources.
+ *
+ * TODO(brettw) before moving out of dev, we need to resolve the issue of
+ * the mismatch between the current audio config interface and this one.
+ * 
+ * In particular, the params for input assume stereo, but this class takes
+ * everything as mono. We either need to not use an audio config resource, or
+ * add mono support.
+ *
+ * In addition, RecommendSampleFrameCount is completely wrong for audio input.
+ * RecommendSampleFrameCount returns the frame count for the current
+ * low-latency output device, which is likely inappropriate for a random input
+ * device. We may want to move the "recommend" functions to the input or output
+ * classes rather than the config.
  */
 [macro="PPB_AUDIO_INPUT_DEV_INTERFACE"]
 interface PPB_AudioInput_Dev {
@@ -66,17 +82,62 @@
    * @param[out] devices Once the operation is completed successfully,
    * <code>devices</code> will be set to a <code>PPB_ResourceArray_Dev</code>
    * resource, which holds a list of <code>PPB_DeviceRef_Dev</code> resources.
-   * @param[in] callback  A <code>PP_CompletionCallback</code> to run on
+   * @param[in] callback A <code>PP_CompletionCallback</code> to run on
    * completion.
    *
    * @return An error code from <code>pp_errors.h</code>.
    */
+  [deprecate=0.3]
   int32_t EnumerateDevices(
       [in] PP_Resource audio_input,
       [out] PP_Resource devices,
       [in] PP_CompletionCallback callback);
 
   /**
+   * Enumerates audio input devices.
+   *
+   * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
+   * input resource.
+   * @param[in] output An output array which will receive
+   * <code>PPB_DeviceRef_Dev</code> resources on success. Please note that the
+   * ref count of those resources has already been increased by 1 for the
+   * caller.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to run on
+   * completion.
+   *
+   * @return An error code from <code>pp_errors.h</code>.
+   */
+  [version=0.3]
+  int32_t EnumerateDevices(
+      [in] PP_Resource audio_input,
+      [in] PP_ArrayOutput output,
+      [in] PP_CompletionCallback callback);
+
+  /**
+   * Requests device change notifications.
+   *
+   * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
+   * input resource.
+   * @param[in] callback The callback to receive notifications. If not NULL, it
+   * will be called once for the currently available devices, and then every
+   * time the list of available devices changes. All calls will happen on the
+   * same thread as the one on which MonitorDeviceChange() is called. It will
+   * receive notifications until <code>audio_input</code> is destroyed or
+   * <code>MonitorDeviceChange()</code> is called to set a new callback for
+   * <code>audio_input</code>. You can pass NULL to cancel sending
+   * notifications.
+   * @param[inout] user_data An opaque pointer that will be passed to
+   * <code>callback</code>.
+   *
+   * @return An error code from <code>pp_errors.h</code>.
+   */
+  [version=0.3]
+  int32_t MonitorDeviceChange(
+      [in] PP_Resource audio_input,
+      [in] PP_MonitorDeviceChangeCallback callback,
+      [inout] mem_t user_data);
+
+  /**
    * Opens an audio input device. No sound will be captured until
    * StartCapture() is called.
    *
diff --git a/ppapi/api/dev/ppb_device_ref_dev.idl b/ppapi/api/dev/ppb_device_ref_dev.idl
index 51d468b..98d1272 100644
--- a/ppapi/api/dev/ppb_device_ref_dev.idl
+++ b/ppapi/api/dev/ppb_device_ref_dev.idl
@@ -6,11 +6,30 @@
 /**
  * This file defines the <code>PPB_DeviceRef_Dev</code> interface.
  */
+
+[generate_thunk]
+
 label Chrome {
   M18 = 0.1
 };
 
 /**
+ * Defines the callback type to receive device change notifications for
+ * <code>PPB_AudioInput_Dev.MonitorDeviceChange()</code> and
+ * <code>PPB_VideoCapture_Dev.MonitorDeviceChange()</code>.
+ *
+ * @param[inout] user_data The opaque pointer that the caller passed into
+ * <code>MonitorDeviceChange()</code>.
+ * @param[in] device_count How many devices in the array.
+ * @param[in] devices An array of <code>PPB_DeviceRef_Dev</code>. Please note
+ * that the ref count of the elements is not increased on behalf of the plugin.
+ */
+typedef void PP_MonitorDeviceChangeCallback(
+    [inout] mem_t user_data,
+    [in] uint32_t device_count,
+    [in, size_is(device_count)] PP_Resource[] devices);
+
+/**
  * Device types.
  */
 [assert_size(4)]
@@ -40,6 +59,7 @@
    *
    * @return A <code>PP_DeviceType_Dev</code> value.
    */
+  [on_failure=PP_DEVICETYPE_DEV_INVALID]
   PP_DeviceType_Dev GetType([in] PP_Resource device_ref);
 
   /**
diff --git a/ppapi/api/dev/ppb_directory_reader_dev.idl b/ppapi/api/dev/ppb_directory_reader_dev.idl
new file mode 100644
index 0000000..5ba6065
--- /dev/null
+++ b/ppapi/api/dev/ppb_directory_reader_dev.idl
@@ -0,0 +1,46 @@
+/* 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.
+ */
+
+/*
+ * This file defines the <code>PPB_DirectoryReader_Dev</code> interface.
+ */
+
+label Chrome {
+  M27 = 0.6
+};
+
+[assert_size(8)]
+struct PP_DirectoryEntry_Dev {
+  PP_Resource file_ref;
+  PP_FileType file_type;
+};
+
+interface PPB_DirectoryReader_Dev {
+  // Creates a DirectoryReader for the given directory.  Upon success, the
+  // corresponding directory is classified as "in use" by the resulting
+  // DirectoryReader object until such time as the DirectoryReader object is
+  // destroyed.
+  PP_Resource Create([in] PP_Resource directory_ref);
+
+  // Returns PP_TRUE if the given resource is a DirectoryReader. Returns
+  // PP_FALSE if the resource is invalid or some type other than a
+  // DirectoryReader.
+  PP_Bool IsDirectoryReader([in] PP_Resource resource);
+
+  // Reads all entries in the directory.
+  //
+  // @param[in] directory_reader A <code>PP_Resource</code>
+  // corresponding to a directory reader resource.
+  // @param[in] output An output array which will receive
+  // <code>PP_DirectoryEntry_Dev</code> objects on success.
+  // @param[in] callback A <code>PP_CompletionCallback</code> to run on
+  // completion.
+  //
+  // @return An error code from <code>pp_errors.h</code>.
+  //
+  int32_t ReadEntries([in] PP_Resource directory_reader,
+                      [in] PP_ArrayOutput output,
+                      [in] PP_CompletionCallback callback);
+};
diff --git a/ppapi/api/dev/ppb_find_dev.idl b/ppapi/api/dev/ppb_find_dev.idl
index 7a91263..4f92f1c 100644
--- a/ppapi/api/dev/ppb_find_dev.idl
+++ b/ppapi/api/dev/ppb_find_dev.idl
@@ -7,6 +7,8 @@
  * This file defines the <code>PPB_Find_Dev</code> interface.
  */
 
+[generate_thunk]
+
 label Chrome {
   M14 = 0.3
 };
diff --git a/ppapi/api/dev/ppb_resource_array_dev.idl b/ppapi/api/dev/ppb_resource_array_dev.idl
index fb8d257..b7497b2 100644
--- a/ppapi/api/dev/ppb_resource_array_dev.idl
+++ b/ppapi/api/dev/ppb_resource_array_dev.idl
@@ -6,6 +6,9 @@
 /**
  * This file defines the <code>PPB_ResourceArray_Dev</code> interface.
  */
+
+[generate_thunk]
+
 label Chrome {
   M18 = 0.1
 };
diff --git a/ppapi/api/dev/ppb_trace_event_dev.idl b/ppapi/api/dev/ppb_trace_event_dev.idl
new file mode 100644
index 0000000..ff01dea
--- /dev/null
+++ b/ppapi/api/dev/ppb_trace_event_dev.idl
@@ -0,0 +1,50 @@
+/* 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.
+ */
+
+/**
+ * This file defines the <code>PPB_Trace_Event</code> interface. It is meant
+ * to be used in plugins as the API that trace macros from trace_event.h use.
+ */
+
+label Chrome {
+  M25 = 0.1
+};
+
+interface PPB_Trace_Event_Dev {
+  /**
+   * Gets a pointer to a character for identifying a category name in the
+   * tracing system as well as for being able to early exit in client-side
+   * tracing code.
+   *
+   * NB: This mem_t return value should technically be const, but return values
+   * for Pepper IDL of mem_t type are not const.  The same is true for the arg
+   * |category_enabled| for AddTraceEvent.
+   */
+  mem_t GetCategoryEnabled([in] cstr_t category_name);
+
+  /**
+   * Adds a trace event to the platform tracing system. This function call is
+   * usually the result of a TRACE_* macro from trace_event.h when tracing and
+   * the category of the particular trace are enabled. It is not advisable to
+   * call this function on its own; it is really only meant to be used by the
+   * trace macros.
+   */
+  void AddTraceEvent(
+      [in] int8_t phase,
+      [in] mem_t category_enabled,
+      [in] cstr_t name,
+      [in] uint64_t id,
+      [in] uint32_t num_args,
+      [in, size_as=num_args] str_t[] arg_names,
+      [in, size_as=num_args] uint8_t[] arg_types,
+      [in, size_as=num_args] uint64_t[] arg_values,
+      [in] uint8_t flags);
+
+  /**
+   * Sets the thread name of the calling thread in the tracing system so it will
+   * show up properly in chrome://tracing.
+   */
+  void SetThreadName([in] cstr_t thread_name);
+};
diff --git a/ppapi/api/dev/ppb_truetype_font_dev.idl b/ppapi/api/dev/ppb_truetype_font_dev.idl
new file mode 100644
index 0000000..9775d98
--- /dev/null
+++ b/ppapi/api/dev/ppb_truetype_font_dev.idl
@@ -0,0 +1,236 @@
+/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file defines the <code>PPB_TrueTypeFont_Dev</code> interface. This
+ * interface exposes font table data for 'sfnt' fonts on the host system. These
+ * include TrueType and OpenType fonts.
+ */
+label Chrome {
+  M26 = 0.1
+};
+
+/**
+ * The PP_TrueTypeFontFamily_Dev defines generic font families. These can be
+ * used to create generic fonts consistent with the user's browser settings.
+ */
+[assert_size(4)]
+enum PP_TrueTypeFontFamily_Dev {
+  /**
+   * For a description of these default families, see the
+   * <a href="http://www.w3.org/TR/css3-fonts/#generic-font-families">
+   * 3.1.1 Generic font families</a> documentation.
+   */
+  PP_TRUETYPEFONTFAMILY_SERIF = 0,
+  PP_TRUETYPEFONTFAMILY_SANSSERIF = 1,
+  PP_TRUETYPEFONTFAMILY_CURSIVE = 2,
+  PP_TRUETYPEFONTFAMILY_FANTASY = 3,
+  PP_TRUETYPEFONTFAMILY_MONOSPACE = 4
+};
+
+/**
+ * The PP_TrueTypeFontStyle_Dev defines font styles.
+ */
+[assert_size(4)]
+enum PP_TrueTypeFontStyle_Dev {
+  PP_TRUETYPEFONTSTYLE_NORMAL = 0,
+  PP_TRUETYPEFONTSTYLE_ITALIC = 1
+};
+
+/**
+ * The PP_TrueTypeFontWeight_Dev defines font weights.
+ */
+[assert_size(4)]
+enum PP_TrueTypeFontWeight_Dev {
+  PP_TRUETYPEFONTWEIGHT_THIN = 100,
+  PP_TRUETYPEFONTWEIGHT_ULTRALIGHT = 200,
+  PP_TRUETYPEFONTWEIGHT_LIGHT = 300,
+  PP_TRUETYPEFONTWEIGHT_NORMAL = 400,
+  PP_TRUETYPEFONTWEIGHT_MEDIUM = 500,
+  PP_TRUETYPEFONTWEIGHT_SEMIBOLD = 600,
+  PP_TRUETYPEFONTWEIGHT_BOLD = 700,
+  PP_TRUETYPEFONTWEIGHT_ULTRABOLD = 800,
+  PP_TRUETYPEFONTWEIGHT_HEAVY = 900
+};
+
+/**
+ * The PP_TrueTypeFontWidth_Dev defines font widths.
+ */
+[assert_size(4)]
+enum PP_TrueTypeFontWidth_Dev {
+  PP_TRUETYPEFONTWIDTH_ULTRACONDENSED = 0,
+  PP_TRUETYPEFONTWIDTH_EXTRACONDENSED = 1,
+  PP_TRUETYPEFONTWIDTH_CONDENSED = 2,
+  PP_TRUETYPEFONTWIDTH_SEMICONDENSED = 3,
+  PP_TRUETYPEFONTWIDTH_NORMAL = 4,
+  PP_TRUETYPEFONTWIDTH_SEMIEXPANDED = 5,
+  PP_TRUETYPEFONTWIDTH_EXPANDED = 6,
+  PP_TRUETYPEFONTWIDTH_EXTRAEXPANDED = 7,
+  PP_TRUETYPEFONTWIDTH_ULTRAEXPANDED = 8
+};
+
+/**
+ * The PP_TrueTypeFontCharset defines font character sets.
+ */
+[assert_size(4)]
+enum PP_TrueTypeFontCharset_Dev {
+  PP_TRUETYPEFONTCHARSET_ANSI = 0,
+  PP_TRUETYPEFONTCHARSET_DEFAULT = 1,
+  PP_TRUETYPEFONTCHARSET_SYMBOL = 2,
+  PP_TRUETYPEFONTCHARSET_MAC = 77,
+  PP_TRUETYPEFONTCHARSET_SHIFTJIS = 128,
+  PP_TRUETYPEFONTCHARSET_HANGUL = 129,
+  PP_TRUETYPEFONTCHARSET_JOHAB = 130,
+  PP_TRUETYPEFONTCHARSET_GB2312 =134,
+  PP_TRUETYPEFONTCHARSET_CHINESEBIG5 = 136,
+  PP_TRUETYPEFONTCHARSET_GREEK = 161,
+  PP_TRUETYPEFONTCHARSET_TURKISH = 162,
+  PP_TRUETYPEFONTCHARSET_VIETNAMESE = 163,
+  PP_TRUETYPEFONTCHARSET_HEBREW = 177,
+  PP_TRUETYPEFONTCHARSET_ARABIC = 178,
+  PP_TRUETYPEFONTCHARSET_BALTIC = 186,
+  PP_TRUETYPEFONTCHARSET_RUSSIAN = 204,
+  PP_TRUETYPEFONTCHARSET_THAI = 222,
+  PP_TRUETYPEFONTCHARSET_EASTEUROPE = 238,
+  PP_TRUETYPEFONTCHARSET_OEM = 255
+};
+
+/**
+ * The <code>PP_TrueTypeFontDesc</code> structure describes a TrueType font. It
+ * is passed to Create, and returned by Describe.
+ */
+[assert_size(40)]
+struct PP_TrueTypeFontDesc_Dev {
+   /**
+   * Font family name as a string. This can also be an undefined var, in which
+   * case the generic family will be obeyed. If the face is not available on
+   * the system, the browser will attempt to do font fallback or pick a default
+   * font.
+   */
+  PP_Var family;
+
+  /** This value specifies a generic font family. If a family name string is
+   * provided when creating a font, this is ignored. */
+  PP_TrueTypeFontFamily_Dev generic_family;
+  /** This value specifies the font style. */
+  PP_TrueTypeFontStyle_Dev style;
+  /** This value specifies the font weight. */
+  PP_TrueTypeFontWeight_Dev weight;
+  /** This value specifies the font width, for condensed or expanded fonts */
+  PP_TrueTypeFontWidth_Dev width;
+  /** This value specifies a character set. */
+  PP_TrueTypeFontCharset_Dev charset;
+  /**
+   * Ensure that this struct is 40-bytes wide by padding the end.  In some
+   * compilers, PP_Var is 8-byte aligned, so those compilers align this struct
+   * on 8-byte boundaries as well and pad it to 16 bytes even without this
+   * padding attribute.  This padding makes its size consistent across
+   * compilers.
+   */
+  int32_t padding;
+};
+
+interface PPB_TrueTypeFont_Dev {
+  /**
+   * Gets an array of TrueType font family names available on the host.
+   * These names can be used to create a font from a specific family.
+   *
+   * @param[in] instance A <code>PP_Instance</code> requesting the family names.
+   * @param[in] output A <code>PP_ArrayOutput</code> to hold the names.
+   * The output is an array of PP_Vars, each holding a family name.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+   * completion of GetFontFamilies.
+   *
+   * @return If >= 0, the number of family names returned, otherwise an error
+   * code from <code>pp_errors.h</code>.
+   */
+  int32_t GetFontFamilies([in] PP_Instance instance,
+                          [in] PP_ArrayOutput output,
+                          [in] PP_CompletionCallback callback);
+
+  /**
+   * Creates a font resource matching the given font characteristics. The
+   * resource id will be non-zero on success, or zero on failure.
+   *
+   * @param[in] instance A <code>PP_Instance</code> to own the font.
+   * @param[in] desc A pointer to a <code>PP_TrueTypeFontDesc</code> describing
+   * the font.
+   */
+  PP_Resource Create([in] PP_Instance instance,
+                     [in] PP_TrueTypeFontDesc_Dev desc);
+
+  /**
+   * Determines if the given resource is a font.
+   *
+   * @param[in] resource A <code>PP_Resource</code> corresponding to a font.
+   *
+   * @return <code>PP_TRUE</code> if the resource is a
+   * <code>PPB_TrueTypeFont_Dev</code>, <code>PP_FALSE</code> otherwise.
+   */
+  PP_Bool IsFont([in] PP_Resource resource);
+
+  /**
+   * Returns a description of the given font resource. This description may
+   * differ from the description passed to Create, reflecting the host's font
+   * matching and fallback algorithm.
+   *
+   * @param[in] font A <code>PP_Resource</code> corresponding to a font.
+   * @param[out] desc A pointer to a <code>PP_TrueTypeFontDesc</code> to hold
+   * the description. The internal 'family' PP_Var should be set to undefined,
+   * since this function overwrites the <code>PP_TrueTypeFontDesc</code>. After
+   * successful completion, the family will be set to a PP_Var with a single
+   * reference, which the caller must release after use.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+   * completion of Describe.
+   *
+   * @return A return code from <code>pp_errors.h</code>. If an error code is
+   * returned, the <code>PP_TrueTypeFontDesc</code> will be unchanged.
+   */
+  int32_t Describe([in] PP_Resource font,
+                   [out] PP_TrueTypeFontDesc_Dev desc,
+                   [in] PP_CompletionCallback callback);
+
+  /**
+   * Gets an array of identifying tags for each table in the font.
+   * These tags can be used to request specific tables using GetTable.
+   *
+   * @param[in] font A <code>PP_Resource</code> corresponding to a font.
+   * @param[in] output A <code>PP_ArrayOutput</code> to hold the tags.
+   * The output is an array of 4 byte integers, each representing a table tag.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+   * completion of GetTableTags.
+   *
+   * @return If >= 0, the number of table tags returned, otherwise an error
+   * code from <code>pp_errors.h</code>.
+   */
+  int32_t GetTableTags([in] PP_Resource font,
+                       [in] PP_ArrayOutput output,
+                       [in] PP_CompletionCallback callback);
+
+  /**
+   * Copies the given font table into client memory.
+   *
+   * @param[in] font A <code>PP_Resource</code> corresponding to a font.
+   * @param[in] table A 4 byte value indicating which table to copy.
+   * For example, 'glyf' will cause the outline table to be copied into the
+   * output array. A zero tag value will cause the entire font to be copied.
+   * @param[in] offset The offset into the font table.
+   * @param[in] max_data_length The maximum number of bytes to transfer from
+   * <code>offset</code>.
+   * @param[in] output A <code>PP_ArrayOutput</code> to hold the font data.
+   * The output is an array of bytes.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+   * completion of GetTable.
+   *
+   * @return If >= 0, the table size in bytes, otherwise an error code from
+   * <code>pp_errors.h</code>.
+   */
+  int32_t GetTable([in] PP_Resource font,
+                   [in] uint32_t table,
+                   [in] int32_t offset,
+                   [in] int32_t max_data_length,
+                   [in] PP_ArrayOutput output,
+                   [in] PP_CompletionCallback callback);
+};
diff --git a/ppapi/api/dev/ppb_var_array_dev.idl b/ppapi/api/dev/ppb_var_array_dev.idl
new file mode 100644
index 0000000..78db3b0
--- /dev/null
+++ b/ppapi/api/dev/ppb_var_array_dev.idl
@@ -0,0 +1,76 @@
+/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file defines the <code>PPB_VarArray_Dev</code> struct providing
+ * a way to interact with array vars.
+ */
+
+label Chrome {
+  M27 = 0.1
+};
+
+[macro="PPB_VAR_ARRAY_DEV_INTERFACE"]
+interface PPB_VarArray_Dev {
+  /**
+   * Creates an array var, i.e., a <code>PP_Var</code> with type set to
+   * <code>PP_VARTYPE_ARRAY</code>. The array length is set to 0.
+   *
+   * @return An empty array var, whose reference count is set to 1 on behalf of
+   * the caller.
+   */
+  PP_Var Create();
+
+  /**
+   * Gets an element from the array.
+   *
+   * @param[in] array An array var.
+   * @param[in] index An index indicating which element to return.
+   *
+   * @return The element at the specified position. The reference count is
+   * incremented on behalf of the caller. If <code>index</code> is larger than
+   * or equal to the array length, an undefined var is returned.
+   */
+  PP_Var Get([in] PP_Var array, [in] uint32_t index);
+
+  /**
+   * Sets the value of an element in the array.
+   *
+   * @param[in] array An array var.
+   * @param[in] index An index indicating which element to modify. If
+   * <code>index</code> is larger than or equal to the array length, the length
+   * is updated to be <code>index</code> + 1. Any position in the array that
+   * hasn't been set before is set to undefined, i.e., <code>PP_Var</code> of
+   * type <code>PP_VARTYPE_UNDEFINED</code>.
+   * @param[in] value The value to set. The array holds a reference to it on
+   * success.
+   *
+   * @return A <code>PP_Bool</code> indicating whether the operation succeeds.
+   */
+  PP_Bool Set([in] PP_Var array, [in] uint32_t index, [in] PP_Var value);
+
+  /**
+   * Gets the array length.
+   *
+   * @param[in] array An array var.
+   *
+   * @return The array length.
+   */
+  uint32_t GetLength([in] PP_Var array);
+
+  /**
+   * Sets the array length.
+   *
+   * @param[in] array An array var.
+   * @param[in] length The new array length. If <code>length</code> is smaller
+   * than its current value, the array is truncated to the new length; any
+   * elements that no longer fit are removed. If <code>length</code> is larger
+   * than its current value, undefined vars are appended to increase the array
+   * to the specified length.
+   *
+   * @return A <code>PP_Bool</code> indicating whether the operation succeeds.
+   */
+  PP_Bool SetLength([in] PP_Var array, [in] uint32_t length);
+};
diff --git a/ppapi/api/dev/ppb_var_dictionary_dev.idl b/ppapi/api/dev/ppb_var_dictionary_dev.idl
new file mode 100644
index 0000000..f3e7407
--- /dev/null
+++ b/ppapi/api/dev/ppb_var_dictionary_dev.idl
@@ -0,0 +1,89 @@
+/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file defines the <code>PPB_VarDictionary_Dev</code> struct providing
+ * a way to interact with dictionary vars.
+ */
+
+label Chrome {
+  M27 = 0.1
+};
+
+/**
+ * A dictionary var contains key-value pairs with unique keys. The keys are
+ * strings while the values can be arbitrary vars. Key comparison is always
+ * done by value instead of by reference.
+ */
+[macro="PPB_VAR_DICTIONARY_DEV_INTERFACE"]
+interface PPB_VarDictionary_Dev {
+  /**
+   * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to
+   * <code>PP_VARTYPE_DICTIONARY</code>.
+   *
+   * @return An empty dictionary var, whose reference count is set to 1 on
+   * behalf of the caller.
+   */
+  PP_Var Create();
+
+  /**
+   * Gets the value associated with the specified key.
+   *
+   * @param[in] dict A dictionary var.
+   * @param[in] key A string var.
+   *
+   * @return The value that is associated with <code>key</code>. The reference
+   * count is incremented on behalf of the caller. If <code>key</code> is not a
+   * string var, or it doesn't exist in <code>dict</code>, an undefined var is
+   * returned.
+   */
+  PP_Var Get([in] PP_Var dict, [in] PP_Var key);
+
+  /**
+   * Sets the value associated with the specified key. The dictionary is
+   * responsible for holding references to its children to keep them alive.
+   *
+   * @param[in] dict A dictionary var.
+   * @param[in] key A string var. If this key hasn't existed in
+   * <code>dict</code>, it is added and associated with <code>value</code>;
+   * otherwise, the previous value is replaced with <code>value</code>.
+   * @param[in] value The value to set.
+   *
+   * @return A <code>PP_Bool</code> indicating whether the operation succeeds.
+   */
+  PP_Bool Set([in] PP_Var dict, [in] PP_Var key, [in] PP_Var value);
+
+  /**
+   * Deletes the specified key and its associated value, if the key exists.
+   *
+   * @param[in] dict A dictionary var.
+   * @param[in] key A string var.
+   */
+  void Delete([in] PP_Var dict, [in] PP_Var key);
+
+  /**
+   * Checks whether a key exists.
+   *
+   * @param[in] dict A dictionary var.
+   * @param[in] key A string var.
+   *
+   * @return A <code>PP_Bool</code> indicating whether the key exists.
+   */
+  PP_Bool HasKey([in] PP_Var dict, [in] PP_Var key);
+
+  /**
+   * Gets all the keys in a dictionary. Please note that for each key that you
+   * set into the dictionary, a string var with the same contents is returned;
+   * but it may not be the same string var (i.e., <code>value.as_id</code> may
+   * be different).
+   *
+   * @param[in] dict A dictionary var.
+   *
+   * @return An array var which contains all the keys of <code>dict</code>. Its
+   * reference count is incremented on behalf of the caller. The elements are
+   * string vars. Returns a null var if failed.
+   */
+  PP_Var GetKeys([in] PP_Var dict);
+};
diff --git a/ppapi/api/dev/ppb_video_capture_dev.idl b/ppapi/api/dev/ppb_video_capture_dev.idl
index 10da4a8..8937960 100644
--- a/ppapi/api/dev/ppb_video_capture_dev.idl
+++ b/ppapi/api/dev/ppb_video_capture_dev.idl
@@ -7,8 +7,8 @@
  * This file defines the <code>PPB_VideoCapture_Dev</code> interface.
  */
 label Chrome {
-  M14 = 0.1,
-  M19 = 0.2
+  M19 = 0.2,
+  M25 = 0.3
 };
 
 /**
@@ -54,25 +54,6 @@
       [in] PP_Resource video_capture);
 
   /**
-   * Starts the capture. |requested_info| is a pointer to a structure containing
-   * the requested resolution and frame rate. |buffer_count| is the number of
-   * buffers requested by the plugin. Note: it is only used as advisory, the
-   * browser may allocate more or fewer based on available resources.
-   * How many buffers depends on usage. At least 2 to make sure latency doesn't
-   * cause lost frames. If the plugin expects to hold on to more than one buffer
-   * at a time (e.g. to do multi-frame processing, like video encoding), it
-   * should request that many more.
-   *
-   * Returns PP_ERROR_FAILED if called when the capture was already started, or
-   * PP_OK on success.
-   */
-  [version=0.1]
-  int32_t StartCapture(
-      [in] PP_Resource video_capture,
-      [in] PP_VideoCaptureDeviceInfo_Dev requested_info,
-      [in] uint32_t buffer_count);
-
-  /**
    * Enumerates video capture devices. Once the operation is completed
    * successfully, |devices| will be set to a PPB_ResourceArray_Dev resource,
    * which holds a list of PPB_DeviceRef_Dev resources.
@@ -85,13 +66,57 @@
    * - the ref count of the returned |devices| has already been increased by 1
    *   for the caller.
    */
-  [version=0.2]
+  [deprecate=0.3]
   int32_t EnumerateDevices(
       [in] PP_Resource video_capture,
       [out] PP_Resource devices,
       [in] PP_CompletionCallback callback);
 
   /**
+   * Enumerates video capture devices.
+   *
+   * @param[in] video_capture A <code>PP_Resource</code> corresponding to a
+   * video capture resource.
+   * @param[in] output An output array which will receive
+   * <code>PPB_DeviceRef_Dev</code> resources on success. Please note that the
+   * ref count of those resources has already been increased by 1 for the
+   * caller.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to run on
+   * completion.
+   *
+   * @return An error code from <code>pp_errors.h</code>.
+   */
+  [version=0.3]
+  int32_t EnumerateDevices(
+      [in] PP_Resource video_capture,
+      [in] PP_ArrayOutput output,
+      [in] PP_CompletionCallback callback);
+
+  /**
+   * Requests device change notifications.
+   *
+   * @param[in] video_capture A <code>PP_Resource</code> corresponding to a
+   * video capture resource.
+   * @param[in] callback The callback to receive notifications. If not NULL, it
+   * will be called once for the currently available devices, and then every
+   * time the list of available devices changes. All calls will happen on the
+   * same thread as the one on which MonitorDeviceChange() is called. It will
+   * receive notifications until <code>video_capture</code> is destroyed or
+   * <code>MonitorDeviceChange()</code> is called to set a new callback for
+   * <code>video_capture</code>. You can pass NULL to cancel sending
+   * notifications.
+   * @param[inout] user_data An opaque pointer that will be passed to
+   * <code>callback</code>.
+   *
+   * @return An error code from <code>pp_errors.h</code>.
+   */
+  [version=0.3]
+  int32_t MonitorDeviceChange(
+      [in] PP_Resource video_capture,
+      [in] PP_MonitorDeviceChangeCallback callback,
+      [inout] mem_t user_data);
+
+  /**
    * Opens a video capture device. |device_ref| identifies a video capture
    * device. It could be one of the resource in the array returned by
    * |EnumerateDevices()|, or 0 which means the default device.
@@ -104,7 +129,6 @@
    * (e.g. to do multi-frame processing, like video encoding), it should request
    * that many more.
    */
-  [version=0.2]
   int32_t Open(
       [in] PP_Resource video_capture,
       [in] PP_Resource device_ref,
@@ -118,7 +142,6 @@
    * Returns PP_ERROR_FAILED if called when the capture was already started, or
    * PP_OK on success.
    */
-  [version=0.2]
   int32_t StartCapture(
       [in] PP_Resource video_capture);
 
@@ -150,7 +173,6 @@
    * If a video capture resource is destroyed while a device is still open, then
    * it will be implicitly closed, so you are not required to call this method.
    */
-  [version=0.2]
   void Close(
       [in] PP_Resource video_capture);
 };
diff --git a/ppapi/api/dev/ppb_view_dev.idl b/ppapi/api/dev/ppb_view_dev.idl
index b72014e..0846bd8 100644
--- a/ppapi/api/dev/ppb_view_dev.idl
+++ b/ppapi/api/dev/ppb_view_dev.idl
@@ -4,6 +4,9 @@
  */
 
 /* This file contains the <code>PPB_View_Dev</code> interface. */
+
+[generate_thunk]
+
 label Chrome {
   M22 = 0.1
 };
diff --git a/ppapi/api/dev/ppb_widget_dev.idl b/ppapi/api/dev/ppb_widget_dev.idl
index 77e5de0..c26cb4e 100644
--- a/ppapi/api/dev/ppb_widget_dev.idl
+++ b/ppapi/api/dev/ppb_widget_dev.idl
@@ -7,6 +7,8 @@
  * Implementation of the widgets interface.
  */
 
+[generate_thunk]
+
 label Chrome {
   M14 = 0.3,
   M23 = 0.4
@@ -26,6 +28,7 @@
    * Paint the given rectangle of the widget into the given image.
    * Returns PP_TRUE on success, PP_FALSE on failure.
    */
+  [report_errors=False]
   PP_Bool Paint([in] PP_Resource widget,
                 [in] PP_Rect rect,
                 [in] PP_Resource image);
@@ -34,24 +37,27 @@
    * Pass in an event to a widget.  It'll return PP_TRUE if the event was
    * consumed.
    */
+  [report_errors=False]
   PP_Bool HandleEvent([in] PP_Resource widget, [in] PP_Resource input_event);
 
   /**
    * Get the location of the widget.
    */
+  [report_errors=False]
   PP_Bool GetLocation([in] PP_Resource widget,
                       [out] PP_Rect location);
 
   /**
    * Set the location of the widget.
    */
+  [report_errors=False]
   void SetLocation([in] PP_Resource widget,
                    [in] PP_Rect location);
 
   /**
    * Set scale used during paint operations.
    */
-  [version=0.4]
+  [version=0.4, report_errors=False]
   void SetScale([in] PP_Resource widget,
                 [in] float_t scale);
 };
diff --git a/ppapi/api/dev/ppp_scrollbar_dev.idl b/ppapi/api/dev/ppp_scrollbar_dev.idl
new file mode 100644
index 0000000..28e9681
--- /dev/null
+++ b/ppapi/api/dev/ppp_scrollbar_dev.idl
@@ -0,0 +1,31 @@
+/* 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.
+ */
+
+/**
+ * This file defines the <code>PPP_Scrollbar_Dev</code> interface.
+ */
+
+label Chrome {
+  M13 = 0.2,
+  M16 = 0.3
+};
+
+interface PPP_Scrollbar_Dev {
+  /**
+   *  Informs the instance that the scrollbar's value has changed.
+   */
+  void ValueChanged([in] PP_Instance instance,
+                    [in] PP_Resource scrollbar,
+                    [in] uint32_t value);
+
+  /**
+   * Informs the instance that the user has changed the system
+   * scrollbar style.
+   */
+  [version=0.3]
+  void OverlayChanged([in] PP_Instance instance,
+                      [in] PP_Resource scrollbar,
+                      [in] PP_Bool overlay);
+};
diff --git a/ppapi/api/dev/ppp_selection_dev.idl b/ppapi/api/dev/ppp_selection_dev.idl
new file mode 100644
index 0000000..1d89789
--- /dev/null
+++ b/ppapi/api/dev/ppp_selection_dev.idl
@@ -0,0 +1,22 @@
+/* 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.
+ */
+
+/**
+ * This file defines the PPP_Selection_Dev interface.
+ */
+
+label Chrome {
+  M13 = 0.3
+};
+
+interface PPP_Selection_Dev {
+  /**
+   * Returns the selection, either as plain text or as html depending on "html".
+   * If nothing is selected, or if the given format is unavailable, return a
+   * void string.
+   */
+  PP_Var GetSelectedText([in] PP_Instance instance,
+                         [in] PP_Bool html);
+};
diff --git a/ppapi/api/extensions/dev/ppb_alarms_dev.idl b/ppapi/api/extensions/dev/ppb_alarms_dev.idl
new file mode 100644
index 0000000..b227993
--- /dev/null
+++ b/ppapi/api/extensions/dev/ppb_alarms_dev.idl
@@ -0,0 +1,178 @@
+/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file defines the Pepper equivalent of the <code>chrome.alarms</code>
+ * extension API.
+ */
+
+label Chrome {
+  M27 = 0.1
+};
+
+#inline c
+#include "ppapi/c/extensions/dev/ppb_events_dev.h"
+#endinl
+
+/**
+ * A dictionary <code>PP_Var</code> which contains:
+ * - "name" : string <code>PP_Var</code>
+ * Name of this alarm.
+ *
+ * - "scheduledTime" : double <code>PP_Var</code>
+ * Time at which this alarm was scheduled to fire, in milliseconds past the
+ * epoch (e.g. <code>Date.now() + n</code>).  For performance reasons, the
+ * alarm may have been delayed an arbitrary amount beyond this.
+ *
+ * - "periodInMinutes" : double or undefined <code>PP_Var</code>
+ * If not undefined, the alarm is a repeating alarm and will fire again in
+ * <var>periodInMinutes</var> minutes.
+ */
+typedef PP_Var PP_Ext_Alarms_Alarm_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "when" : double or undefined <code>PP_Var</code>
+ * Time at which the alarm should fire, in milliseconds past the epoch
+ * (e.g. <code>Date.now() + n</code>).
+ *
+ * - "delayInMinutes" : double or undefined <code>PP_Var</code>
+ * Length of time in minutes after which the
+ * <code>PP_Ext_Alarms_OnAlarm_Dev</code> event should fire.
+ *
+ * - "periodInMinutes" : double or undefined <code>PP_Var</code>
+ * If set, the <code>PP_Ext_Alarms_OnAlarm_Dev</code> event should fire every
+ * <var>periodInMinutes</var> minutes after the initial event specified by
+ * <var>when</var> or <var>delayInMinutes</var>.  If not set, the alarm will
+ * only fire once.
+ */
+typedef PP_Var PP_Ext_Alarms_AlarmCreateInfo_Dev;
+
+/**
+ * An array <code>PP_Var</code> which contains elements of
+ * <code>PP_Ext_Alarms_Alarm_Dev</code>.
+ */
+typedef PP_Var PP_Ext_Alarms_Alarm_Dev_Array;
+
+interface PPB_Ext_Alarms_Dev {
+  /**
+   * Creates an alarm.  Near the time(s) specified by <var>alarm_info</var>,
+   * the <code>PP_Ext_Alarms_OnAlarm_Dev</code> event is fired. If there is
+   * another alarm with the same name (or no name if none is specified), it will
+   * be cancelled and replaced by this alarm.
+   *
+   * In order to reduce the load on the user's machine, Chrome limits alarms
+   * to at most once every 1 minute but may delay them an arbitrary amount
+   * more.  That is, setting
+   * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.delayInMinutes
+   * delayInMinutes]</code> or
+   * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.periodInMinutes
+   * periodInMinutes]</code> to less than <code>1</code> will not be honored
+   * and will cause a warning.
+   * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.when when]</code> can be set
+   * to less than 1 minute after "now" without warning but won't actually cause
+   * the alarm to fire for at least 1 minute.
+   *
+   * To help you debug your app or extension, when you've loaded it unpacked,
+   * there's no limit to how often the alarm can fire.
+   *
+   * @param[in] instance A <code>PP_Instance</code>.
+   * @param[in] name A string or undefined <code>PP_Var</code>. Optional name to
+   * identify this alarm. Defaults to the empty string.
+   * @param[in] alarm_info A <code>PP_Var</code> whose contents conform to the
+   * description of <code>PP_Ext_Alarms_AlarmCreateInfo_Dev</code>. Describes
+   * when the alarm should fire.  The initial time must be specified by either
+   * <var>when</var> or <var>delayInMinutes</var> (but not both).  If
+   * <var>periodInMinutes</var> is set, the alarm will repeat every
+   * <var>periodInMinutes</var> minutes after the initial event.  If neither
+   * <var>when</var> or <var>delayInMinutes</var> is set for a repeating alarm,
+   * <var>periodInMinutes</var> is used as the default for
+   * <var>delayInMinutes</var>.
+   */
+  void Create(
+      [in] PP_Instance instance,
+      [in] PP_Var name,
+      [in] PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info);
+
+  /**
+   * Retrieves details about the specified alarm.
+   *
+   * @param[in] instance A <code>PP_Instance</code>.
+   * @param[in] name A string or undefined <code>PP_Var</code>. The name of the
+   * alarm to get. Defaults to the empty string.
+   * @param[out] alarm A <code>PP_Var</code> whose contents conform to the
+   * description of <code>PP_Ext_Alarms_Alarm_Dev</code>.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+   * completion.
+   *
+   * @return An error code from <code>pp_errors.h</code>
+   */
+  int32_t Get(
+      [in] PP_Instance instance,
+      [in] PP_Var name,
+      [out] PP_Ext_Alarms_Alarm_Dev alarm,
+      [in] PP_CompletionCallback callback);
+
+  /**
+   * Gets an array of all the alarms.
+   *
+   * @param[in] instance A <code>PP_Instance</code>.
+   * @param[out] alarms A <code>PP_Var</code> whose contents conform to the
+   * description of <code>PP_Ext_Alarms_Alarm_Dev_Array</code>.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+   * completion.
+   *
+   * @return An error code from <code>pp_errors.h</code>
+   */
+  int32_t GetAll(
+      [in] PP_Instance instance,
+      [out] PP_Ext_Alarms_Alarm_Dev_Array alarms,
+      [in] PP_CompletionCallback callback);
+
+  /**
+   * Clears the alarm with the given name.
+   *
+   * @param[in] instance A <code>PP_Instance</code>.
+   * @param[in] name A string or undefined <code>PP_Var</code>. The name of the
+   * alarm to clear. Defaults to the empty string.
+   */
+  void Clear(
+      [in] PP_Instance instance,
+      [in] PP_Var name);
+
+  /**
+   * Clears all alarms.
+   *
+   * @param[in] instance A <code>PP_Instance</code>.
+   */
+  void ClearAll(
+      [in] PP_Instance instance);
+};
+
+/**
+ * Fired when an alarm has elapsed. Useful for event pages.
+ *
+ * @param[in] listener_id The listener ID.
+ * @param[inout] user_data The opaque pointer that was used when registering the
+ * listener.
+ * @param[in] alarm A <code>PP_Var</code> whose contents conform to the
+ * description of <code>PP_Ext_Alarms_Alarm_Dev</code>. The alarm that has
+ * elapsed.
+ */
+typedef void PP_Ext_Alarms_OnAlarm_Func_Dev_0_1(
+    [in] uint32_t listener_id,
+    [inout] mem_t user_data,
+    [in] PP_Ext_Alarms_Alarm_Dev alarm);
+
+#inline c
+PP_INLINE struct PP_Ext_EventListener PP_Ext_Alarms_OnAlarm_Dev_0_1(
+    PP_Ext_Alarms_OnAlarm_Func_Dev_0_1 func,
+    void* user_data) {
+  return PP_Ext_MakeEventListener("alarms.onAlarm;0.1",
+                                  (PP_Ext_GenericFuncType)(func), user_data);
+}
+
+#define PP_Ext_Alarms_OnAlarm_Dev PP_Ext_Alarms_OnAlarm_Dev_0_1
+#endinl
diff --git a/ppapi/api/extensions/dev/ppb_events_dev.idl b/ppapi/api/extensions/dev/ppb_events_dev.idl
new file mode 100644
index 0000000..cfcc809
--- /dev/null
+++ b/ppapi/api/extensions/dev/ppb_events_dev.idl
@@ -0,0 +1,87 @@
+/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+label Chrome {
+  M27 = 0.1
+};
+
+/**
+ * Used to represent arbitrary C function pointers. Please note that usually
+ * the function that a <code>PP_Ext_GenericFuncType</code> pointer points to
+ * has a different signature than <code>void (*)()</code>.
+ */
+typedef void PP_Ext_GenericFuncType();
+
+/**
+ * An event listener that can be registered with the browser and receive
+ * notifications via the callback function.
+ *
+ * A function is defined for each event type to return a properly-filled
+ * <code>PP_Ext_EventListener</code> struct, for example,
+ * <code>PP_Ext_Alarms_OnAlarm_Dev()</code>.
+ */
+[passByValue]
+struct PP_Ext_EventListener {
+  /**
+   * The name of the event to register to.
+   */
+  cstr_t event_name;
+  /**
+   * A callback function whose signature is determined by
+   * <code>event_name</code>. All calls will happen on the same thread as the
+   * one on which <code>AddListener()</code> is called.
+   */
+  PP_Ext_GenericFuncType func;
+  /**
+   * An opaque pointer that will be passed to <code>func</code>.
+   */
+  mem_t user_data;
+};
+
+interface PPB_Ext_Events_Dev {
+  /**
+   * Registers a listener to an event.
+   *
+   * @param[in] instance A <code>PP_Instance</code> identifying one instance of
+   * a module.
+   * @param[in] listener A <code>PP_Ext_EventListener</code> struct.
+   *
+   * @return An listener ID, or 0 if failed.
+   */
+  uint32_t AddListener(
+      [in] PP_Instance instance,
+      [in] PP_Ext_EventListener listener);
+
+  /**
+   * Deregisters a listener.
+   *
+   * @param[in] instance A <code>PP_Instance</code> identifying one instance of
+   * a module.
+   * @param[in] listener_id The ID returned by <code>AddListener()</code>.
+   */
+  void RemoveListener(
+      [in] PP_Instance instance,
+      [in] uint32_t listener_id);
+};
+
+#inline c
+/**
+ * Creates a <code>PP_Ext_EventListener</code> struct.
+ *
+ * Usually you should not call it directly. Instead you should call those
+ * functions that return a <code>PP_Ext_EventListener</code> struct for a
+ * specific event type, for example, <code>PP_Ext_Alarms_OnAlarm_Dev()</code>.
+ */
+PP_INLINE struct PP_Ext_EventListener PP_Ext_MakeEventListener(
+    const char* event_name,
+    PP_Ext_GenericFuncType func,
+    void* user_data) {
+  struct PP_Ext_EventListener listener;
+  listener.event_name = event_name;
+  listener.func = func;
+  listener.user_data = user_data;
+  return listener;
+}
+#endinl
diff --git a/ppapi/api/pp_completion_callback.idl b/ppapi/api/pp_completion_callback.idl
index 6db9e2e..833a31a 100644
--- a/ppapi/api/pp_completion_callback.idl
+++ b/ppapi/api/pp_completion_callback.idl
@@ -230,7 +230,7 @@
  *
  * @return A <code>PP_CompletionCallback</code> structure.
  */
-PP_INLINE struct PP_CompletionCallback PP_BlockUntilComplete() {
+PP_INLINE struct PP_CompletionCallback PP_BlockUntilComplete(void) {
   return PP_MakeCompletionCallback(NULL, NULL);
 }
 
diff --git a/ppapi/api/pp_errors.idl b/ppapi/api/pp_errors.idl
index fc0ff4a..54a3ace 100644
--- a/ppapi/api/pp_errors.idl
+++ b/ppapi/api/pp_errors.idl
@@ -103,6 +103,8 @@
    * unexpectedly.
    */
   PP_ERROR_FILECHANGED    = -23,
+  /** This value indicates that the pathname does not reference a file. */
+  PP_ERROR_NOTAFILE       = -24,
   /** This value indicates failure due to a time limit being exceeded. */
   PP_ERROR_TIMEDOUT       = -30,
   /**
diff --git a/ppapi/api/pp_macros.idl b/ppapi/api/pp_macros.idl
index 7954539..999da67 100644
--- a/ppapi/api/pp_macros.idl
+++ b/ppapi/api/pp_macros.idl
@@ -4,7 +4,7 @@
  */
 
 /**
- * Defines the API ...
+ * Defines the common macros such as assert, inline, ...
  */
 
 #inline c
@@ -108,4 +108,3 @@
  */
 
 #endinl
-
diff --git a/ppapi/api/pp_stdint.idl b/ppapi/api/pp_stdint.idl
index 7f6ce46..0a6d6b6 100644
--- a/ppapi/api/pp_stdint.idl
+++ b/ppapi/api/pp_stdint.idl
@@ -39,7 +39,7 @@
 
   /** Pointer to memory (void *). */
   mem_t;
-  
+
   /** Pointer to null terminated string (char *). */
   str_t;
 
@@ -48,6 +48,9 @@
 
   /** No return value. */
   void;
+
+  /** Platform-specific file handle */
+  PP_FileHandle;
 };
 
 #inline c
diff --git a/ppapi/api/pp_touch_point.idl b/ppapi/api/pp_touch_point.idl
index 4b31320..3d58380 100644
--- a/ppapi/api/pp_touch_point.idl
+++ b/ppapi/api/pp_touch_point.idl
@@ -63,7 +63,7 @@
  *
  * @return A <code>PP_TouchPoint</code> structure.
  */
-PP_INLINE struct PP_TouchPoint PP_MakeTouchPoint() {
+PP_INLINE struct PP_TouchPoint PP_MakeTouchPoint(void) {
   struct PP_TouchPoint result = { 0, {0, 0}, {0, 0}, 0, 0 };
   return result;
 }
diff --git a/ppapi/api/pp_var.idl b/ppapi/api/pp_var.idl
index c0f6c9e..fda2332 100644
--- a/ppapi/api/pp_var.idl
+++ b/ppapi/api/pp_var.idl
@@ -159,7 +159,7 @@
  *
  * @return A <code>PP_Var</code> structure.
  */
-PP_INLINE struct PP_Var PP_MakeUndefined() {
+PP_INLINE struct PP_Var PP_MakeUndefined(void) {
   struct PP_Var result = { PP_VARTYPE_UNDEFINED, 0, {PP_FALSE} };
   return result;
 }
@@ -170,7 +170,7 @@
  *
  * @return A <code>PP_Var</code> structure,
  */
-PP_INLINE struct PP_Var PP_MakeNull() {
+PP_INLINE struct PP_Var PP_MakeNull(void) {
   struct PP_Var result = { PP_VARTYPE_NULL, 0, {PP_FALSE} };
   return result;
 }
diff --git a/ppapi/api/ppb_audio.idl b/ppapi/api/ppb_audio.idl
index 97de90a..6d0dcb8 100644
--- a/ppapi/api/ppb_audio.idl
+++ b/ppapi/api/ppb_audio.idl
@@ -8,6 +8,8 @@
  * realtime stereo audio streaming capabilities.
  */
 
+[generate_thunk]
+
 label Chrome {
   M14 = 1.0
 };
diff --git a/ppapi/api/dev/ppb_console_dev.idl b/ppapi/api/ppb_console.idl
similarity index 86%
rename from ppapi/api/dev/ppb_console_dev.idl
rename to ppapi/api/ppb_console.idl
index 86b7606..84daa6f 100644
--- a/ppapi/api/dev/ppb_console_dev.idl
+++ b/ppapi/api/ppb_console.idl
@@ -4,22 +4,24 @@
  */
 
 /**
- * This file defines the <code>PPB_Console_Dev</code> interface.
+ * This file defines the <code>PPB_Console</code> interface.
  */
 
+[generate_thunk]
+
 label Chrome {
-  M14 = 0.1
+  M25 = 1.0
 };
 
 [assert_size(4)]
-enum PP_LogLevel_Dev {
+enum PP_LogLevel {
   PP_LOGLEVEL_TIP = 0,
   PP_LOGLEVEL_LOG = 1,
   PP_LOGLEVEL_WARNING = 2,
   PP_LOGLEVEL_ERROR = 3
 };
 
-interface PPB_Console_Dev {
+interface PPB_Console {
   /**
    * Logs the given message to the JavaScript console associated with the
    * given plugin instance with the given logging level. The name of the plugin
@@ -28,7 +30,7 @@
    */
   void Log(
       [in] PP_Instance instance,
-      [in] PP_LogLevel_Dev level,
+      [in] PP_LogLevel level,
       [in] PP_Var value);
 
   /**
@@ -43,7 +45,7 @@
    */
   void LogWithSource(
       [in] PP_Instance instance,
-      [in] PP_LogLevel_Dev level,
+      [in] PP_LogLevel level,
       [in] PP_Var source,
       [in] PP_Var value);
 };
diff --git a/ppapi/api/ppb_file_io.idl b/ppapi/api/ppb_file_io.idl
index 58f3f13..f89ba17 100644
--- a/ppapi/api/ppb_file_io.idl
+++ b/ppapi/api/ppb_file_io.idl
@@ -8,8 +8,11 @@
  * This file defines the API to create a file i/o object.
  */
 
+[generate_thunk]
+
 label Chrome {
-  M14 = 1.0
+  M14 = 1.0,
+  M25 = 1.1
 };
 
 /**
@@ -143,7 +146,10 @@
   /**
    * Read() reads from an offset in the file.  The size of the buffer must be
    * large enough to hold the specified number of bytes to read.  This function
-   * might perform a partial read.
+   * might perform a partial read, meaning all the requested bytes
+   * might not be returned, even if the end of the file has not been reached.
+   *
+   * ReadToArray() is preferred to Read() when doing asynchronous operations.
    *
    * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
    * FileIO.
@@ -240,5 +246,32 @@
    * FileIO.
    */
   void Close([in] PP_Resource file_io);
+
+  /**
+   * ReadToArray() reads from an offset in the file.  A PP_ArrayOutput must be
+   * provided so that output will be stored in its allocated buffer.  This
+   * function might perform a partial read.
+   *
+   * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
+   * FileIO.
+   * @param[in] offset The offset into the file.
+   * @param[in] max_read_length The maximum number of bytes to read from
+   * <code>offset</code>.
+   * @param[in] output A <code>PP_ArrayOutput</code> to hold the output data.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+   * completion of ReadToArray().
+   *
+   * @return The number of bytes read or an error code from
+   * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was
+   * reached. It is valid to call ReadToArray() multiple times with a completion
+   * callback to queue up parallel reads from the file, but pending reads
+   * cannot be interleaved with other operations.
+   */
+  [version = 1.1]
+  int32_t ReadToArray([in] PP_Resource file_io,
+                      [in] int64_t offset,
+                      [in] int32_t max_read_length,
+                      [inout] PP_ArrayOutput output,
+                      [in] PP_CompletionCallback callback);
 };
 
diff --git a/ppapi/api/ppb_file_system.idl b/ppapi/api/ppb_file_system.idl
index 4cad1eb..cd15cc8 100644
--- a/ppapi/api/ppb_file_system.idl
+++ b/ppapi/api/ppb_file_system.idl
@@ -7,6 +7,8 @@
  * This file defines the API to create a file system associated with a file.
  */
 
+[generate_thunk]
+
 label Chrome {
   M14 = 1.0
 };
@@ -74,6 +76,7 @@
    * is not a valid file system. It is valid to call this function even before
    * Open() completes.
    */
+  [on_failure=PP_FILESYSTEMTYPE_INVALID]
   PP_FileSystemType GetType([in] PP_Resource file_system);
 };
 
diff --git a/ppapi/api/ppb_input_event.idl b/ppapi/api/ppb_input_event.idl
index 73e279d..496a0a6 100644
--- a/ppapi/api/ppb_input_event.idl
+++ b/ppapi/api/ppb_input_event.idl
@@ -265,7 +265,12 @@
    *
    * Request touch events only if you intend to handle them. If the browser
    * knows you do not need to handle touch events, it can handle them at a
-   * higher level and achieve higher performance.
+   * higher level and achieve higher performance. If the plugin does not
+   * register for touch-events, then it will receive synthetic mouse events that
+   * are generated from the touch events (e.g. mouse-down for touch-start,
+   * mouse-move for touch-move (with left-button down), and mouse-up for
+   * touch-end. If the plugin does register for touch events, then the synthetic
+   * mouse events are not created.
    */
   PP_INPUTEVENT_CLASS_TOUCH = 1 << 3,
 
@@ -306,6 +311,9 @@
    * processed very quickly, may have a noticeable effect on the performance of
    * the page.
    *
+   * Note that synthetic mouse events will be generated from touch events if
+   * (and only if) the you do not request touch events.
+   *
    * When requesting input events through this function, the events will be
    * delivered and <i>not</i> bubbled to the page. This means that even if you
    * aren't interested in the message, no other parts of the page will get
diff --git a/ppapi/api/ppb_instance.idl b/ppapi/api/ppb_instance.idl
index 2eb3460..794b452 100644
--- a/ppapi/api/ppb_instance.idl
+++ b/ppapi/api/ppb_instance.idl
@@ -9,8 +9,9 @@
  * the module instance on a web page.
  */
 
+[generate_thunk]
+
 label Chrome {
-  M13 = 0.5,
   M14 = 1.0
  };
 
@@ -19,14 +20,6 @@
  * related to the module instance on a web page.
  */
 interface PPB_Instance {
-  /** Deprecated in 1.0 */
-  [deprecate=1.0]
-  PP_Var GetWindowObject([in] PP_Instance instance);
-
-  /** Deprecated in 1.0 */
-  [deprecate=1.0]
-  PP_Var GetOwnerElementObject([in] PP_Instance instance);
-
   /**
    * BindGraphics() binds the given graphics as the current display surface.
    * The contents of this device is what will be displayed in the instance's
@@ -72,11 +65,5 @@
    */
   PP_Bool IsFullFrame(
       [in] PP_Instance instance);
-
-  /** Deprecated in 0.5 */
-  [deprecate=0.5]
-  PP_Var ExecuteScript([in] PP_Instance instance,
-                       [in] PP_Var script,
-                       [out] PP_Var exception);
 };
 
diff --git a/ppapi/api/dev/ppb_message_loop_dev.idl b/ppapi/api/ppb_message_loop.idl
similarity index 96%
rename from ppapi/api/dev/ppb_message_loop_dev.idl
rename to ppapi/api/ppb_message_loop.idl
index c5072bb..5ae00b1 100644
--- a/ppapi/api/dev/ppb_message_loop_dev.idl
+++ b/ppapi/api/ppb_message_loop.idl
@@ -4,10 +4,10 @@
  */
 
 /**
- * Defines the PPB_MessageLoop_Dev interface.
+ * Defines the PPB_MessageLoop interface.
  */
 label Chrome {
-  M18 = 0.1
+  M25 = 1.0
 };
 
 /**
@@ -117,14 +117,14 @@
  *
  *   pp::CompletionCallback callback = factory_.NewOptionalCallback(...);
  *   int32_t result = message_loop.PostWork(callback);
- *   if (result != PP_OK_COMPLETIONPENDING)
+ *   if (result != PP_OK)
  *     callback.Run(result);
  *
  * This will run the callback with an error value, and assumes that the
  * implementation of your callback checks the "result" argument and returns
  * immediately on error.
  */
-interface PPB_MessageLoop_Dev {
+interface PPB_MessageLoop {
   /**
    * Creates a message loop resource.
    *
@@ -231,9 +231,9 @@
    * PP_FALSE. It will be queued until the next invocation of Run().
    *
    * @return
-   *   - PP_OK_COMPLETIONPENDING: The work was posted to the message loop's
-   *     queue. As described above, this does not mean that the work has been
-   *     or will be executed (if you never run the message loop after posting).
+   *   - PP_OK: The work was posted to the message loop's queue. As described
+   *     above, this does not mean that the work has been or will be executed
+   *     (if you never run the message loop after posting).
    *   - PP_ERROR_BADRESOURCE: The given message loop resource is invalid.
    *   - PP_ERROR_BADARGUMENT: The function pointer for the completion callback
    *     is null (this will be the case if you pass PP_BlockUntilComplete()).
@@ -248,7 +248,8 @@
    * before that point will be processed before quitting.
    *
    * This may be called on the message loop registered for the current thread,
-   * or it may be called on the message loop registered for another thread.
+   * or it may be called on the message loop registered for another thread. It
+   * is an error to attempt to PostQuit() the main thread loop.
    *
    * @param should_destroy Marks the message loop as being in a destroyed state
    * and prevents further posting of messages.
diff --git a/ppapi/api/ppb_messaging.idl b/ppapi/api/ppb_messaging.idl
index fbdb619..7c9a7ae 100644
--- a/ppapi/api/ppb_messaging.idl
+++ b/ppapi/api/ppb_messaging.idl
@@ -9,6 +9,8 @@
  * specific module instance.
  */
 
+[generate_thunk]
+
 label Chrome {
   M14 = 1.0
 };
diff --git a/ppapi/api/ppb_mouse_cursor.idl b/ppapi/api/ppb_mouse_cursor.idl
index 7d67a8a..cb91786 100644
--- a/ppapi/api/ppb_mouse_cursor.idl
+++ b/ppapi/api/ppb_mouse_cursor.idl
@@ -8,6 +8,8 @@
  * the mouse cursor.
  */
 
+[generate_thunk]
+
 label Chrome {
   M19 = 1.0
 };
diff --git a/ppapi/api/ppb_mouse_lock.idl b/ppapi/api/ppb_mouse_lock.idl
index 23e4722..ca4605a 100644
--- a/ppapi/api/ppb_mouse_lock.idl
+++ b/ppapi/api/ppb_mouse_lock.idl
@@ -21,8 +21,7 @@
  */
 interface PPB_MouseLock {
   /**
-   * LockMouse() requests the mouse to be locked. The browser will permit mouse 
-   * lock only while the tab is in fullscreen mode.
+   * LockMouse() requests the mouse to be locked.
    *
    * While the mouse is locked, the cursor is implicitly hidden from the user.
    * Any movement of the mouse will generate a
diff --git a/ppapi/api/ppb_var_array_buffer.idl b/ppapi/api/ppb_var_array_buffer.idl
index b2b5b48..f48c19f 100644
--- a/ppapi/api/ppb_var_array_buffer.idl
+++ b/ppapi/api/ppb_var_array_buffer.idl
@@ -57,10 +57,13 @@
   /**
    * Map() maps the <code>ArrayBuffer</code> in to the module's address space
    * and returns a pointer to the beginning of the buffer for the given
-   * <code>ArrayBuffer PP_Var</code>. Note that calling Map() can be a
-   * relatively expensive operation. Use care when calling it in
-   * performance-critical code. For example, you should call it only once when
-   * looping over an <code>ArrayBuffer</code>.
+   * <code>ArrayBuffer PP_Var</code>. ArrayBuffers are copied when transmitted,
+   * so changes to the underlying memory are not automatically available to
+   * the embedding page.
+   *
+   * Note that calling Map() can be a relatively expensive operation. Use care
+   * when calling it in performance-critical code. For example, you should call
+   * it only once when looping over an <code>ArrayBuffer</code>.
    *
    * <strong>Example:</strong>
    *
diff --git a/ppapi/api/ppb_view.idl b/ppapi/api/ppb_view.idl
index b51756c..cc61ed2 100644
--- a/ppapi/api/ppb_view.idl
+++ b/ppapi/api/ppb_view.idl
@@ -8,6 +8,8 @@
  * of the view of an instance.
  */
 
+[generate_thunk]
+
 label Chrome {
   M18 = 1.0
 };
diff --git a/ppapi/api/ppb_websocket.idl b/ppapi/api/ppb_websocket.idl
index 0069bb4..d006d28 100644
--- a/ppapi/api/ppb_websocket.idl
+++ b/ppapi/api/ppb_websocket.idl
@@ -7,6 +7,9 @@
  * This file defines the <code>PPB_WebSocket</code> interface providing
  * bi-directional, full-duplex, communications over a single TCP socket.
  */
+
+[generate_thunk]
+
 label Chrome {
   M18 = 1.0
 };
@@ -240,6 +243,7 @@
    * Returns <code>PP_ERROR_INPROGRESS</code> if this is not the first call to
    * Connect().
    */
+  [report_errors=False]
   int32_t Connect([in] PP_Resource web_socket,
                   [in] PP_Var url,
                   [in, size_as=protocol_count] PP_Var[] protocols,
@@ -282,6 +286,7 @@
    * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to Close() is
    * not finished.
    */
+  [report_errors=False]
   int32_t Close([in] PP_Resource web_socket,
                 [in] uint16_t code,
                 [in] PP_Var reason,
@@ -311,6 +316,7 @@
    * Until buffered message become empty, ReceiveMessage() continues to return
    * <code>PP_OK</code> as if connection is still established without errors.
    */
+  [report_errors=False]
   int32_t ReceiveMessage([in] PP_Resource web_socket,
                          [out] PP_Var message,
                          [in] PP_CompletionCallback callback);
@@ -338,6 +344,7 @@
    * Otherwise, returns <code>PP_OK</code>, which doesn't necessarily mean
    * that the server received the message.
    */
+  [report_errors=False]
   int32_t SendMessage([in] PP_Resource web_socket,
                       [in] PP_Var message);
 
@@ -351,6 +358,7 @@
    *
    * @return Returns the number of bytes.
    */
+  [report_errors=False]
   uint64_t GetBufferedAmount([in] PP_Resource web_socket);
 
   /**
@@ -362,6 +370,7 @@
    *
    * @return Returns 0 if called before the close code is set.
    */
+  [report_errors=False]
   uint16_t GetCloseCode([in] PP_Resource web_socket);
 
   /**
@@ -375,6 +384,7 @@
    * close reason is set, the return value contains an empty string. Returns a
    * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource.
    */
+  [report_errors=False]
   PP_Var GetCloseReason([in] PP_Resource web_socket);
 
   /**
@@ -389,6 +399,7 @@
    * Otherwise, returns <code>PP_TRUE</code> if the connection was closed
    * cleanly.
    */
+  [report_errors=False]
   PP_Bool GetCloseWasClean([in] PP_Resource web_socket);
 
   /**
@@ -402,6 +413,7 @@
    * connection is established, the var's data is an empty string. Returns a
    * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource.
    */
+  [report_errors=False]
   PP_Var GetExtensions([in] PP_Resource web_socket);
 
   /**
@@ -415,6 +427,7 @@
    * connection is established, the var contains the empty string. Returns a
    * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource.
    */
+  [report_errors=False]
   PP_Var GetProtocol([in] PP_Resource web_socket);
 
   /**
@@ -428,6 +441,7 @@
    * before Connect() is called, or if this function is called on an
    * invalid resource.
    */
+  [on_failure=PP_WEBSOCKETREADYSTATE_INVALID, report_errors=False]
   PP_WebSocketReadyState GetReadyState([in] PP_Resource web_socket);
 
   /**
@@ -441,5 +455,6 @@
    * <code>PP_VARTYPE_UNDEFINED</code> if this function is called on an
    * invalid resource.
    */
+  [report_errors=False]
   PP_Var GetURL([in] PP_Resource web_socket);
 };
diff --git a/ppapi/api/ppp.idl b/ppapi/api/ppp.idl
index 537813c..6cb99e0 100644
--- a/ppapi/api/ppp.idl
+++ b/ppapi/api/ppp.idl
@@ -77,7 +77,7 @@
  * implementations in certain circumstances when Chrome does "fast shutdown"
  * of a web page.
  */
-PP_EXPORT void PPP_ShutdownModule();
+PP_EXPORT void PPP_ShutdownModule(void);
 /**
  * @}
  */
diff --git a/ppapi/api/private/finish_writing_these/ppb_flash_menu.idl b/ppapi/api/private/finish_writing_these/ppb_flash_menu.idl
deleted file mode 100644
index 85149ad..0000000
--- a/ppapi/api/private/finish_writing_these/ppb_flash_menu.idl
+++ /dev/null
@@ -1,52 +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.
- */
-
-/* PPB_Flash */
-
-/* Menu item type.
- *
- * TODO(viettrungluu): Radio items not supported yet. Will also probably want
- * special menu items tied to clipboard access.
- */
-enum PP_Flash_MenuItem_Type {
-  PP_FLASH_MENUITEM_TYPE_NORMAL    = 0,
-  PP_FLASH_MENUITEM_TYPE_CHECKBOX  = 1,
-  PP_FLASH_MENUITEM_TYPE_SEPARATOR = 2,
-  PP_FLASH_MENUITEM_TYPE_SUBMENU   = 3
-};
-
-struct PP_Flash_MenuItem {
-  PP_Flash_MenuItem_Type type;
-  str_t name;
-  int32_t id;
-  PP_Bool enabled;
-  PP_Bool checked;
-  PP_Flash_Menu submenu;
-};
-
-struct PP_Flash_Menu {
-  uint32_t count;
-  [size_is(count)] PP_Flash_MenuItem[] items;
-};
-
-interface PPB_Flash_Menu_0_1 {
-  PP_Resource Create(
-      [in] PP_Instance instance_id,
-      [in] PP_Flash_Menu menu_data);
-
-  PP_Bool IsFlashMenu(
-      [in] PP_Resource resource_id);
-
-  /* Display a context menu at the given location. If the user selects an item,
-   * |selected_id| will be set to its |id| and the callback called with |PP_OK|.
-   * If the user dismisses the menu without selecting an item,
-   * |PP_ERROR_USERCANCEL| will be indicated.
-   */
-  int32_t Show(
-      [in] PP_Resource menu_id,
-      [in] PP_Point location,
-      [out] int32_t selected_id,
-      [in] PP_CompletionCallback callback);
-};
diff --git a/ppapi/api/private/finish_writing_these/ppb_nacl_private.idl b/ppapi/api/private/finish_writing_these/ppb_nacl_private.idl
deleted file mode 100644
index 600b264..0000000
--- a/ppapi/api/private/finish_writing_these/ppb_nacl_private.idl
+++ /dev/null
@@ -1,57 +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.
- */
-
-/* This file contains NaCl private interfaces. */
-
-#include "ppapi/c/private/pp_file_handle.h"
-
-/* PPB_NaCl_Private */
-interface PPB_NaCl_Private_0_9 {
-  /* This function launches NaCl's sel_ldr process.  On success, the function
-   * returns true, otherwise it returns false.  When it returns true, it will
-   * write |socket_count| nacl::Handles to imc_handles.
-   */
-  PP_Bool LaunchSelLdr([in] PP_Instance instance,
-                       [in] str_t alleged_url,
-                       [in] int32_t socket_count,
-                       [out] mem_t imc_handles);
-
-  /* This function starts the PPAPI proxy so the nexe can communicate with the
-   * browser's renderer process.
-   */
-  PP_Bool StartPpapiProxy([in] PP_Instance instance);
-
-  /* On POSIX systems, this function returns the file descriptor of
-   * /dev/urandom.  On non-POSIX systems, this function returns 0.
-   */
-  int32_t UrandomFD();
-
-  /* Whether the Pepper 3D interfaces should be disabled in the NaCl PPAPI
-   * proxy. This is so paranoid admins can effectively prevent untrusted shader
-   * code to be processed by the graphics stack.
-   */
-  bool Are3DInterfacesDisabled();
-
-  /* Returns a read-only file descriptor of a file rooted in the Pnacl
-   * component directory, or -1 on error.
-   * Do we want this to take a completion callback and be async, or
-   * could we make this happen on another thread?
-   */
-  PP_FileHandle GetReadonlyPnaclFd([in] str_t filename);
-
-  /* This creates a temporary file that will be deleted by the time
-   * the last handle is closed (or earlier on POSIX systems), and
-   * returns a posix handle to that temporary file.
-   */
-  PP_FileHandle CreateTemporaryFile([in] PP_Instance instance);
-
-  /* Return true if we are off the record.
-   */
-  PP_Bool IsOffTheRecord();
-
-  /* Return true if PNaCl is turned on.
-   */
-  PP_Bool IsPnaclEnabled();
-};
diff --git a/ppapi/api/private/pp_content_decryptor.idl b/ppapi/api/private/pp_content_decryptor.idl
index 8681cfd..aba404f 100644
--- a/ppapi/api/private/pp_content_decryptor.idl
+++ b/ppapi/api/private/pp_content_decryptor.idl
@@ -18,11 +18,16 @@
   uint32_t request_id;
 
   /**
-   * 4-byte padding to make the size of <code>PP_DecryptTrackingInfo</code>
-   * a multiple of 8 bytes and make sure |timestamp| starts on 8-byte boundary.
-   * The value of this field should not be used.
+   * A unique buffer ID to identify a PPB_Buffer_Dev. Unlike a PP_Resource,
+   * this ID is identical at both the renderer side and the plugin side.
+   * In <code>PPB_ContentDecryptor_Private</code> calls, this is the ID of the
+   * buffer associated with the decrypted block/frame/samples.
+   * In <code>PPP_ContentDecryptor_Private</code> calls, this is the ID of a
+   * buffer that is no longer need at the renderer side, which can be released
+   * or recycled by the plugin. This ID can be 0 if there is no buffer to be
+   * released or recycled.
    */
-  uint32_t padding;
+  uint32_t buffer_id;
 
   /**
    * Timestamp in microseconds of the associated block. By using this value,
@@ -76,7 +81,7 @@
  * The <code>PP_EncryptedBlockInfo</code> struct contains all the information
  * needed to decrypt an encrypted block.
  */
-[assert_size(240)]
+[assert_size(248)]
 struct PP_EncryptedBlockInfo {
   /**
    * Information needed by the client to track the block to be decrypted.
@@ -84,6 +89,11 @@
   PP_DecryptTrackingInfo tracking_info;
 
   /**
+   * Size in bytes of data to be decrypted (data_offset included).
+   */
+  uint32_t data_size;
+
+  /**
    * Size in bytes of data to be discarded before applying the decryption.
    */
   uint32_t data_offset;
@@ -111,6 +121,12 @@
    */
   PP_DecryptSubsampleDescription[16] subsamples;
   uint32_t num_subsamples;
+
+  /**
+   * 4-byte padding to make the size of <code>PP_EncryptedBlockInfo</code>
+   * a multiple of 8 bytes. The value of this field should not be used.
+   */
+  uint32_t padding;
 };
 
 /**
@@ -153,11 +169,10 @@
   PP_DecryptResult result;
 
   /**
-   * 4-byte padding to make the size of <code>PP_DecryptedBlockInfo</code>
-   * a multiple of 8 bytes, and ensure consistent size on all targets. This
-   * value should never be used.
+   * Size in bytes of decrypted data, which may be less than the size of the
+   * corresponding buffer.
    */
-  uint32_t padding;
+  uint32_t data_size;
 
   /**
    * Information needed by the client to track the block to be decrypted.
diff --git a/ppapi/api/private/ppb_content_decryptor_private.idl b/ppapi/api/private/ppb_content_decryptor_private.idl
index c915ae0..e18afef 100644
--- a/ppapi/api/private/ppb_content_decryptor_private.idl
+++ b/ppapi/api/private/ppb_content_decryptor_private.idl
@@ -8,6 +8,9 @@
  * interface. Note: This is a special interface, only to be used for Content
  * Decryption Modules, not normal plugins.
  */
+
+[generate_thunk]
+
 label Chrome {
   M24 = 0.6
 };
@@ -40,7 +43,7 @@
    * <code>PP_VARTYPE_STRING</code> containing the session ID.
    *
    * @param[in] init_data A <code>PP_Var</code> of type
-   * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container-specific
+   * <code>PP_VARTYPE_ARRAY_BUFFER</code> containing container-specific
    * initialization data.
    */
   void NeedKey(
@@ -93,8 +96,8 @@
    * @param[in] session_id A <code>PP_Var</code> of type
    * <code>PP_VARTYPE_STRING</code> containing the session ID.
    *
-   * @param[in] resource A <code>PP_Resource</code> corresponding to a
-   * <code>PPB_Buffer_Dev</code> resource that contains the message.
+   * @param[in] message A <code>PP_Var</code> of type
+   * <code>PP_VARTYPE_ARRAY_BUFFER</code> that contains the message.
    *
    * @param[in] default_url A <code>PP_Var</code> of type
    * <code>PP_VARTYPE_STRING</code> containing the default URL for the message.
@@ -103,7 +106,7 @@
       [in] PP_Instance instance,
       [in] PP_Var key_system,
       [in] PP_Var session_id,
-      [in] PP_Resource message,
+      [in] PP_Var message,
       [in] PP_Var default_url);
 
   /**
@@ -132,6 +135,10 @@
    * <code>PPP_ContentDecryptor_Private</code> interface completes to
    * deliver decrypted_block to the browser for decoding and rendering.
    *
+   * The plugin must not hold a reference to the encrypted buffer resource
+   * provided to <code>Decrypt()</code> when it calls this method. The browser
+   * will reuse the buffer in a subsequent <code>Decrypt()</code> call.
+   *
    * @param[in] decrypted_block A <code>PP_Resource</code> corresponding to a
    * <code>PPB_Buffer_Dev</code> resource that contains a decrypted data
    * block.
@@ -206,6 +213,11 @@
    * <code>PPP_ContentDecryptor_Private</code> interface completes to deliver
    * a decrypted and decoded video frame to the browser for rendering.
    *
+   * The plugin must not hold a reference to the encrypted buffer resource
+   * provided to <code>DecryptAndDecode()</code> when it calls this method. The
+   * browser will reuse the buffer in a subsequent
+   * <code>DecryptAndDecode()</code> call.
+   *
    * @param[in] decrypted_frame A <code>PP_Resource</code> corresponding to a
    * <code>PPB_Buffer_Dev</code> resource that contains a video frame.
    *
@@ -220,10 +232,15 @@
 
   /**
    * Called after the <code>DecryptAndDecode()</code> method on the
-   * <code>PPP_ContentDecryptor_Private</code> interface completes to
-   * deliver a buffer of decrypted and decoded audio samples to the browser for
+   * <code>PPP_ContentDecryptor_Private</code> interface completes to deliver
+   * a buffer of decrypted and decoded audio samples to the browser for
    * rendering.
    *
+   * The plugin must not hold a reference to the encrypted buffer resource
+   * provided to <code>DecryptAndDecode()</code> when it calls this method. The
+   * browser will reuse the buffer in a subsequent
+   * <code>DecryptAndDecode()</code> call.
+   *
    * <code>audio_frames</code> can contain multiple audio output buffers. Each
    * buffer is serialized in this format:
    *
diff --git a/ppapi/api/private/ppb_flash.idl b/ppapi/api/private/ppb_flash.idl
index 024796d..bedef84 100644
--- a/ppapi/api/private/ppb_flash.idl
+++ b/ppapi/api/private/ppb_flash.idl
@@ -8,13 +8,10 @@
  */
 
 label Chrome {
-  M17 = 12.0,
-  M19 = 12.1,
-  M20_0 = 12.2,
-  M20_1 = 12.3,
   M21 = 12.4,
   M22 = 12.5,
-  M24 = 12.6
+  M24_0 = 12.6,
+  M24_1 = 13.0
 };
 
 [assert_size(4)]
@@ -87,7 +84,15 @@
    * Specifies restrictions on how flash should handle LSOs. The result is an
    * int from <code>PP_FlashLSORestrictions</code>.
    */
-  PP_FLASHSETTING_LSORESTRICTIONS = 6
+  PP_FLASHSETTING_LSORESTRICTIONS = 6,
+
+  /**
+   * Specifies if the driver is reliable enough to use Shader Model 3 commands
+   * with it.
+   *
+   * This should only be enabled if PP_FLASHSETTING_STAGE3DENABLED is true.
+   */
+  PP_FLASHSETTING_STAGE3DBASELINEENABLED = 7
 };
 
 /**
@@ -126,7 +131,7 @@
   PP_Bool DrawGlyphs(
       [in] PP_Instance instance,
       [in] PP_Resource pp_image_data,
-      [in] PP_FontDescription_Dev font_desc,
+      [in] PP_BrowserFont_Trusted_Description font_desc,
       [in] uint32_t color,
       [in] PP_Point position,
       [in] PP_Rect clip,
@@ -154,18 +159,16 @@
       [in] PP_Bool from_user_action);
 
   /**
-   * Runs a nested message loop. The plugin will be reentered from this call.
-   * This function is used in places where Flash would normally enter a nested
-   * message loop (e.g., when displaying context menus), but Pepper provides
-   * only an asynchronous call. After performing that asynchronous call, call
-   * |RunMessageLoop()|. In the callback, call |QuitMessageLoop()|.
+   * Deprecated. Does nothing. Use PPB_Flash_MessageLoop.
    */
+  [deprecate=13.0]
   void RunMessageLoop(
       [in] PP_Instance instance);
 
-  /* Posts a quit message for the outermost nested message loop. Use this to
-   * exit and return back to the caller after you call RunMessageLoop.
+  /**
+   * Deprecated. Does nothing. Use PPB_Flash_MessageLoop.
    */
+  [deprecate=13.0]
   void QuitMessageLoop(
       [in] PP_Instance instance);
 
@@ -199,15 +202,14 @@
    * Returns whether the given rectangle (in the plugin) is topmost, i.e., above
    * all other web content.
    */
-  [version=12.1]
   PP_Bool IsRectTopmost(
       [in] PP_Instance instance,
       [in] PP_Rect rect);
 
   /**
-   * Does nothing, deprecated. See PPB_Flash_Print.
+   * Deprecated. Does nothing. Use PPB_Flash_Print.
    */
-  [version=12.1]
+  [deprecate=13.0]
   int32_t InvokePrinting(
       [in] PP_Instance instance);
 
@@ -215,21 +217,19 @@
    * Indicates that there's activity and, e.g., the screensaver shouldn't kick
    * in.
    */
-  [version=12.1]
   void UpdateActivity(
       [in] PP_Instance instance);
 
   /**
-   * Returns the device ID as a string. Returns a PP_VARTYPE_UNDEFINED on error.
-   * Deprecated, use GetDeviceIDAsync.
+   * Deprecated. Does nothing.
    */
-  [version=12.2]
+  [deprecate=13.0]
   PP_Var GetDeviceID([in] PP_Instance instance);
 
   /**
-   * Deprecated. See GetSetting().
+   * Deprecated. Does nothing. See GetSetting().
    */
-  [version=12.3]
+  [deprecate=13.0]
   int32_t GetSettingInt([in] PP_Instance instance,
                         [in] PP_FlashSetting setting);
 
@@ -237,7 +237,6 @@
    * Returns the value associated with the given setting. Invalid enums will
    * result in an undefined PP_Var return value.
    */
-  [version=12.4]
   PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting);
 
   /**
diff --git a/ppapi/api/private/ppb_flash_device_id.idl b/ppapi/api/private/ppb_flash_device_id.idl
index dd69b3d..1fa4986 100644
--- a/ppapi/api/private/ppb_flash_device_id.idl
+++ b/ppapi/api/private/ppb_flash_device_id.idl
@@ -7,6 +7,8 @@
  * This file contains the <code>PPB_Flash_DeviceID</code> interface.
  */
 
+[generate_thunk]
+
 label Chrome {
   M21 = 1.0
 };
diff --git a/ppapi/api/private/ppb_flash_font_file.idl b/ppapi/api/private/ppb_flash_font_file.idl
index 51309f1..b7c39b4 100644
--- a/ppapi/api/private/ppb_flash_font_file.idl
+++ b/ppapi/api/private/ppb_flash_font_file.idl
@@ -17,7 +17,7 @@
    */
   PP_Resource Create(
       [in] PP_Instance instance,
-      [in] PP_FontDescription_Dev description,
+      [in] PP_BrowserFont_Trusted_Description description,
       [in] PP_PrivateFontCharset charset);
 
   /* Determines if a given resource is Flash font file.
@@ -37,3 +37,4 @@
       [out] mem_t output,
       [out] uint32_t output_length);
 };
+
diff --git a/ppapi/api/private/ppb_flash_menu.idl b/ppapi/api/private/ppb_flash_menu.idl
new file mode 100644
index 0000000..253d8bd
--- /dev/null
+++ b/ppapi/api/private/ppb_flash_menu.idl
@@ -0,0 +1,54 @@
+/* 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.
+ */
+
+/**
+ * This file defines the <code>PPB_Flash_Menu</code> interface.
+ */
+label Chrome {
+  M14 = 0.2
+};
+
+/* Menu item type.
+ *
+ * TODO(viettrungluu): Radio items not supported yet. Will also probably want
+ * special menu items tied to clipboard access.
+ */
+[assert_size(4)]
+enum PP_Flash_MenuItem_Type {
+  PP_FLASH_MENUITEM_TYPE_NORMAL = 0,
+  PP_FLASH_MENUITEM_TYPE_CHECKBOX = 1,
+  PP_FLASH_MENUITEM_TYPE_SEPARATOR = 2,
+  PP_FLASH_MENUITEM_TYPE_SUBMENU = 3
+};
+
+struct PP_Flash_MenuItem {
+  PP_Flash_MenuItem_Type type;
+  str_t name;
+  int32_t id;
+  PP_Bool enabled;
+  PP_Bool checked;
+  [ref] PP_Flash_Menu submenu;
+};
+
+struct PP_Flash_Menu {
+  uint32_t count;
+  [size_is(count)] PP_Flash_MenuItem[] items;
+};
+
+interface PPB_Flash_Menu {
+  PP_Resource Create([in] PP_Instance instance_id,
+                     [in] PP_Flash_Menu menu_data);
+  PP_Bool IsFlashMenu(PP_Resource resource_id);
+  /* Display a context menu at the given location. If the user selects an item,
+   * |selected_id| will be set to its |id| and the callback called with |PP_OK|.
+   * If the user dismisses the menu without selecting an item,
+   * |PP_ERROR_USERCANCEL| will be indicated.
+   */
+  int32_t Show([in] PP_Resource menu_id,
+               [in] PP_Point location,
+               [out] int32_t selected_id,
+               [in] PP_CompletionCallback callback);
+};
+
diff --git a/ppapi/api/private/ppb_instance_private.idl b/ppapi/api/private/ppb_instance_private.idl
index 2b0cc7c..25fe5a2 100644
--- a/ppapi/api/private/ppb_instance_private.idl
+++ b/ppapi/api/private/ppb_instance_private.idl
@@ -9,6 +9,8 @@
  * instances.
  */
 
+[generate_thunk]
+
 label Chrome {
   M13 = 0.1
 };
diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl
new file mode 100644
index 0000000..4f14d5a
--- /dev/null
+++ b/ppapi/api/private/ppb_nacl_private.idl
@@ -0,0 +1,115 @@
+/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* This file contains NaCl private interfaces. */
+
+#inline c
+#include "ppapi/c/private/pp_file_handle.h"
+#endinl
+
+/**
+ * The <code>PP_NaClResult</code> enum contains NaCl result codes.
+ */
+[assert_size(4)]
+enum PP_NaClResult {
+  /** Successful NaCl call */
+  PP_NACL_OK = 0,
+  /** Unspecified NaCl error */
+  PP_NACL_FAILED = 1,
+  /** Error creating the module */
+  PP_NACL_ERROR_MODULE = 2,
+  /** Error creating and initializing the instance */
+  PP_NACL_ERROR_INSTANCE = 3
+};
+
+/** NaCl-specific errors that should be reported to the user */
+enum PP_NaClError {
+  /**
+   *  The manifest program element does not contain a program usable on the
+   *  user's architecture
+  */
+  PP_NACL_MANIFEST_MISSING_ARCH = 0
+};
+
+/* PPB_NaCl_Private */
+interface PPB_NaCl_Private {
+  /* Launches NaCl's sel_ldr process.  Returns PP_NACL_OK on success and
+   * writes a NaClHandle to imc_handle. Returns PP_NACL_FAILED on failure.
+   * The |enable_ppapi_dev| parameter controls whether GetInterface
+   * returns 'Dev' interfaces to the NaCl plugin.  The |uses_ppapi| flag
+   * indicates that the nexe run by sel_ldr will use the PPAPI APIs.
+   * This implies that LaunchSelLdr is run from the main thread.  If a nexe
+   * does not need PPAPI, then it can run off the main thread.
+   * The |uses_irt| flag indicates whether the IRT should be loaded in this
+   * NaCl process.  This is true for ABI stable nexes.
+   */
+  PP_NaClResult LaunchSelLdr([in] PP_Instance instance,
+                             [in] str_t alleged_url,
+                             [in] PP_Bool uses_irt,
+                             [in] PP_Bool uses_ppapi,
+                             [in] PP_Bool enable_ppapi_dev,
+                             [out] mem_t imc_handle);
+
+  /* This function starts the IPC proxy so the nexe can communicate with the
+   * browser. Returns PP_NACL_OK on success, otherwise a result code indicating
+   * the failure. PP_NACL_FAILED is returned if LaunchSelLdr wasn't called with
+   * the instance. PP_NACL_ERROR_MODULE is returned if the module can't be
+   * initialized. PP_NACL_ERROR_INSTANCE is returned if the instance can't be
+   * initialized. PP_NACL_USE_SRPC is returned if the plugin should use SRPC.
+   */
+  PP_NaClResult StartPpapiProxy(PP_Instance instance);
+
+  /* On POSIX systems, this function returns the file descriptor of
+   * /dev/urandom.  On non-POSIX systems, this function returns 0.
+   */
+  int32_t UrandomFD();
+
+  /* Whether the Pepper 3D interfaces should be disabled in the NaCl PPAPI
+   * proxy. This is so paranoid admins can effectively prevent untrusted shader
+   * code to be processed by the graphics stack.
+   */
+  PP_Bool Are3DInterfacesDisabled();
+
+  /* Enables the creation of sel_ldr processes off of the main thread.
+   */
+  void EnableBackgroundSelLdrLaunch();
+
+  /* This is Windows-specific.  This is a replacement for DuplicateHandle() for
+   * use inside the Windows sandbox.  Note that we provide this via dependency
+   * injection only to avoid the linkage problems that occur because the NaCl
+   * plugin is built as a separate DLL/DSO
+   * (see http://code.google.com/p/chromium/issues/detail?id=114439#c8).
+   */
+  int32_t BrokerDuplicateHandle([in] PP_FileHandle source_handle,
+                                [in] uint32_t process_id,
+                                [out] PP_FileHandle target_handle,
+                                [in] uint32_t desired_access,
+                                [in] uint32_t options);
+
+  /* Returns a read-only file descriptor of a file rooted in the Pnacl
+   * component directory, or -1 on error.
+   * Do we want this to take a completion callback and be async, or
+   * could we make this happen on another thread?
+   */
+  PP_FileHandle GetReadonlyPnaclFd([in] str_t filename);
+
+  /* This creates a temporary file that will be deleted by the time
+   * the last handle is closed (or earlier on POSIX systems), and
+   * returns a posix handle to that temporary file.
+   */
+  PP_FileHandle CreateTemporaryFile([in] PP_Instance instance);
+
+  /* Return true if we are off the record.
+   */
+  PP_Bool IsOffTheRecord();
+
+  /* Return true if PNaCl is turned on.
+   */
+  PP_Bool IsPnaclEnabled();
+
+  /* Display a UI message to the user. */
+  PP_NaClResult ReportNaClError([in] PP_Instance instance,
+                                [in] PP_NaClError message_id);
+};
diff --git a/ppapi/api/private/ppb_talk_private.idl b/ppapi/api/private/ppb_talk_private.idl
index 65265ae..8422fe0 100644
--- a/ppapi/api/private/ppb_talk_private.idl
+++ b/ppapi/api/private/ppb_talk_private.idl
@@ -22,8 +22,8 @@
   /**
    * Displays security UI.
    *
-   * The callback will be issued with PP_OK as the result of the user gave
-   * permission, or PP_ERROR_NOACCESS if the user denied.
+   * The callback will be issued with 1 as the result if the user gave
+   * permission, or 0 if the user denied.
    *
    * You can only have one call pending. It will return PP_OK_COMPLETIONPENDING
    * if the request is queued, or PP_ERROR_INPROGRESS if there is already a
diff --git a/ppapi/api/private/ppb_tcp_socket_private.idl b/ppapi/api/private/ppb_tcp_socket_private.idl
index 385dee6..5c5d54a 100644
--- a/ppapi/api/private/ppb_tcp_socket_private.idl
+++ b/ppapi/api/private/ppb_tcp_socket_private.idl
@@ -9,7 +9,19 @@
 
 label Chrome {
   M17 = 0.3,
-  M20 = 0.4
+  M20 = 0.4,
+  M27 = 0.5
+};
+
+[assert_size(4)]
+enum PP_TCPSocketOption_Private {
+  // Special value used for testing. Guaranteed to fail SetOption().
+  PP_TCPSOCKETOPTION_INVALID = 0,
+
+  // Disable coalescing of small writes to make TCP segments, and instead
+  // deliver data immediately. For SSL sockets, this option must be set before
+  // SSLHandshake() is called. Value type is PP_VARTYPE_BOOL.
+  PP_TCPSOCKETOPTION_NO_DELAY = 1
 };
 
 /**
@@ -134,4 +146,17 @@
    * method.
    */
   void Disconnect([in] PP_Resource tcp_socket);
+
+  /**
+   * Sets an option on |tcp_socket|.  Supported |name| and |value| parameters
+   * are as described for PP_TCPSocketOption_Private.  |callback| will be
+   * invoked with PP_OK if setting the option succeeds, or an error code
+   * otherwise. The socket must be connection before SetOption is called.
+   */
+  [version=0.5]
+  int32_t SetOption([in] PP_Resource tcp_socket,
+                    [in] PP_TCPSocketOption_Private name,
+                    [in] PP_Var value,
+                    [in] PP_CompletionCallback callback);
+
 };
diff --git a/ppapi/api/trusted/ppb_broker_trusted.idl b/ppapi/api/trusted/ppb_broker_trusted.idl
index 54039c4..023d9fc 100644
--- a/ppapi/api/trusted/ppb_broker_trusted.idl
+++ b/ppapi/api/trusted/ppb_broker_trusted.idl
@@ -9,7 +9,8 @@
  */
 
 label Chrome {
-  M14 = 0.2
+  M14 = 0.2,
+  M25 = 0.3
 };
 
 /**
@@ -61,5 +62,16 @@
    * before connect has completed will return PP_ERROR_FAILED.
    */
   int32_t GetHandle([in] PP_Resource broker, [out] int32_t handle);
+
+  /**
+   * Returns PP_TRUE if the plugin has permission to launch the broker. A user
+   * must explicitly grant permission to launch the broker for a particular
+   * website. This is done through an infobar that is displayed when |Connect|
+   * is called. This function returns PP_TRUE if the user has already granted
+   * permission to launch the broker for the website containing this plugin
+   * instance. Returns PP_FALSE otherwise.
+   */
+  [version=0.3]
+  PP_Bool IsAllowed([in] PP_Resource broker);
 };
 
diff --git a/ppapi/api/trusted/ppb_buffer_trusted.idl b/ppapi/api/trusted/ppb_buffer_trusted.idl
index 202ebd2..94d2b79 100644
--- a/ppapi/api/trusted/ppb_buffer_trusted.idl
+++ b/ppapi/api/trusted/ppb_buffer_trusted.idl
@@ -7,6 +7,8 @@
  * This file defines the trusted buffer interface.
  */
 
+[generate_thunk]
+
 label Chrome {
   M14 = 0.1
 };
diff --git a/ppapi/api/trusted/ppb_graphics_3d_trusted.idl b/ppapi/api/trusted/ppb_graphics_3d_trusted.idl
new file mode 100644
index 0000000..174e59f
--- /dev/null
+++ b/ppapi/api/trusted/ppb_graphics_3d_trusted.idl
@@ -0,0 +1,100 @@
+/* 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.
+ */
+
+/* Graphics 3D trusted interfaces. */
+
+label Chrome {
+  M16 = 1.0
+};
+
+enum PPB_Graphics3DTrustedError {
+  PPB_GRAPHICS3D_TRUSTED_ERROR_OK,
+  PPB_GRAPHICS3D_TRUSTED_ERROR_GENERICERROR,
+  PPB_GRAPHICS3D_TRUSTED_ERROR_INVALIDARGUMENTS,
+  PPB_GRAPHICS3D_TRUSTED_ERROR_INVALIDSIZE,
+  PPB_GRAPHICS3D_TRUSTED_ERROR_LOSTCONTEXT,
+  PPB_GRAPHICS3D_TRUSTED_ERROR_OUTOFBOUNDS,
+  PPB_GRAPHICS3D_TRUSTED_ERROR_UNKNOWNCOMMAND
+};
+
+[returnByValue]
+struct PP_Graphics3DTrustedState {
+  // Size of the command buffer in command buffer entries.
+  int32_t num_entries;
+
+  // The offset (in entries) from which the reader is reading.
+  int32_t get_offset;
+
+  // The offset (in entries) at which the writer is writing.
+  int32_t put_offset;
+
+  // The current token value. This is used by the writer to defer
+  // changes to shared memory objects until the reader has reached a certain
+  // point in the command buffer. The reader is responsible for updating the
+  // token value, for example in response to an asynchronous set token command
+  // embedded in the command buffer. The default token value is zero.
+  int32_t token;
+
+  // Error status.
+  PPB_Graphics3DTrustedError error;
+
+  // Generation index of this state. The generation index is incremented every
+  // time a new state is retrieved from the command processor, so that
+  // consistency can be kept even if IPC messages are processed out-of-order.
+  uint32_t generation;
+};
+
+[macro="PPB_GRAPHICS_3D_TRUSTED_INTERFACE"]
+interface PPB_Graphics3DTrusted {
+  // Creates a raw Graphics3D resource. A raw Graphics3D is intended to be used
+  // with the trusted interface, through the command buffer (for proxying).
+  PP_Resource CreateRaw([in] PP_Instance instance_id,
+                        [in] PP_Resource share_context,
+                        [in] int32_t[] attrib_list);
+
+  // Initializes the command buffer with the given size.
+  PP_Bool InitCommandBuffer([in] PP_Resource context_id);
+
+  // Sets the buffer used for commands.
+  PP_Bool SetGetBuffer([in] PP_Resource context,
+                       [in] int32_t transfer_buffer_id);
+
+  // Returns the current state.
+  PP_Graphics3DTrustedState GetState([in] PP_Resource context);
+
+  // Create a transfer buffer and return a handle that uniquely
+  // identifies it or -1 on error.
+  int32_t CreateTransferBuffer([in] PP_Resource context,
+                               [in] uint32_t size);
+
+  // Destroy a transfer buffer and recycle the handle.
+  PP_Bool DestroyTransferBuffer([in] PP_Resource context,
+                                [in] int32_t id);
+
+  // Get the transfer buffer associated with a handle.
+  PP_Bool GetTransferBuffer([in] PP_Resource context,
+                            [in] int32_t id,
+                            [out] handle_t shm_handle,
+                            [out] uint32_t shm_size);
+
+  // The writer calls this to update its put offset.
+  PP_Bool Flush([in] PP_Resource context,
+                [in] int32_t put_offset);
+
+  // The writer calls this to update its put offset. This function returns the
+  // reader's most recent get offset. Does not return until after the put offset
+  // change callback has been invoked.
+  // Note: This function remains for backwards compatibility; FlushSyncFast
+  // is now the preferred way to sync.
+  PP_Graphics3DTrustedState FlushSync([in] PP_Resource context,
+                                      [in] int32_t put_offset);
+
+  // Like FlushSync, but returns before processing commands if the get offset is
+  // different than last_known_get. Allows synchronization with the command
+  // processor without forcing immediate command execution.
+  PP_Graphics3DTrustedState FlushSyncFast([in] PP_Resource context,
+                                          [in] int32_t put_offset,
+                                          [in] int32_t last_known_get);
+};
diff --git a/ppapi/c/dev/pp_video_dev.h b/ppapi/c/dev/pp_video_dev.h
index 65c2fab..023b505 100644
--- a/ppapi/c/dev/pp_video_dev.h
+++ b/ppapi/c/dev/pp_video_dev.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From dev/pp_video_dev.idl modified Fri Jul 20 12:22:28 2012. */
+/* From dev/pp_video_dev.idl modified Fri Dec  7 15:33:11 2012. */
 
 #ifndef PPAPI_C_DEV_PP_VIDEO_DEV_H_
 #define PPAPI_C_DEV_PP_VIDEO_DEV_H_
@@ -61,7 +61,8 @@
  */
 struct PP_VideoBitstreamBuffer_Dev {
   /**
-   * Client-specified identifier for the bitstream buffer.
+   * Client-specified identifier for the bitstream buffer. Valid values are
+   * non-negative.
    */
   int32_t id;
   /**
@@ -72,7 +73,7 @@
   /**
    * Size of the bitstream contained in buffer (in bytes).
    */
-  int32_t size;
+  uint32_t size;
 };
 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoBitstreamBuffer_Dev, 12);
 
@@ -83,7 +84,7 @@
   /**
    * Client-specified id for the picture buffer. By using this value client can
    * keep track of the buffers it has assigned to the video decoder and how they
-   * are passed back to it.
+   * are passed back to it. Valid values are non-negative.
    */
   int32_t id;
   /**
diff --git a/ppapi/c/dev/ppb_audio_input_dev.h b/ppapi/c/dev/ppb_audio_input_dev.h
index 585ea47..b47c7ea 100644
--- a/ppapi/c/dev/ppb_audio_input_dev.h
+++ b/ppapi/c/dev/ppb_audio_input_dev.h
@@ -3,11 +3,13 @@
  * found in the LICENSE file.
  */
 
-/* From dev/ppb_audio_input_dev.idl modified Mon Oct 29 14:40:53 2012. */
+/* From dev/ppb_audio_input_dev.idl modified Tue Dec 04 15:13:31 2012. */
 
 #ifndef PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_
 #define PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_
 
+#include "ppapi/c/dev/ppb_device_ref_dev.h"
+#include "ppapi/c/pp_array_output.h"
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/pp_instance.h"
@@ -16,7 +18,8 @@
 #include "ppapi/c/pp_stdint.h"
 
 #define PPB_AUDIO_INPUT_DEV_INTERFACE_0_2 "PPB_AudioInput(Dev);0.2"
-#define PPB_AUDIO_INPUT_DEV_INTERFACE PPB_AUDIO_INPUT_DEV_INTERFACE_0_2
+#define PPB_AUDIO_INPUT_DEV_INTERFACE_0_3 "PPB_AudioInput(Dev);0.3"
+#define PPB_AUDIO_INPUT_DEV_INTERFACE PPB_AUDIO_INPUT_DEV_INTERFACE_0_3
 
 /**
  * @file
@@ -48,8 +51,21 @@
 /**
  * The <code>PPB_AudioInput_Dev</code> interface contains pointers to several
  * functions for handling audio input resources.
+ *
+ * TODO(brettw) before moving out of dev, we need to resolve the issue of
+ * the mismatch between the current audio config interface and this one.
+ *
+ * In particular, the params for input assume stereo, but this class takes
+ * everything as mono. We either need to not use an audio config resource, or
+ * add mono support.
+ *
+ * In addition, RecommendSampleFrameCount is completely wrong for audio input.
+ * RecommendSampleFrameCount returns the frame count for the current
+ * low-latency output device, which is likely inappropriate for a random input
+ * device. We may want to move the "recommend" functions to the input or output
+ * classes rather than the config.
  */
-struct PPB_AudioInput_Dev_0_2 {
+struct PPB_AudioInput_Dev_0_3 {
   /**
    * Creates an audio input resource.
    *
@@ -72,28 +88,42 @@
   /**
    * Enumerates audio input devices.
    *
-   * Please note that:
-   * - this method ignores the previous value pointed to by <code>devices</code>
-   *   (won't release reference even if it is not 0);
-   * - <code>devices</code> must be valid until <code>callback</code> is called,
-   *   if the method returns <code>PP_OK_COMPLETIONPENDING</code>;
-   * - the ref count of the returned <code>devices</code> has already been
-   *   increased by 1 for the caller.
-   *
    * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
    * input resource.
-   * @param[out] devices Once the operation is completed successfully,
-   * <code>devices</code> will be set to a <code>PPB_ResourceArray_Dev</code>
-   * resource, which holds a list of <code>PPB_DeviceRef_Dev</code> resources.
-   * @param[in] callback  A <code>PP_CompletionCallback</code> to run on
+   * @param[in] output An output array which will receive
+   * <code>PPB_DeviceRef_Dev</code> resources on success. Please note that the
+   * ref count of those resources has already been increased by 1 for the
+   * caller.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to run on
    * completion.
    *
    * @return An error code from <code>pp_errors.h</code>.
    */
   int32_t (*EnumerateDevices)(PP_Resource audio_input,
-                              PP_Resource* devices,
+                              struct PP_ArrayOutput output,
                               struct PP_CompletionCallback callback);
   /**
+   * Requests device change notifications.
+   *
+   * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
+   * input resource.
+   * @param[in] callback The callback to receive notifications. If not NULL, it
+   * will be called once for the currently available devices, and then every
+   * time the list of available devices changes. All calls will happen on the
+   * same thread as the one on which MonitorDeviceChange() is called. It will
+   * receive notifications until <code>audio_input</code> is destroyed or
+   * <code>MonitorDeviceChange()</code> is called to set a new callback for
+   * <code>audio_input</code>. You can pass NULL to cancel sending
+   * notifications.
+   * @param[inout] user_data An opaque pointer that will be passed to
+   * <code>callback</code>.
+   *
+   * @return An error code from <code>pp_errors.h</code>.
+   */
+  int32_t (*MonitorDeviceChange)(PP_Resource audio_input,
+                                 PP_MonitorDeviceChangeCallback callback,
+                                 void* user_data);
+  /**
    * Opens an audio input device. No sound will be captured until
    * StartCapture() is called.
    *
@@ -166,7 +196,25 @@
   void (*Close)(PP_Resource audio_input);
 };
 
-typedef struct PPB_AudioInput_Dev_0_2 PPB_AudioInput_Dev;
+typedef struct PPB_AudioInput_Dev_0_3 PPB_AudioInput_Dev;
+
+struct PPB_AudioInput_Dev_0_2 {
+  PP_Resource (*Create)(PP_Instance instance);
+  PP_Bool (*IsAudioInput)(PP_Resource resource);
+  int32_t (*EnumerateDevices)(PP_Resource audio_input,
+                              PP_Resource* devices,
+                              struct PP_CompletionCallback callback);
+  int32_t (*Open)(PP_Resource audio_input,
+                  PP_Resource device_ref,
+                  PP_Resource config,
+                  PPB_AudioInput_Callback audio_input_callback,
+                  void* user_data,
+                  struct PP_CompletionCallback callback);
+  PP_Resource (*GetCurrentConfig)(PP_Resource audio_input);
+  PP_Bool (*StartCapture)(PP_Resource audio_input);
+  PP_Bool (*StopCapture)(PP_Resource audio_input);
+  void (*Close)(PP_Resource audio_input);
+};
 /**
  * @}
  */
diff --git a/ppapi/c/dev/ppb_device_ref_dev.h b/ppapi/c/dev/ppb_device_ref_dev.h
index 7381880..62d75a6 100644
--- a/ppapi/c/dev/ppb_device_ref_dev.h
+++ b/ppapi/c/dev/ppb_device_ref_dev.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From dev/ppb_device_ref_dev.idl modified Fri Jan 20 12:58:06 2012. */
+/* From dev/ppb_device_ref_dev.idl modified Wed Nov 07 13:28:37 2012. */
 
 #ifndef PPAPI_C_DEV_PPB_DEVICE_REF_DEV_H_
 #define PPAPI_C_DEV_PPB_DEVICE_REF_DEV_H_
@@ -24,6 +24,28 @@
 
 
 /**
+ * @addtogroup Typedefs
+ * @{
+ */
+/**
+ * Defines the callback type to receive device change notifications for
+ * <code>PPB_AudioInput_Dev.MonitorDeviceChange()</code> and
+ * <code>PPB_VideoCapture_Dev.MonitorDeviceChange()</code>.
+ *
+ * @param[inout] user_data The opaque pointer that the caller passed into
+ * <code>MonitorDeviceChange()</code>.
+ * @param[in] device_count How many devices in the array.
+ * @param[in] devices An array of <code>PPB_DeviceRef_Dev</code>. Please note
+ * that the ref count of the elements is not increased on behalf of the plugin.
+ */
+typedef void (*PP_MonitorDeviceChangeCallback)(void* user_data,
+                                               uint32_t device_count,
+                                               const PP_Resource devices[]);
+/**
+ * @}
+ */
+
+/**
  * @addtogroup Enums
  * @{
  */
diff --git a/ppapi/c/dev/ppb_directory_reader_dev.h b/ppapi/c/dev/ppb_directory_reader_dev.h
index 78e3c17..060e489 100644
--- a/ppapi/c/dev/ppb_directory_reader_dev.h
+++ b/ppapi/c/dev/ppb_directory_reader_dev.h
@@ -2,59 +2,77 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
+
+/* From dev/ppb_directory_reader_dev.idl modified Fri Feb 15 16:46:46 2013. */
+
 #ifndef PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_
 #define PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_
 
-#include "ppapi/c/pp_file_info.h"
+#include "ppapi/c/pp_array_output.h"
 #include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_file_info.h"
 #include "ppapi/c/pp_macros.h"
-#include "ppapi/c/pp_module.h"
 #include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_stdint.h"
 
-struct PP_CompletionCallback;
+#define PPB_DIRECTORYREADER_DEV_INTERFACE_0_6 "PPB_DirectoryReader(Dev);0.6"
+#define PPB_DIRECTORYREADER_DEV_INTERFACE PPB_DIRECTORYREADER_DEV_INTERFACE_0_6
 
+/**
+ * @file
+ *
+ * This file defines the <code>PPB_DirectoryReader_Dev</code> interface.
+ */
+
+
+/**
+ * @addtogroup Structs
+ * @{
+ */
 struct PP_DirectoryEntry_Dev {
   PP_Resource file_ref;
   PP_FileType file_type;
 };
 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DirectoryEntry_Dev, 8);
+/**
+ * @}
+ */
 
-#define PPB_DIRECTORYREADER_DEV_INTERFACE_0_5 "PPB_DirectoryReader(Dev);0.5"
-#define PPB_DIRECTORYREADER_DEV_INTERFACE PPB_DIRECTORYREADER_DEV_INTERFACE_0_5
-
-struct PPB_DirectoryReader_Dev_0_5 {
-  // Creates a DirectoryReader for the given directory.  Upon success, the
-  // corresponding directory is classified as "in use" by the resulting
-  // DirectoryReader object until such time as the DirectoryReader object is
-  // destroyed.
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+struct PPB_DirectoryReader_Dev_0_6 {
+  /* Creates a DirectoryReader for the given directory.  Upon success, the
+   * corresponding directory is classified as "in use" by the resulting
+   * DirectoryReader object until such time as the DirectoryReader object is
+   * destroyed. */
   PP_Resource (*Create)(PP_Resource directory_ref);
-
-  // Returns PP_TRUE if the given resource is a DirectoryReader. Returns
-  // PP_FALSE if the resource is invalid or some type other than a
-  // DirectoryReader.
+  /* Returns PP_TRUE if the given resource is a DirectoryReader. Returns
+   * PP_FALSE if the resource is invalid or some type other than a
+   * DirectoryReader. */
   PP_Bool (*IsDirectoryReader)(PP_Resource resource);
-
-  // Reads the next entry in the directory.  Returns PP_OK and sets
-  // entry->file_ref to 0 to indicate reaching the end of the directory.  If
-  // entry->file_ref is non-zero when passed to GetNextEntry, it will be
-  // released before the next file_ref is stored.
-  //
-  // EXAMPLE USAGE:
-  //
-  //   PP_Resource reader = reader_funcs->Create(dir_ref);
-  //   PP_DirectoryEntry entry = {0};
-  //   while ((reader_funcs->GetNextEntry(reader, &entry,
-  //                                      PP_BlockUntilComplete()) == PP_OK) &&
-  //          entry->file_ref) {
-  //     ProcessDirectoryEntry(entry);
-  //   }
-  //   core_funcs->ReleaseResource(reader);
-  //
-  int32_t (*GetNextEntry)(PP_Resource directory_reader,
-                          struct PP_DirectoryEntry_Dev* entry,
-                          struct PP_CompletionCallback callback);
+  /* Reads all entries in the directory.
+   *
+   * @param[in] directory_reader A <code>PP_Resource</code>
+   * corresponding to a directory reader resource.
+   * @param[in] output An output array which will receive
+   * <code>PP_DirectoryEntry_Dev</code> objects on success.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to run on
+   * completion.
+   *
+   * @return An error code from <code>pp_errors.h</code>.
+   */
+  int32_t (*ReadEntries)(PP_Resource directory_reader,
+                         struct PP_ArrayOutput output,
+                         struct PP_CompletionCallback callback);
 };
 
-typedef struct PPB_DirectoryReader_Dev_0_5 PPB_DirectoryReader_Dev;
+typedef struct PPB_DirectoryReader_Dev_0_6 PPB_DirectoryReader_Dev;
+/**
+ * @}
+ */
 
 #endif  /* PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ */
+
diff --git a/ppapi/c/dev/ppb_testing_dev.h b/ppapi/c/dev/ppb_testing_dev.h
index b0cb80e..0567120 100644
--- a/ppapi/c/dev/ppb_testing_dev.h
+++ b/ppapi/c/dev/ppb_testing_dev.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From dev/ppb_testing_dev.idl modified Thu Dec 22 11:02:53 2011. */
+/* From dev/ppb_testing_dev.idl modified Mon Mar 19 12:02:10 2012. */
 
 #ifndef PPAPI_C_DEV_PPB_TESTING_DEV_H_
 #define PPAPI_C_DEV_PPB_TESTING_DEV_H_
@@ -94,7 +94,7 @@
    * Returns PP_TRUE if the plugin is running out-of-process, PP_FALSE
    * otherwise.
    */
-  PP_Bool (*IsOutOfProcess)();
+  PP_Bool (*IsOutOfProcess)(void);
   /**
    * Passes the input event to the browser, which sends it back to the
    * plugin. The plugin should implement PPP_InputEvent and register for
@@ -145,7 +145,7 @@
   void (*RunMessageLoop)(PP_Instance instance);
   void (*QuitMessageLoop)(PP_Instance instance);
   uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
-  PP_Bool (*IsOutOfProcess)();
+  PP_Bool (*IsOutOfProcess)(void);
 };
 
 struct PPB_Testing_Dev_0_8 {
@@ -155,7 +155,7 @@
   void (*RunMessageLoop)(PP_Instance instance);
   void (*QuitMessageLoop)(PP_Instance instance);
   uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
-  PP_Bool (*IsOutOfProcess)();
+  PP_Bool (*IsOutOfProcess)(void);
   void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event);
 };
 
@@ -166,7 +166,7 @@
   void (*RunMessageLoop)(PP_Instance instance);
   void (*QuitMessageLoop)(PP_Instance instance);
   uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
-  PP_Bool (*IsOutOfProcess)();
+  PP_Bool (*IsOutOfProcess)(void);
   void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event);
   struct PP_Var (*GetDocumentURL)(PP_Instance instance,
                                   struct PP_URLComponents_Dev* components);
diff --git a/ppapi/c/dev/ppb_trace_event_dev.h b/ppapi/c/dev/ppb_trace_event_dev.h
new file mode 100644
index 0000000..153fca8
--- /dev/null
+++ b/ppapi/c/dev/ppb_trace_event_dev.h
@@ -0,0 +1,68 @@
+/* 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.
+ */
+
+/* From dev/ppb_trace_event_dev.idl modified Wed Jan  2 16:11:35 2013. */
+
+#ifndef PPAPI_C_DEV_PPB_TRACE_EVENT_DEV_H_
+#define PPAPI_C_DEV_PPB_TRACE_EVENT_DEV_H_
+
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_stdint.h"
+
+#define PPB_TRACE_EVENT_DEV_INTERFACE_0_1 "PPB_Trace_Event(Dev);0.1"
+#define PPB_TRACE_EVENT_DEV_INTERFACE PPB_TRACE_EVENT_DEV_INTERFACE_0_1
+
+/**
+ * @file
+ * This file defines the <code>PPB_Trace_Event</code> interface. It is meant
+ * to be used in plugins as the API that trace macros from trace_event.h use.
+ */
+
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+struct PPB_Trace_Event_Dev_0_1 {
+  /**
+   * Gets a pointer to a character for identifying a category name in the
+   * tracing system as well as for being able to early exit in client-side
+   * tracing code.
+   *
+   * NB: This mem_t return value should technically be const, but return values
+   * for Pepper IDL of mem_t type are not const.  The same is true for the arg
+   * |category_enabled| for AddTraceEvent.
+   */
+  void* (*GetCategoryEnabled)(const char* category_name);
+  /**
+   * Adds a trace event to the platform tracing system. This function call is
+   * usually the result of a TRACE_* macro from trace_event.h when tracing and
+   * the category of the particular trace are enabled. It is not advisable to
+   * call this function on its own; it is really only meant to be used by the
+   * trace macros.
+   */
+  void (*AddTraceEvent)(int8_t phase,
+                        const void* category_enabled,
+                        const char* name,
+                        uint64_t id,
+                        uint32_t num_args,
+                        const char* arg_names[],
+                        const uint8_t arg_types[],
+                        const uint64_t arg_values[],
+                        uint8_t flags);
+  /**
+   * Sets the thread name of the calling thread in the tracing system so it will
+   * show up properly in chrome://tracing.
+   */
+  void (*SetThreadName)(const char* thread_name);
+};
+
+typedef struct PPB_Trace_Event_Dev_0_1 PPB_Trace_Event_Dev;
+/**
+ * @}
+ */
+
+#endif  /* PPAPI_C_DEV_PPB_TRACE_EVENT_DEV_H_ */
+
diff --git a/ppapi/c/dev/ppb_truetype_font_dev.h b/ppapi/c/dev/ppb_truetype_font_dev.h
new file mode 100644
index 0000000..e0fc499
--- /dev/null
+++ b/ppapi/c/dev/ppb_truetype_font_dev.h
@@ -0,0 +1,272 @@
+/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* From dev/ppb_truetype_font_dev.idl modified Mon Mar 11 14:12:14 2013. */
+
+#ifndef PPAPI_C_DEV_PPB_TRUETYPE_FONT_DEV_H_
+#define PPAPI_C_DEV_PPB_TRUETYPE_FONT_DEV_H_
+
+#include "ppapi/c/pp_array_output.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_var.h"
+
+#define PPB_TRUETYPEFONT_DEV_INTERFACE_0_1 "PPB_TrueTypeFont(Dev);0.1"
+#define PPB_TRUETYPEFONT_DEV_INTERFACE PPB_TRUETYPEFONT_DEV_INTERFACE_0_1
+
+/**
+ * @file
+ * This file defines the <code>PPB_TrueTypeFont_Dev</code> interface. This
+ * interface exposes font table data for 'sfnt' fonts on the host system. These
+ * include TrueType and OpenType fonts.
+ */
+
+
+/**
+ * @addtogroup Enums
+ * @{
+ */
+/**
+ * The PP_TrueTypeFontFamily_Dev defines generic font families. These can be
+ * used to create generic fonts consistent with the user's browser settings.
+ */
+typedef enum {
+  /**
+   * For a description of these default families, see the
+   * <a href="http://www.w3.org/TR/css3-fonts/#generic-font-families">
+   * 3.1.1 Generic font families</a> documentation.
+   */
+  PP_TRUETYPEFONTFAMILY_SERIF = 0,
+  PP_TRUETYPEFONTFAMILY_SANSSERIF = 1,
+  PP_TRUETYPEFONTFAMILY_CURSIVE = 2,
+  PP_TRUETYPEFONTFAMILY_FANTASY = 3,
+  PP_TRUETYPEFONTFAMILY_MONOSPACE = 4
+} PP_TrueTypeFontFamily_Dev;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontFamily_Dev, 4);
+
+/**
+ * The PP_TrueTypeFontStyle_Dev defines font styles.
+ */
+typedef enum {
+  PP_TRUETYPEFONTSTYLE_NORMAL = 0,
+  PP_TRUETYPEFONTSTYLE_ITALIC = 1
+} PP_TrueTypeFontStyle_Dev;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontStyle_Dev, 4);
+
+/**
+ * The PP_TrueTypeFontWeight_Dev defines font weights.
+ */
+typedef enum {
+  PP_TRUETYPEFONTWEIGHT_THIN = 100,
+  PP_TRUETYPEFONTWEIGHT_ULTRALIGHT = 200,
+  PP_TRUETYPEFONTWEIGHT_LIGHT = 300,
+  PP_TRUETYPEFONTWEIGHT_NORMAL = 400,
+  PP_TRUETYPEFONTWEIGHT_MEDIUM = 500,
+  PP_TRUETYPEFONTWEIGHT_SEMIBOLD = 600,
+  PP_TRUETYPEFONTWEIGHT_BOLD = 700,
+  PP_TRUETYPEFONTWEIGHT_ULTRABOLD = 800,
+  PP_TRUETYPEFONTWEIGHT_HEAVY = 900
+} PP_TrueTypeFontWeight_Dev;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontWeight_Dev, 4);
+
+/**
+ * The PP_TrueTypeFontWidth_Dev defines font widths.
+ */
+typedef enum {
+  PP_TRUETYPEFONTWIDTH_ULTRACONDENSED = 0,
+  PP_TRUETYPEFONTWIDTH_EXTRACONDENSED = 1,
+  PP_TRUETYPEFONTWIDTH_CONDENSED = 2,
+  PP_TRUETYPEFONTWIDTH_SEMICONDENSED = 3,
+  PP_TRUETYPEFONTWIDTH_NORMAL = 4,
+  PP_TRUETYPEFONTWIDTH_SEMIEXPANDED = 5,
+  PP_TRUETYPEFONTWIDTH_EXPANDED = 6,
+  PP_TRUETYPEFONTWIDTH_EXTRAEXPANDED = 7,
+  PP_TRUETYPEFONTWIDTH_ULTRAEXPANDED = 8
+} PP_TrueTypeFontWidth_Dev;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontWidth_Dev, 4);
+
+/**
+ * The PP_TrueTypeFontCharset defines font character sets.
+ */
+typedef enum {
+  PP_TRUETYPEFONTCHARSET_ANSI = 0,
+  PP_TRUETYPEFONTCHARSET_DEFAULT = 1,
+  PP_TRUETYPEFONTCHARSET_SYMBOL = 2,
+  PP_TRUETYPEFONTCHARSET_MAC = 77,
+  PP_TRUETYPEFONTCHARSET_SHIFTJIS = 128,
+  PP_TRUETYPEFONTCHARSET_HANGUL = 129,
+  PP_TRUETYPEFONTCHARSET_JOHAB = 130,
+  PP_TRUETYPEFONTCHARSET_GB2312 = 134,
+  PP_TRUETYPEFONTCHARSET_CHINESEBIG5 = 136,
+  PP_TRUETYPEFONTCHARSET_GREEK = 161,
+  PP_TRUETYPEFONTCHARSET_TURKISH = 162,
+  PP_TRUETYPEFONTCHARSET_VIETNAMESE = 163,
+  PP_TRUETYPEFONTCHARSET_HEBREW = 177,
+  PP_TRUETYPEFONTCHARSET_ARABIC = 178,
+  PP_TRUETYPEFONTCHARSET_BALTIC = 186,
+  PP_TRUETYPEFONTCHARSET_RUSSIAN = 204,
+  PP_TRUETYPEFONTCHARSET_THAI = 222,
+  PP_TRUETYPEFONTCHARSET_EASTEUROPE = 238,
+  PP_TRUETYPEFONTCHARSET_OEM = 255
+} PP_TrueTypeFontCharset_Dev;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontCharset_Dev, 4);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Structs
+ * @{
+ */
+/**
+ * The <code>PP_TrueTypeFontDesc</code> structure describes a TrueType font. It
+ * is passed to Create, and returned by Describe.
+ */
+struct PP_TrueTypeFontDesc_Dev {
+  /**
+   * Font family name as a string. This can also be an undefined var, in which
+   * case the generic family will be obeyed. If the face is not available on
+   * the system, the browser will attempt to do font fallback or pick a default
+   * font.
+   */
+  struct PP_Var family;
+  /** This value specifies a generic font family. If a family name string is
+   * provided when creating a font, this is ignored. */
+  PP_TrueTypeFontFamily_Dev generic_family;
+  /** This value specifies the font style. */
+  PP_TrueTypeFontStyle_Dev style;
+  /** This value specifies the font weight. */
+  PP_TrueTypeFontWeight_Dev weight;
+  /** This value specifies the font width, for condensed or expanded fonts */
+  PP_TrueTypeFontWidth_Dev width;
+  /** This value specifies a character set. */
+  PP_TrueTypeFontCharset_Dev charset;
+  /**
+   * Ensure that this struct is 40-bytes wide by padding the end.  In some
+   * compilers, PP_Var is 8-byte aligned, so those compilers align this struct
+   * on 8-byte boundaries as well and pad it to 16 bytes even without this
+   * padding attribute.  This padding makes its size consistent across
+   * compilers.
+   */
+  int32_t padding;
+};
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_TrueTypeFontDesc_Dev, 40);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+struct PPB_TrueTypeFont_Dev_0_1 {
+  /**
+   * Gets an array of TrueType font family names available on the host.
+   * These names can be used to create a font from a specific family.
+   *
+   * @param[in] instance A <code>PP_Instance</code> requesting the family names.
+   * @param[in] output A <code>PP_ArrayOutput</code> to hold the names.
+   * The output is an array of PP_Vars, each holding a family name.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+   * completion of GetFontFamilies.
+   *
+   * @return If >= 0, the number of family names returned, otherwise an error
+   * code from <code>pp_errors.h</code>.
+   */
+  int32_t (*GetFontFamilies)(PP_Instance instance,
+                             struct PP_ArrayOutput output,
+                             struct PP_CompletionCallback callback);
+  /**
+   * Creates a font resource matching the given font characteristics. The
+   * resource id will be non-zero on success, or zero on failure.
+   *
+   * @param[in] instance A <code>PP_Instance</code> to own the font.
+   * @param[in] desc A pointer to a <code>PP_TrueTypeFontDesc</code> describing
+   * the font.
+   */
+  PP_Resource (*Create)(PP_Instance instance,
+                        const struct PP_TrueTypeFontDesc_Dev* desc);
+  /**
+   * Determines if the given resource is a font.
+   *
+   * @param[in] resource A <code>PP_Resource</code> corresponding to a font.
+   *
+   * @return <code>PP_TRUE</code> if the resource is a
+   * <code>PPB_TrueTypeFont_Dev</code>, <code>PP_FALSE</code> otherwise.
+   */
+  PP_Bool (*IsFont)(PP_Resource resource);
+  /**
+   * Returns a description of the given font resource. This description may
+   * differ from the description passed to Create, reflecting the host's font
+   * matching and fallback algorithm.
+   *
+   * @param[in] font A <code>PP_Resource</code> corresponding to a font.
+   * @param[out] desc A pointer to a <code>PP_TrueTypeFontDesc</code> to hold
+   * the description. The internal 'family' PP_Var should be set to undefined,
+   * since this function overwrites the <code>PP_TrueTypeFontDesc</code>. After
+   * successful completion, the family will be set to a PP_Var with a single
+   * reference, which the caller must release after use.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+   * completion of Describe.
+   *
+   * @return A return code from <code>pp_errors.h</code>. If an error code is
+   * returned, the <code>PP_TrueTypeFontDesc</code> will be unchanged.
+   */
+  int32_t (*Describe)(PP_Resource font,
+                      struct PP_TrueTypeFontDesc_Dev* desc,
+                      struct PP_CompletionCallback callback);
+  /**
+   * Gets an array of identifying tags for each table in the font.
+   * These tags can be used to request specific tables using GetTable.
+   *
+   * @param[in] font A <code>PP_Resource</code> corresponding to a font.
+   * @param[in] output A <code>PP_ArrayOutput</code> to hold the tags.
+   * The output is an array of 4 byte integers, each representing a table tag.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+   * completion of GetTableTags.
+   *
+   * @return If >= 0, the number of table tags returned, otherwise an error
+   * code from <code>pp_errors.h</code>.
+   */
+  int32_t (*GetTableTags)(PP_Resource font,
+                          struct PP_ArrayOutput output,
+                          struct PP_CompletionCallback callback);
+  /**
+   * Copies the given font table into client memory.
+   *
+   * @param[in] font A <code>PP_Resource</code> corresponding to a font.
+   * @param[in] table A 4 byte value indicating which table to copy.
+   * For example, 'glyf' will cause the outline table to be copied into the
+   * output array. A zero tag value will cause the entire font to be copied.
+   * @param[in] offset The offset into the font table.
+   * @param[in] max_data_length The maximum number of bytes to transfer from
+   * <code>offset</code>.
+   * @param[in] output A <code>PP_ArrayOutput</code> to hold the font data.
+   * The output is an array of bytes.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+   * completion of GetTable.
+   *
+   * @return If >= 0, the table size in bytes, otherwise an error code from
+   * <code>pp_errors.h</code>.
+   */
+  int32_t (*GetTable)(PP_Resource font,
+                      uint32_t table,
+                      int32_t offset,
+                      int32_t max_data_length,
+                      struct PP_ArrayOutput output,
+                      struct PP_CompletionCallback callback);
+};
+
+typedef struct PPB_TrueTypeFont_Dev_0_1 PPB_TrueTypeFont_Dev;
+/**
+ * @}
+ */
+
+#endif  /* PPAPI_C_DEV_PPB_TRUETYPE_FONT_DEV_H_ */
+
diff --git a/ppapi/c/dev/ppb_var_array_dev.h b/ppapi/c/dev/ppb_var_array_dev.h
new file mode 100644
index 0000000..3ce07fb
--- /dev/null
+++ b/ppapi/c/dev/ppb_var_array_dev.h
@@ -0,0 +1,94 @@
+/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* From dev/ppb_var_array_dev.idl modified Thu Mar 14 13:41:46 2013. */
+
+#ifndef PPAPI_C_DEV_PPB_VAR_ARRAY_DEV_H_
+#define PPAPI_C_DEV_PPB_VAR_ARRAY_DEV_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_var.h"
+
+#define PPB_VAR_ARRAY_DEV_INTERFACE_0_1 "PPB_VarArray(Dev);0.1"
+#define PPB_VAR_ARRAY_DEV_INTERFACE PPB_VAR_ARRAY_DEV_INTERFACE_0_1
+
+/**
+ * @file
+ * This file defines the <code>PPB_VarArray_Dev</code> struct providing
+ * a way to interact with array vars.
+ */
+
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+struct PPB_VarArray_Dev_0_1 {
+  /**
+   * Creates an array var, i.e., a <code>PP_Var</code> with type set to
+   * <code>PP_VARTYPE_ARRAY</code>. The array length is set to 0.
+   *
+   * @return An empty array var, whose reference count is set to 1 on behalf of
+   * the caller.
+   */
+  struct PP_Var (*Create)(void);
+  /**
+   * Gets an element from the array.
+   *
+   * @param[in] array An array var.
+   * @param[in] index An index indicating which element to return.
+   *
+   * @return The element at the specified position. The reference count is
+   * incremented on behalf of the caller. If <code>index</code> is larger than
+   * or equal to the array length, an undefined var is returned.
+   */
+  struct PP_Var (*Get)(struct PP_Var array, uint32_t index);
+  /**
+   * Sets the value of an element in the array.
+   *
+   * @param[in] array An array var.
+   * @param[in] index An index indicating which element to modify. If
+   * <code>index</code> is larger than or equal to the array length, the length
+   * is updated to be <code>index</code> + 1. Any position in the array that
+   * hasn't been set before is set to undefined, i.e., <code>PP_Var</code> of
+   * type <code>PP_VARTYPE_UNDEFINED</code>.
+   * @param[in] value The value to set. The array holds a reference to it on
+   * success.
+   *
+   * @return A <code>PP_Bool</code> indicating whether the operation succeeds.
+   */
+  PP_Bool (*Set)(struct PP_Var array, uint32_t index, struct PP_Var value);
+  /**
+   * Gets the array length.
+   *
+   * @param[in] array An array var.
+   *
+   * @return The array length.
+   */
+  uint32_t (*GetLength)(struct PP_Var array);
+  /**
+   * Sets the array length.
+   *
+   * @param[in] array An array var.
+   * @param[in] length The new array length. If <code>length</code> is smaller
+   * than its current value, the array is truncated to the new length; any
+   * elements that no longer fit are removed. If <code>length</code> is larger
+   * than its current value, undefined vars are appended to increase the array
+   * to the specified length.
+   *
+   * @return A <code>PP_Bool</code> indicating whether the operation succeeds.
+   */
+  PP_Bool (*SetLength)(struct PP_Var array, uint32_t length);
+};
+
+typedef struct PPB_VarArray_Dev_0_1 PPB_VarArray_Dev;
+/**
+ * @}
+ */
+
+#endif  /* PPAPI_C_DEV_PPB_VAR_ARRAY_DEV_H_ */
+
diff --git a/ppapi/c/dev/ppb_var_dictionary_dev.h b/ppapi/c/dev/ppb_var_dictionary_dev.h
new file mode 100644
index 0000000..d601071
--- /dev/null
+++ b/ppapi/c/dev/ppb_var_dictionary_dev.h
@@ -0,0 +1,106 @@
+/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* From dev/ppb_var_dictionary_dev.idl modified Wed Mar 13 21:47:05 2013. */
+
+#ifndef PPAPI_C_DEV_PPB_VAR_DICTIONARY_DEV_H_
+#define PPAPI_C_DEV_PPB_VAR_DICTIONARY_DEV_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_var.h"
+
+#define PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1 "PPB_VarDictionary(Dev);0.1"
+#define PPB_VAR_DICTIONARY_DEV_INTERFACE PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1
+
+/**
+ * @file
+ * This file defines the <code>PPB_VarDictionary_Dev</code> struct providing
+ * a way to interact with dictionary vars.
+ */
+
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/**
+ * A dictionary var contains key-value pairs with unique keys. The keys are
+ * strings while the values can be arbitrary vars. Key comparison is always
+ * done by value instead of by reference.
+ */
+struct PPB_VarDictionary_Dev_0_1 {
+  /**
+   * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to
+   * <code>PP_VARTYPE_DICTIONARY</code>.
+   *
+   * @return An empty dictionary var, whose reference count is set to 1 on
+   * behalf of the caller.
+   */
+  struct PP_Var (*Create)(void);
+  /**
+   * Gets the value associated with the specified key.
+   *
+   * @param[in] dict A dictionary var.
+   * @param[in] key A string var.
+   *
+   * @return The value that is associated with <code>key</code>. The reference
+   * count is incremented on behalf of the caller. If <code>key</code> is not a
+   * string var, or it doesn't exist in <code>dict</code>, an undefined var is
+   * returned.
+   */
+  struct PP_Var (*Get)(struct PP_Var dict, struct PP_Var key);
+  /**
+   * Sets the value associated with the specified key. The dictionary is
+   * responsible for holding references to its children to keep them alive.
+   *
+   * @param[in] dict A dictionary var.
+   * @param[in] key A string var. If this key hasn't existed in
+   * <code>dict</code>, it is added and associated with <code>value</code>;
+   * otherwise, the previous value is replaced with <code>value</code>.
+   * @param[in] value The value to set.
+   *
+   * @return A <code>PP_Bool</code> indicating whether the operation succeeds.
+   */
+  PP_Bool (*Set)(struct PP_Var dict, struct PP_Var key, struct PP_Var value);
+  /**
+   * Deletes the specified key and its associated value, if the key exists.
+   *
+   * @param[in] dict A dictionary var.
+   * @param[in] key A string var.
+   */
+  void (*Delete)(struct PP_Var dict, struct PP_Var key);
+  /**
+   * Checks whether a key exists.
+   *
+   * @param[in] dict A dictionary var.
+   * @param[in] key A string var.
+   *
+   * @return A <code>PP_Bool</code> indicating whether the key exists.
+   */
+  PP_Bool (*HasKey)(struct PP_Var dict, struct PP_Var key);
+  /**
+   * Gets all the keys in a dictionary. Please note that for each key that you
+   * set into the dictionary, a string var with the same contents is returned;
+   * but it may not be the same string var (i.e., <code>value.as_id</code> may
+   * be different).
+   *
+   * @param[in] dict A dictionary var.
+   *
+   * @return An array var which contains all the keys of <code>dict</code>. Its
+   * reference count is incremented on behalf of the caller. The elements are
+   * string vars. Returns a null var if failed.
+   */
+  struct PP_Var (*GetKeys)(struct PP_Var dict);
+};
+
+typedef struct PPB_VarDictionary_Dev_0_1 PPB_VarDictionary_Dev;
+/**
+ * @}
+ */
+
+#endif  /* PPAPI_C_DEV_PPB_VAR_DICTIONARY_DEV_H_ */
+
diff --git a/ppapi/c/dev/ppb_video_capture_dev.h b/ppapi/c/dev/ppb_video_capture_dev.h
index 5a48725..a4704b2 100644
--- a/ppapi/c/dev/ppb_video_capture_dev.h
+++ b/ppapi/c/dev/ppb_video_capture_dev.h
@@ -3,12 +3,14 @@
  * found in the LICENSE file.
  */
 
-/* From dev/ppb_video_capture_dev.idl modified Wed Feb 15 12:15:46 2012. */
+/* From dev/ppb_video_capture_dev.idl modified Wed Dec 05 13:18:10 2012. */
 
 #ifndef PPAPI_C_DEV_PPB_VIDEO_CAPTURE_DEV_H_
 #define PPAPI_C_DEV_PPB_VIDEO_CAPTURE_DEV_H_
 
 #include "ppapi/c/dev/pp_video_capture_dev.h"
+#include "ppapi/c/dev/ppb_device_ref_dev.h"
+#include "ppapi/c/pp_array_output.h"
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/pp_instance.h"
@@ -16,9 +18,9 @@
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/c/pp_stdint.h"
 
-#define PPB_VIDEOCAPTURE_DEV_INTERFACE_0_1 "PPB_VideoCapture(Dev);0.1"
 #define PPB_VIDEOCAPTURE_DEV_INTERFACE_0_2 "PPB_VideoCapture(Dev);0.2"
-#define PPB_VIDEOCAPTURE_DEV_INTERFACE PPB_VIDEOCAPTURE_DEV_INTERFACE_0_2
+#define PPB_VIDEOCAPTURE_DEV_INTERFACE_0_3 "PPB_VideoCapture(Dev);0.3"
+#define PPB_VIDEOCAPTURE_DEV_INTERFACE PPB_VIDEOCAPTURE_DEV_INTERFACE_0_3
 
 /**
  * @file
@@ -59,7 +61,7 @@
  * 4:2:0, one byte per pixel, tightly packed (width x height Y values, then
  * width/2 x height/2 U values, then width/2 x height/2 V values).
  */
-struct PPB_VideoCapture_Dev_0_2 {
+struct PPB_VideoCapture_Dev_0_3 {
   /**
    * Creates a new VideoCapture.
    */
@@ -69,22 +71,44 @@
    */
   PP_Bool (*IsVideoCapture)(PP_Resource video_capture);
   /**
-   * Enumerates video capture devices. Once the operation is completed
-   * successfully, |devices| will be set to a PPB_ResourceArray_Dev resource,
-   * which holds a list of PPB_DeviceRef_Dev resources.
+   * Enumerates video capture devices.
    *
-   * Please note that:
-   * - this method ignores the previous value pointed to by |devices| (won't
-   *   release reference even if it is not 0);
-   * - |devices| must be valid until |callback| is called, if the method
-   *   returns PP_OK_COMPLETIONPENDING;
-   * - the ref count of the returned |devices| has already been increased by 1
-   *   for the caller.
+   * @param[in] video_capture A <code>PP_Resource</code> corresponding to a
+   * video capture resource.
+   * @param[in] output An output array which will receive
+   * <code>PPB_DeviceRef_Dev</code> resources on success. Please note that the
+   * ref count of those resources has already been increased by 1 for the
+   * caller.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to run on
+   * completion.
+   *
+   * @return An error code from <code>pp_errors.h</code>.
    */
   int32_t (*EnumerateDevices)(PP_Resource video_capture,
-                              PP_Resource* devices,
+                              struct PP_ArrayOutput output,
                               struct PP_CompletionCallback callback);
   /**
+   * Requests device change notifications.
+   *
+   * @param[in] video_capture A <code>PP_Resource</code> corresponding to a
+   * video capture resource.
+   * @param[in] callback The callback to receive notifications. If not NULL, it
+   * will be called once for the currently available devices, and then every
+   * time the list of available devices changes. All calls will happen on the
+   * same thread as the one on which MonitorDeviceChange() is called. It will
+   * receive notifications until <code>video_capture</code> is destroyed or
+   * <code>MonitorDeviceChange()</code> is called to set a new callback for
+   * <code>video_capture</code>. You can pass NULL to cancel sending
+   * notifications.
+   * @param[inout] user_data An opaque pointer that will be passed to
+   * <code>callback</code>.
+   *
+   * @return An error code from <code>pp_errors.h</code>.
+   */
+  int32_t (*MonitorDeviceChange)(PP_Resource video_capture,
+                                 PP_MonitorDeviceChangeCallback callback,
+                                 void* user_data);
+  /**
    * Opens a video capture device. |device_ref| identifies a video capture
    * device. It could be one of the resource in the array returned by
    * |EnumerateDevices()|, or 0 which means the default device.
@@ -135,17 +159,23 @@
   void (*Close)(PP_Resource video_capture);
 };
 
-typedef struct PPB_VideoCapture_Dev_0_2 PPB_VideoCapture_Dev;
+typedef struct PPB_VideoCapture_Dev_0_3 PPB_VideoCapture_Dev;
 
-struct PPB_VideoCapture_Dev_0_1 {
+struct PPB_VideoCapture_Dev_0_2 {
   PP_Resource (*Create)(PP_Instance instance);
   PP_Bool (*IsVideoCapture)(PP_Resource video_capture);
-  int32_t (*StartCapture)(
-      PP_Resource video_capture,
-      const struct PP_VideoCaptureDeviceInfo_Dev* requested_info,
-      uint32_t buffer_count);
+  int32_t (*EnumerateDevices)(PP_Resource video_capture,
+                              PP_Resource* devices,
+                              struct PP_CompletionCallback callback);
+  int32_t (*Open)(PP_Resource video_capture,
+                  PP_Resource device_ref,
+                  const struct PP_VideoCaptureDeviceInfo_Dev* requested_info,
+                  uint32_t buffer_count,
+                  struct PP_CompletionCallback callback);
+  int32_t (*StartCapture)(PP_Resource video_capture);
   int32_t (*ReuseBuffer)(PP_Resource video_capture, uint32_t buffer);
   int32_t (*StopCapture)(PP_Resource video_capture);
+  void (*Close)(PP_Resource video_capture);
 };
 /**
  * @}
diff --git a/ppapi/c/dev/ppp_scrollbar_dev.h b/ppapi/c/dev/ppp_scrollbar_dev.h
index ce0a8f6..0a32210 100644
--- a/ppapi/c/dev/ppp_scrollbar_dev.h
+++ b/ppapi/c/dev/ppp_scrollbar_dev.h
@@ -1,31 +1,59 @@
-/* Copyright (c) 2010 The Chromium Authors. All rights reserved.
+/* 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.
  */
+
+/* From dev/ppp_scrollbar_dev.idl modified Tue Nov 27 14:46:25 2012. */
+
 #ifndef PPAPI_C_DEV_PPP_SCROLLBAR_DEV_H_
 #define PPAPI_C_DEV_PPP_SCROLLBAR_DEV_H_
 
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/c/pp_stdint.h"
 
-// Interface for the plugin to implement when using a scrollbar widget.
 #define PPP_SCROLLBAR_DEV_INTERFACE_0_2 "PPP_Scrollbar(Dev);0.2"
 #define PPP_SCROLLBAR_DEV_INTERFACE_0_3 "PPP_Scrollbar(Dev);0.3"
 #define PPP_SCROLLBAR_DEV_INTERFACE PPP_SCROLLBAR_DEV_INTERFACE_0_3
 
-struct PPP_Scrollbar_Dev {
-  // Informs the instance that the scrollbar's value has changed.
+/**
+ * @file
+ * This file defines the <code>PPP_Scrollbar_Dev</code> interface.
+ */
+
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+struct PPP_Scrollbar_Dev_0_3 {
+  /**
+   *  Informs the instance that the scrollbar's value has changed.
+   */
   void (*ValueChanged)(PP_Instance instance,
                        PP_Resource scrollbar,
                        uint32_t value);
-
-  // Informs the instance that the user has changed the system scrollbar style.
+  /**
+   * Informs the instance that the user has changed the system
+   * scrollbar style.
+   */
   void (*OverlayChanged)(PP_Instance instance,
                          PP_Resource scrollbar,
                          PP_Bool overlay);
 };
 
+typedef struct PPP_Scrollbar_Dev_0_3 PPP_Scrollbar_Dev;
+
+struct PPP_Scrollbar_Dev_0_2 {
+  void (*ValueChanged)(PP_Instance instance,
+                       PP_Resource scrollbar,
+                       uint32_t value);
+};
+/**
+ * @}
+ */
+
 #endif  /* PPAPI_C_DEV_PPP_SCROLLBAR_DEV_H_ */
 
diff --git a/ppapi/c/dev/ppp_selection_dev.h b/ppapi/c/dev/ppp_selection_dev.h
index dfbed35..15ca657 100644
--- a/ppapi/c/dev/ppp_selection_dev.h
+++ b/ppapi/c/dev/ppp_selection_dev.h
@@ -1,25 +1,45 @@
-/* Copyright (c) 2010 The Chromium Authors. All rights reserved.
+/* 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.
  */
+
+/* From dev/ppp_selection_dev.idl modified Fri Nov  9 12:50:33 2012. */
+
 #ifndef PPAPI_C_DEV_PPP_SELECTION_DEV_H_
 #define PPAPI_C_DEV_PPP_SELECTION_DEV_H_
 
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_stdint.h"
 #include "ppapi/c/pp_var.h"
 
-#define PPP_SELECTION_DEV_INTERFACE "PPP_Selection(Dev);0.3"
+#define PPP_SELECTION_DEV_INTERFACE_0_3 "PPP_Selection(Dev);0.3"
+#define PPP_SELECTION_DEV_INTERFACE PPP_SELECTION_DEV_INTERFACE_0_3
 
-struct PPP_Selection_Dev {
+/**
+ * @file
+ * This file defines the PPP_Selection_Dev interface.
+ */
+
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+struct PPP_Selection_Dev_0_3 {
   /**
    * Returns the selection, either as plain text or as html depending on "html".
    * If nothing is selected, or if the given format is unavailable, return a
    * void string.
    */
-  struct PP_Var (*GetSelectedText)(PP_Instance instance,
-                                   PP_Bool html);
+  struct PP_Var (*GetSelectedText)(PP_Instance instance, PP_Bool html);
 };
 
+typedef struct PPP_Selection_Dev_0_3 PPP_Selection_Dev;
+/**
+ * @}
+ */
+
 #endif  /* PPAPI_C_DEV_PPP_SELECTION_DEV_H_ */
 
diff --git a/ppapi/c/documentation/check.sh b/ppapi/c/documentation/check.sh
index ce3b49f..793f408 100755
--- a/ppapi/c/documentation/check.sh
+++ b/ppapi/c/documentation/check.sh
@@ -1,4 +1,7 @@
 #!/bin/bash
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
 # simple script to check html via tidy. Either specify html files on
 # command line or rely on default which checks all html files in
diff --git a/ppapi/c/extensions/dev/ppb_alarms_dev.h b/ppapi/c/extensions/dev/ppb_alarms_dev.h
new file mode 100644
index 0000000..a573527
--- /dev/null
+++ b/ppapi/c/extensions/dev/ppb_alarms_dev.h
@@ -0,0 +1,202 @@
+/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* From extensions/dev/ppb_alarms_dev.idl modified Tue Mar 05 14:02:41 2013. */
+
+#ifndef PPAPI_C_EXTENSIONS_DEV_PPB_ALARMS_DEV_H_
+#define PPAPI_C_EXTENSIONS_DEV_PPB_ALARMS_DEV_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_var.h"
+
+#define PPB_EXT_ALARMS_DEV_INTERFACE_0_1 "PPB_Ext_Alarms(Dev);0.1"
+#define PPB_EXT_ALARMS_DEV_INTERFACE PPB_EXT_ALARMS_DEV_INTERFACE_0_1
+
+/**
+ * @file
+ * This file defines the Pepper equivalent of the <code>chrome.alarms</code>
+ * extension API.
+ */
+
+
+#include "ppapi/c/extensions/dev/ppb_events_dev.h"
+
+/**
+ * @addtogroup Typedefs
+ * @{
+ */
+/**
+ * A dictionary <code>PP_Var</code> which contains:
+ * - "name" : string <code>PP_Var</code>
+ * Name of this alarm.
+ *
+ * - "scheduledTime" : double <code>PP_Var</code>
+ * Time at which this alarm was scheduled to fire, in milliseconds past the
+ * epoch (e.g. <code>Date.now() + n</code>).  For performance reasons, the
+ * alarm may have been delayed an arbitrary amount beyond this.
+ *
+ * - "periodInMinutes" : double or undefined <code>PP_Var</code>
+ * If not undefined, the alarm is a repeating alarm and will fire again in
+ * <var>periodInMinutes</var> minutes.
+ */
+typedef struct PP_Var PP_Ext_Alarms_Alarm_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "when" : double or undefined <code>PP_Var</code>
+ * Time at which the alarm should fire, in milliseconds past the epoch
+ * (e.g. <code>Date.now() + n</code>).
+ *
+ * - "delayInMinutes" : double or undefined <code>PP_Var</code>
+ * Length of time in minutes after which the
+ * <code>PP_Ext_Alarms_OnAlarm_Dev</code> event should fire.
+ *
+ * - "periodInMinutes" : double or undefined <code>PP_Var</code>
+ * If set, the <code>PP_Ext_Alarms_OnAlarm_Dev</code> event should fire every
+ * <var>periodInMinutes</var> minutes after the initial event specified by
+ * <var>when</var> or <var>delayInMinutes</var>.  If not set, the alarm will
+ * only fire once.
+ */
+typedef struct PP_Var PP_Ext_Alarms_AlarmCreateInfo_Dev;
+
+/**
+ * An array <code>PP_Var</code> which contains elements of
+ * <code>PP_Ext_Alarms_Alarm_Dev</code>.
+ */
+typedef struct PP_Var PP_Ext_Alarms_Alarm_Dev_Array;
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+struct PPB_Ext_Alarms_Dev_0_1 {
+  /**
+   * Creates an alarm.  Near the time(s) specified by <var>alarm_info</var>,
+   * the <code>PP_Ext_Alarms_OnAlarm_Dev</code> event is fired. If there is
+   * another alarm with the same name (or no name if none is specified), it will
+   * be cancelled and replaced by this alarm.
+   *
+   * In order to reduce the load on the user's machine, Chrome limits alarms
+   * to at most once every 1 minute but may delay them an arbitrary amount
+   * more.  That is, setting
+   * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.delayInMinutes
+   * delayInMinutes]</code> or
+   * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.periodInMinutes
+   * periodInMinutes]</code> to less than <code>1</code> will not be honored
+   * and will cause a warning.
+   * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.when when]</code> can be set
+   * to less than 1 minute after "now" without warning but won't actually cause
+   * the alarm to fire for at least 1 minute.
+   *
+   * To help you debug your app or extension, when you've loaded it unpacked,
+   * there's no limit to how often the alarm can fire.
+   *
+   * @param[in] instance A <code>PP_Instance</code>.
+   * @param[in] name A string or undefined <code>PP_Var</code>. Optional name to
+   * identify this alarm. Defaults to the empty string.
+   * @param[in] alarm_info A <code>PP_Var</code> whose contents conform to the
+   * description of <code>PP_Ext_Alarms_AlarmCreateInfo_Dev</code>. Describes
+   * when the alarm should fire.  The initial time must be specified by either
+   * <var>when</var> or <var>delayInMinutes</var> (but not both).  If
+   * <var>periodInMinutes</var> is set, the alarm will repeat every
+   * <var>periodInMinutes</var> minutes after the initial event.  If neither
+   * <var>when</var> or <var>delayInMinutes</var> is set for a repeating alarm,
+   * <var>periodInMinutes</var> is used as the default for
+   * <var>delayInMinutes</var>.
+   */
+  void (*Create)(PP_Instance instance,
+                 struct PP_Var name,
+                 PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info);
+  /**
+   * Retrieves details about the specified alarm.
+   *
+   * @param[in] instance A <code>PP_Instance</code>.
+   * @param[in] name A string or undefined <code>PP_Var</code>. The name of the
+   * alarm to get. Defaults to the empty string.
+   * @param[out] alarm A <code>PP_Var</code> whose contents conform to the
+   * description of <code>PP_Ext_Alarms_Alarm_Dev</code>.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+   * completion.
+   *
+   * @return An error code from <code>pp_errors.h</code>
+   */
+  int32_t (*Get)(PP_Instance instance,
+                 struct PP_Var name,
+                 PP_Ext_Alarms_Alarm_Dev* alarm,
+                 struct PP_CompletionCallback callback);
+  /**
+   * Gets an array of all the alarms.
+   *
+   * @param[in] instance A <code>PP_Instance</code>.
+   * @param[out] alarms A <code>PP_Var</code> whose contents conform to the
+   * description of <code>PP_Ext_Alarms_Alarm_Dev_Array</code>.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+   * completion.
+   *
+   * @return An error code from <code>pp_errors.h</code>
+   */
+  int32_t (*GetAll)(PP_Instance instance,
+                    PP_Ext_Alarms_Alarm_Dev_Array* alarms,
+                    struct PP_CompletionCallback callback);
+  /**
+   * Clears the alarm with the given name.
+   *
+   * @param[in] instance A <code>PP_Instance</code>.
+   * @param[in] name A string or undefined <code>PP_Var</code>. The name of the
+   * alarm to clear. Defaults to the empty string.
+   */
+  void (*Clear)(PP_Instance instance, struct PP_Var name);
+  /**
+   * Clears all alarms.
+   *
+   * @param[in] instance A <code>PP_Instance</code>.
+   */
+  void (*ClearAll)(PP_Instance instance);
+};
+
+typedef struct PPB_Ext_Alarms_Dev_0_1 PPB_Ext_Alarms_Dev;
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Typedefs
+ * @{
+ */
+/**
+ * Fired when an alarm has elapsed. Useful for event pages.
+ *
+ * @param[in] listener_id The listener ID.
+ * @param[inout] user_data The opaque pointer that was used when registering the
+ * listener.
+ * @param[in] alarm A <code>PP_Var</code> whose contents conform to the
+ * description of <code>PP_Ext_Alarms_Alarm_Dev</code>. The alarm that has
+ * elapsed.
+ */
+typedef void (*PP_Ext_Alarms_OnAlarm_Func_Dev_0_1)(
+    uint32_t listener_id,
+    void* user_data,
+    PP_Ext_Alarms_Alarm_Dev alarm);
+/**
+ * @}
+ */
+
+PP_INLINE struct PP_Ext_EventListener PP_Ext_Alarms_OnAlarm_Dev_0_1(
+    PP_Ext_Alarms_OnAlarm_Func_Dev_0_1 func,
+    void* user_data) {
+  return PP_Ext_MakeEventListener("alarms.onAlarm;0.1",
+                                  (PP_Ext_GenericFuncType)(func), user_data);
+}
+
+#define PP_Ext_Alarms_OnAlarm_Dev PP_Ext_Alarms_OnAlarm_Dev_0_1
+#endif  /* PPAPI_C_EXTENSIONS_DEV_PPB_ALARMS_DEV_H_ */
+
diff --git a/ppapi/c/extensions/dev/ppb_events_dev.h b/ppapi/c/extensions/dev/ppb_events_dev.h
new file mode 100644
index 0000000..5483dc9
--- /dev/null
+++ b/ppapi/c/extensions/dev/ppb_events_dev.h
@@ -0,0 +1,118 @@
+/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* From extensions/dev/ppb_events_dev.idl modified Sun Mar 10 10:37:48 2013. */
+
+#ifndef PPAPI_C_EXTENSIONS_DEV_PPB_EVENTS_DEV_H_
+#define PPAPI_C_EXTENSIONS_DEV_PPB_EVENTS_DEV_H_
+
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_stdint.h"
+
+#define PPB_EXT_EVENTS_DEV_INTERFACE_0_1 "PPB_Ext_Events(Dev);0.1"
+#define PPB_EXT_EVENTS_DEV_INTERFACE PPB_EXT_EVENTS_DEV_INTERFACE_0_1
+
+/**
+ * @file
+ */
+
+
+/**
+ * @addtogroup Typedefs
+ * @{
+ */
+/**
+ * Used to represent arbitrary C function pointers. Please note that usually
+ * the function that a <code>PP_Ext_GenericFuncType</code> pointer points to
+ * has a different signature than <code>void (*)()</code>.
+ */
+typedef void (*PP_Ext_GenericFuncType)(void);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Structs
+ * @{
+ */
+/**
+ * An event listener that can be registered with the browser and receive
+ * notifications via the callback function.
+ *
+ * A function is defined for each event type to return a properly-filled
+ * <code>PP_Ext_EventListener</code> struct, for example,
+ * <code>PP_Ext_Alarms_OnAlarm_Dev()</code>.
+ */
+struct PP_Ext_EventListener {
+  /**
+   * The name of the event to register to.
+   */
+  const char* event_name;
+  /**
+   * A callback function whose signature is determined by
+   * <code>event_name</code>. All calls will happen on the same thread as the
+   * one on which <code>AddListener()</code> is called.
+   */
+  PP_Ext_GenericFuncType func;
+  /**
+   * An opaque pointer that will be passed to <code>func</code>.
+   */
+  void* user_data;
+};
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+struct PPB_Ext_Events_Dev_0_1 {
+  /**
+   * Registers a listener to an event.
+   *
+   * @param[in] instance A <code>PP_Instance</code> identifying one instance of
+   * a module.
+   * @param[in] listener A <code>PP_Ext_EventListener</code> struct.
+   *
+   * @return An listener ID, or 0 if failed.
+   */
+  uint32_t (*AddListener)(PP_Instance instance,
+                          struct PP_Ext_EventListener listener);
+  /**
+   * Deregisters a listener.
+   *
+   * @param[in] instance A <code>PP_Instance</code> identifying one instance of
+   * a module.
+   * @param[in] listener_id The ID returned by <code>AddListener()</code>.
+   */
+  void (*RemoveListener)(PP_Instance instance, uint32_t listener_id);
+};
+
+typedef struct PPB_Ext_Events_Dev_0_1 PPB_Ext_Events_Dev;
+/**
+ * @}
+ */
+
+/**
+ * Creates a <code>PP_Ext_EventListener</code> struct.
+ *
+ * Usually you should not call it directly. Instead you should call those
+ * functions that return a <code>PP_Ext_EventListener</code> struct for a
+ * specific event type, for example, <code>PP_Ext_Alarms_OnAlarm_Dev()</code>.
+ */
+PP_INLINE struct PP_Ext_EventListener PP_Ext_MakeEventListener(
+    const char* event_name,
+    PP_Ext_GenericFuncType func,
+    void* user_data) {
+  struct PP_Ext_EventListener listener;
+  listener.event_name = event_name;
+  listener.func = func;
+  listener.user_data = user_data;
+  return listener;
+}
+#endif  /* PPAPI_C_EXTENSIONS_DEV_PPB_EVENTS_DEV_H_ */
+
diff --git a/ppapi/c/pp_completion_callback.h b/ppapi/c/pp_completion_callback.h
index 6619ca4..8d45da0 100644
--- a/ppapi/c/pp_completion_callback.h
+++ b/ppapi/c/pp_completion_callback.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From pp_completion_callback.idl modified Wed Nov  7 11:20:18 2012. */
+/* From pp_completion_callback.idl modified Mon Feb 11 15:42:11 2013. */
 
 #ifndef PPAPI_C_PP_COMPLETION_CALLBACK_H_
 #define PPAPI_C_PP_COMPLETION_CALLBACK_H_
@@ -257,7 +257,7 @@
  *
  * @return A <code>PP_CompletionCallback</code> structure.
  */
-PP_INLINE struct PP_CompletionCallback PP_BlockUntilComplete() {
+PP_INLINE struct PP_CompletionCallback PP_BlockUntilComplete(void) {
   return PP_MakeCompletionCallback(NULL, NULL);
 }
 
diff --git a/ppapi/c/pp_errors.h b/ppapi/c/pp_errors.h
index b02ee1b..180ebb3 100644
--- a/ppapi/c/pp_errors.h
+++ b/ppapi/c/pp_errors.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From pp_errors.idl modified Tue Mar 13 17:32:37 2012. */
+/* From pp_errors.idl modified Thu Dec 20 14:28:44 2012. */
 
 #ifndef PPAPI_C_PP_ERRORS_H_
 #define PPAPI_C_PP_ERRORS_H_
@@ -103,6 +103,8 @@
    * unexpectedly.
    */
   PP_ERROR_FILECHANGED = -23,
+  /** This value indicates that the pathname does not reference a file. */
+  PP_ERROR_NOTAFILE = -24,
   /** This value indicates failure due to a time limit being exceeded. */
   PP_ERROR_TIMEDOUT = -30,
   /**
diff --git a/ppapi/c/pp_macros.h b/ppapi/c/pp_macros.h
index 7d4429e..83f85d6 100644
--- a/ppapi/c/pp_macros.h
+++ b/ppapi/c/pp_macros.h
@@ -3,15 +3,17 @@
  * found in the LICENSE file.
  */
 
-/* From pp_macros.idl modified Wed Aug 15 17:29:43 2012. */
+/* From pp_macros.idl modified Fri Feb 15 16:46:46 2013. */
 
 #ifndef PPAPI_C_PP_MACROS_H_
 #define PPAPI_C_PP_MACROS_H_
 
 
+#define PPAPI_RELEASE 27
+
 /**
  * @file
- * Defines the API ...
+ * Defines the common macros such as assert, inline, ...
  */
 
 
diff --git a/ppapi/c/pp_touch_point.h b/ppapi/c/pp_touch_point.h
index c503d0b..bcdc37a 100644
--- a/ppapi/c/pp_touch_point.h
+++ b/ppapi/c/pp_touch_point.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From pp_touch_point.idl modified Fri Sep 21 10:18:48 2012. */
+/* From pp_touch_point.idl modified Mon Feb 11 15:42:54 2013. */
 
 #ifndef PPAPI_C_PP_TOUCH_POINT_H_
 #define PPAPI_C_PP_TOUCH_POINT_H_
@@ -75,7 +75,7 @@
  *
  * @return A <code>PP_TouchPoint</code> structure.
  */
-PP_INLINE struct PP_TouchPoint PP_MakeTouchPoint() {
+PP_INLINE struct PP_TouchPoint PP_MakeTouchPoint(void) {
   struct PP_TouchPoint result = { 0, {0, 0}, {0, 0}, 0, 0 };
   return result;
 }
diff --git a/ppapi/c/pp_var.h b/ppapi/c/pp_var.h
index d67b9b6..2138f93 100644
--- a/ppapi/c/pp_var.h
+++ b/ppapi/c/pp_var.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From pp_var.idl modified Wed Dec 14 18:08:00 2011. */
+/* From pp_var.idl modified Mon Feb 11 15:41:10 2013. */
 
 #ifndef PPAPI_C_PP_VAR_H_
 #define PPAPI_C_PP_VAR_H_
@@ -168,7 +168,7 @@
  *
  * @return A <code>PP_Var</code> structure.
  */
-PP_INLINE struct PP_Var PP_MakeUndefined() {
+PP_INLINE struct PP_Var PP_MakeUndefined(void) {
   struct PP_Var result = { PP_VARTYPE_UNDEFINED, 0, {PP_FALSE} };
   return result;
 }
@@ -179,7 +179,7 @@
  *
  * @return A <code>PP_Var</code> structure,
  */
-PP_INLINE struct PP_Var PP_MakeNull() {
+PP_INLINE struct PP_Var PP_MakeNull(void) {
   struct PP_Var result = { PP_VARTYPE_NULL, 0, {PP_FALSE} };
   return result;
 }
diff --git a/ppapi/c/dev/ppb_console_dev.h b/ppapi/c/ppb_console.h
similarity index 69%
rename from ppapi/c/dev/ppb_console_dev.h
rename to ppapi/c/ppb_console.h
index 68e697e..f441c31 100644
--- a/ppapi/c/dev/ppb_console_dev.h
+++ b/ppapi/c/ppb_console.h
@@ -3,10 +3,10 @@
  * found in the LICENSE file.
  */
 
-/* From dev/ppb_console_dev.idl modified Mon Nov 14 10:36:01 2011. */
+/* From ppb_console.idl modified Fri Nov 16 15:28:43 2012. */
 
-#ifndef PPAPI_C_DEV_PPB_CONSOLE_DEV_H_
-#define PPAPI_C_DEV_PPB_CONSOLE_DEV_H_
+#ifndef PPAPI_C_PPB_CONSOLE_H_
+#define PPAPI_C_PPB_CONSOLE_H_
 
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_instance.h"
@@ -14,12 +14,12 @@
 #include "ppapi/c/pp_stdint.h"
 #include "ppapi/c/pp_var.h"
 
-#define PPB_CONSOLE_DEV_INTERFACE_0_1 "PPB_Console(Dev);0.1"
-#define PPB_CONSOLE_DEV_INTERFACE PPB_CONSOLE_DEV_INTERFACE_0_1
+#define PPB_CONSOLE_INTERFACE_1_0 "PPB_Console;1.0"
+#define PPB_CONSOLE_INTERFACE PPB_CONSOLE_INTERFACE_1_0
 
 /**
  * @file
- * This file defines the <code>PPB_Console_Dev</code> interface.
+ * This file defines the <code>PPB_Console</code> interface.
  */
 
 
@@ -32,8 +32,8 @@
   PP_LOGLEVEL_LOG = 1,
   PP_LOGLEVEL_WARNING = 2,
   PP_LOGLEVEL_ERROR = 3
-} PP_LogLevel_Dev;
-PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_LogLevel_Dev, 4);
+} PP_LogLevel;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_LogLevel, 4);
 /**
  * @}
  */
@@ -42,14 +42,14 @@
  * @addtogroup Interfaces
  * @{
  */
-struct PPB_Console_Dev_0_1 {
+struct PPB_Console_1_0 {
   /**
    * Logs the given message to the JavaScript console associated with the
    * given plugin instance with the given logging level. The name of the plugin
    * issuing the log message will be automatically prepended to the message.
    * The value may be any type of Var.
    */
-  void (*Log)(PP_Instance instance, PP_LogLevel_Dev level, struct PP_Var value);
+  void (*Log)(PP_Instance instance, PP_LogLevel level, struct PP_Var value);
   /**
    * Logs a message to the console with the given source information rather
    * than using the internal PPAPI plugin name. The name must be a string var.
@@ -61,15 +61,15 @@
    * doing the log statement rather than have "python" show up in the console.
    */
   void (*LogWithSource)(PP_Instance instance,
-                        PP_LogLevel_Dev level,
+                        PP_LogLevel level,
                         struct PP_Var source,
                         struct PP_Var value);
 };
 
-typedef struct PPB_Console_Dev_0_1 PPB_Console_Dev;
+typedef struct PPB_Console_1_0 PPB_Console;
 /**
  * @}
  */
 
-#endif  /* PPAPI_C_DEV_PPB_CONSOLE_DEV_H_ */
+#endif  /* PPAPI_C_PPB_CONSOLE_H_ */
 
diff --git a/ppapi/c/ppb_core.h b/ppapi/c/ppb_core.h
index 2bbbcb1..135f857 100644
--- a/ppapi/c/ppb_core.h
+++ b/ppapi/c/ppb_core.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From ppb_core.idl modified Wed Oct  5 14:06:02 2011. */
+/* From ppb_core.idl modified Mon Mar 19 12:02:10 2012. */
 
 #ifndef PPAPI_C_PPB_CORE_H_
 #define PPAPI_C_PPB_CORE_H_
@@ -58,7 +58,7 @@
    * @return A <code>PP_Time</code> containing the "wall clock time" according
    * to the browser.
    */
-  PP_Time (*GetTime)();
+  PP_Time (*GetTime)(void);
   /**
    * GetTimeTicks() returns the "tick time" according to the browser.
    * This clock is used by the browser when passing some event times to the
@@ -70,7 +70,7 @@
    * @return A <code>PP_TimeTicks</code> containing the "tick time" according
    * to the browser.
    */
-  PP_TimeTicks (*GetTimeTicks)();
+  PP_TimeTicks (*GetTimeTicks)(void);
   /**
    * CallOnMainThread() schedules work to be executed on the main module thread
    * after the specified delay. The delay may be 0 to specify a call back as
@@ -107,7 +107,7 @@
    * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the
    * current thread is the main pepper thread, otherwise <code>PP_FALSE</code>.
    */
-  PP_Bool (*IsMainThread)();
+  PP_Bool (*IsMainThread)(void);
 };
 
 typedef struct PPB_Core_1_0 PPB_Core;
diff --git a/ppapi/c/ppb_file_io.h b/ppapi/c/ppb_file_io.h
index 4b9db95..da3747a 100644
--- a/ppapi/c/ppb_file_io.h
+++ b/ppapi/c/ppb_file_io.h
@@ -3,11 +3,12 @@
  * found in the LICENSE file.
  */
 
-/* From ppb_file_io.idl modified Wed Feb 15 15:55:56 2012. */
+/* From ppb_file_io.idl modified Fri Nov 16 10:46:53 2012. */
 
 #ifndef PPAPI_C_PPB_FILE_IO_H_
 #define PPAPI_C_PPB_FILE_IO_H_
 
+#include "ppapi/c/pp_array_output.h"
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/pp_file_info.h"
@@ -18,7 +19,8 @@
 #include "ppapi/c/pp_time.h"
 
 #define PPB_FILEIO_INTERFACE_1_0 "PPB_FileIO;1.0"
-#define PPB_FILEIO_INTERFACE PPB_FILEIO_INTERFACE_1_0
+#define PPB_FILEIO_INTERFACE_1_1 "PPB_FileIO;1.1"
+#define PPB_FILEIO_INTERFACE PPB_FILEIO_INTERFACE_1_1
 
 /**
  * @file
@@ -73,7 +75,7 @@
  * The <code>PPB_FileIO</code> struct is used to operate on a regular file
  * (PP_FileType_Regular).
  */
-struct PPB_FileIO_1_0 {
+struct PPB_FileIO_1_1 {
   /**
    * Create() creates a new FileIO object.
    *
@@ -159,7 +161,10 @@
   /**
    * Read() reads from an offset in the file.  The size of the buffer must be
    * large enough to hold the specified number of bytes to read.  This function
-   * might perform a partial read.
+   * might perform a partial read, meaning all the requested bytes
+   * might not be returned, even if the end of the file has not been reached.
+   *
+   * ReadToArray() is preferred to Read() when doing asynchronous operations.
    *
    * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
    * FileIO.
@@ -252,9 +257,65 @@
    * FileIO.
    */
   void (*Close)(PP_Resource file_io);
+  /**
+   * ReadToArray() reads from an offset in the file.  A PP_ArrayOutput must be
+   * provided so that output will be stored in its allocated buffer.  This
+   * function might perform a partial read.
+   *
+   * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
+   * FileIO.
+   * @param[in] offset The offset into the file.
+   * @param[in] max_read_length The maximum number of bytes to read from
+   * <code>offset</code>.
+   * @param[in] output A <code>PP_ArrayOutput</code> to hold the output data.
+   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+   * completion of ReadToArray().
+   *
+   * @return The number of bytes read or an error code from
+   * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was
+   * reached. It is valid to call ReadToArray() multiple times with a completion
+   * callback to queue up parallel reads from the file, but pending reads
+   * cannot be interleaved with other operations.
+   */
+  int32_t (*ReadToArray)(PP_Resource file_io,
+                         int64_t offset,
+                         int32_t max_read_length,
+                         struct PP_ArrayOutput* output,
+                         struct PP_CompletionCallback callback);
 };
 
-typedef struct PPB_FileIO_1_0 PPB_FileIO;
+typedef struct PPB_FileIO_1_1 PPB_FileIO;
+
+struct PPB_FileIO_1_0 {
+  PP_Resource (*Create)(PP_Instance instance);
+  PP_Bool (*IsFileIO)(PP_Resource resource);
+  int32_t (*Open)(PP_Resource file_io,
+                  PP_Resource file_ref,
+                  int32_t open_flags,
+                  struct PP_CompletionCallback callback);
+  int32_t (*Query)(PP_Resource file_io,
+                   struct PP_FileInfo* info,
+                   struct PP_CompletionCallback callback);
+  int32_t (*Touch)(PP_Resource file_io,
+                   PP_Time last_access_time,
+                   PP_Time last_modified_time,
+                   struct PP_CompletionCallback callback);
+  int32_t (*Read)(PP_Resource file_io,
+                  int64_t offset,
+                  char* buffer,
+                  int32_t bytes_to_read,
+                  struct PP_CompletionCallback callback);
+  int32_t (*Write)(PP_Resource file_io,
+                   int64_t offset,
+                   const char* buffer,
+                   int32_t bytes_to_write,
+                   struct PP_CompletionCallback callback);
+  int32_t (*SetLength)(PP_Resource file_io,
+                       int64_t length,
+                       struct PP_CompletionCallback callback);
+  int32_t (*Flush)(PP_Resource file_io, struct PP_CompletionCallback callback);
+  void (*Close)(PP_Resource file_io);
+};
 /**
  * @}
  */
diff --git a/ppapi/c/ppb_image_data.h b/ppapi/c/ppb_image_data.h
index 8879dc6..fb091d7 100644
--- a/ppapi/c/ppb_image_data.h
+++ b/ppapi/c/ppb_image_data.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From ppb_image_data.idl modified Wed Oct 31 10:35:03 2012. */
+/* From ppb_image_data.idl modified Tue Nov 13 08:48:25 2012. */
 
 #ifndef PPAPI_C_PPB_IMAGE_DATA_H_
 #define PPAPI_C_PPB_IMAGE_DATA_H_
@@ -114,7 +114,7 @@
    *
    * @return A <code>PP_ImageDataFormat</code> containing the preferred format.
    */
-  PP_ImageDataFormat (*GetNativeImageDataFormat)();
+  PP_ImageDataFormat (*GetNativeImageDataFormat)(void);
   /**
    * IsImageDataFormatSupported() determines if the given image data format is
    * supported by the browser. Note: <code>PP_IMAGEDATAFORMAT_BGRA_PREMUL</code>
diff --git a/ppapi/c/ppb_input_event.h b/ppapi/c/ppb_input_event.h
index 6122b58..bc6ebcb 100644
--- a/ppapi/c/ppb_input_event.h
+++ b/ppapi/c/ppb_input_event.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From ppb_input_event.idl modified Tue Aug 14 09:41:28 2012. */
+/* From ppb_input_event.idl modified Mon Nov 26 19:51:21 2012. */
 
 #ifndef PPAPI_C_PPB_INPUT_EVENT_H_
 #define PPAPI_C_PPB_INPUT_EVENT_H_
@@ -274,7 +274,12 @@
    *
    * Request touch events only if you intend to handle them. If the browser
    * knows you do not need to handle touch events, it can handle them at a
-   * higher level and achieve higher performance.
+   * higher level and achieve higher performance. If the plugin does not
+   * register for touch-events, then it will receive synthetic mouse events that
+   * are generated from the touch events (e.g. mouse-down for touch-start,
+   * mouse-move for touch-move (with left-button down), and mouse-up for
+   * touch-end. If the plugin does register for touch events, then the synthetic
+   * mouse events are not created.
    */
   PP_INPUTEVENT_CLASS_TOUCH = 1 << 3,
   /**
@@ -321,6 +326,9 @@
    * processed very quickly, may have a noticeable effect on the performance of
    * the page.
    *
+   * Note that synthetic mouse events will be generated from touch events if
+   * (and only if) the you do not request touch events.
+   *
    * When requesting input events through this function, the events will be
    * delivered and <i>not</i> bubbled to the page. This means that even if you
    * aren't interested in the message, no other parts of the page will get
diff --git a/ppapi/c/ppb_instance.h b/ppapi/c/ppb_instance.h
index 4043396..7087256 100644
--- a/ppapi/c/ppb_instance.h
+++ b/ppapi/c/ppb_instance.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From ppb_instance.idl modified Wed Oct  5 14:06:02 2011. */
+/* From ppb_instance.idl modified Fri Dec 07 12:57:46 2012. */
 
 #ifndef PPAPI_C_PPB_INSTANCE_H_
 #define PPAPI_C_PPB_INSTANCE_H_
@@ -13,9 +13,7 @@
 #include "ppapi/c/pp_macros.h"
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/c/pp_stdint.h"
-#include "ppapi/c/pp_var.h"
 
-#define PPB_INSTANCE_INTERFACE_0_5 "PPB_Instance;0.5"
 #define PPB_INSTANCE_INTERFACE_1_0 "PPB_Instance;1.0"
 #define PPB_INSTANCE_INTERFACE PPB_INSTANCE_INTERFACE_1_0
 
@@ -80,13 +78,6 @@
 };
 
 typedef struct PPB_Instance_1_0 PPB_Instance;
-
-struct PPB_Instance_0_5 {
-  struct PP_Var (*GetWindowObject)(PP_Instance instance);
-  struct PP_Var (*GetOwnerElementObject)(PP_Instance instance);
-  PP_Bool (*BindGraphics)(PP_Instance instance, PP_Resource device);
-  PP_Bool (*IsFullFrame)(PP_Instance instance);
-};
 /**
  * @}
  */
diff --git a/ppapi/c/dev/ppb_message_loop_dev.h b/ppapi/c/ppb_message_loop.h
similarity index 92%
rename from ppapi/c/dev/ppb_message_loop_dev.h
rename to ppapi/c/ppb_message_loop.h
index 5f41974..2ff9511 100644
--- a/ppapi/c/dev/ppb_message_loop_dev.h
+++ b/ppapi/c/ppb_message_loop.h
@@ -3,10 +3,10 @@
  * found in the LICENSE file.
  */
 
-/* From dev/ppb_message_loop_dev.idl modified Wed Aug 29 12:22:26 2012. */
+/* From ppb_message_loop.idl modified Thu Jan 17 12:04:14 2013. */
 
-#ifndef PPAPI_C_DEV_PPB_MESSAGE_LOOP_DEV_H_
-#define PPAPI_C_DEV_PPB_MESSAGE_LOOP_DEV_H_
+#ifndef PPAPI_C_PPB_MESSAGE_LOOP_H_
+#define PPAPI_C_PPB_MESSAGE_LOOP_H_
 
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_completion_callback.h"
@@ -15,12 +15,12 @@
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/c/pp_stdint.h"
 
-#define PPB_MESSAGELOOP_DEV_INTERFACE_0_1 "PPB_MessageLoop(Dev);0.1"
-#define PPB_MESSAGELOOP_DEV_INTERFACE PPB_MESSAGELOOP_DEV_INTERFACE_0_1
+#define PPB_MESSAGELOOP_INTERFACE_1_0 "PPB_MessageLoop;1.0"
+#define PPB_MESSAGELOOP_INTERFACE PPB_MESSAGELOOP_INTERFACE_1_0
 
 /**
  * @file
- * Defines the PPB_MessageLoop_Dev interface.
+ * Defines the PPB_MessageLoop interface.
  */
 
 
@@ -135,14 +135,14 @@
  *
  *   pp::CompletionCallback callback = factory_.NewOptionalCallback(...);
  *   int32_t result = message_loop.PostWork(callback);
- *   if (result != PP_OK_COMPLETIONPENDING)
+ *   if (result != PP_OK)
  *     callback.Run(result);
  *
  * This will run the callback with an error value, and assumes that the
  * implementation of your callback checks the "result" argument and returns
  * immediately on error.
  */
-struct PPB_MessageLoop_Dev_0_1 {
+struct PPB_MessageLoop_1_0 {
   /**
    * Creates a message loop resource.
    *
@@ -155,12 +155,12 @@
    * Returns a resource identifying the message loop for the main thread. The
    * main thread always has a message loop created by the system.
    */
-  PP_Resource (*GetForMainThread)();
+  PP_Resource (*GetForMainThread)(void);
   /**
    * Returns a reference to the PPB_MessageLoop object attached to the current
    * thread. If there is no attached message loop, the return value will be 0.
    */
-  PP_Resource (*GetCurrent)();
+  PP_Resource (*GetCurrent)(void);
   /**
    * Sets the given message loop resource as being the associated message loop
    * for the currently running thread.
@@ -244,9 +244,9 @@
    * PP_FALSE. It will be queued until the next invocation of Run().
    *
    * @return
-   *   - PP_OK_COMPLETIONPENDING: The work was posted to the message loop's
-   *     queue. As described above, this does not mean that the work has been
-   *     or will be executed (if you never run the message loop after posting).
+   *   - PP_OK: The work was posted to the message loop's queue. As described
+   *     above, this does not mean that the work has been or will be executed
+   *     (if you never run the message loop after posting).
    *   - PP_ERROR_BADRESOURCE: The given message loop resource is invalid.
    *   - PP_ERROR_BADARGUMENT: The function pointer for the completion callback
    *     is null (this will be the case if you pass PP_BlockUntilComplete()).
@@ -260,7 +260,8 @@
    * before that point will be processed before quitting.
    *
    * This may be called on the message loop registered for the current thread,
-   * or it may be called on the message loop registered for another thread.
+   * or it may be called on the message loop registered for another thread. It
+   * is an error to attempt to PostQuit() the main thread loop.
    *
    * @param should_destroy Marks the message loop as being in a destroyed state
    * and prevents further posting of messages.
@@ -279,10 +280,10 @@
   int32_t (*PostQuit)(PP_Resource message_loop, PP_Bool should_destroy);
 };
 
-typedef struct PPB_MessageLoop_Dev_0_1 PPB_MessageLoop_Dev;
+typedef struct PPB_MessageLoop_1_0 PPB_MessageLoop;
 /**
  * @}
  */
 
-#endif  /* PPAPI_C_DEV_PPB_MESSAGE_LOOP_DEV_H_ */
+#endif  /* PPAPI_C_PPB_MESSAGE_LOOP_H_ */
 
diff --git a/ppapi/c/ppb_mouse_lock.h b/ppapi/c/ppb_mouse_lock.h
index d75325e..c132366 100644
--- a/ppapi/c/ppb_mouse_lock.h
+++ b/ppapi/c/ppb_mouse_lock.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From ppb_mouse_lock.idl modified Wed Dec 21 19:08:34 2011. */
+/* From ppb_mouse_lock.idl modified Mon Dec 17 16:09:50 2012. */
 
 #ifndef PPAPI_C_PPB_MOUSE_LOCK_H_
 #define PPAPI_C_PPB_MOUSE_LOCK_H_
@@ -36,8 +36,7 @@
  */
 struct PPB_MouseLock_1_0 {
   /**
-   * LockMouse() requests the mouse to be locked. The browser will permit mouse
-   * lock only while the tab is in fullscreen mode.
+   * LockMouse() requests the mouse to be locked.
    *
    * While the mouse is locked, the cursor is implicitly hidden from the user.
    * Any movement of the mouse will generate a
diff --git a/ppapi/c/ppb_var_array_buffer.h b/ppapi/c/ppb_var_array_buffer.h
index 06d6852..79518e9 100644
--- a/ppapi/c/ppb_var_array_buffer.h
+++ b/ppapi/c/ppb_var_array_buffer.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From ppb_var_array_buffer.idl modified Thu Feb 16 14:06:44 2012. */
+/* From ppb_var_array_buffer.idl modified Thu Feb 28 09:24:06 2013. */
 
 #ifndef PPAPI_C_PPB_VAR_ARRAY_BUFFER_H_
 #define PPAPI_C_PPB_VAR_ARRAY_BUFFER_H_
@@ -69,10 +69,13 @@
   /**
    * Map() maps the <code>ArrayBuffer</code> in to the module's address space
    * and returns a pointer to the beginning of the buffer for the given
-   * <code>ArrayBuffer PP_Var</code>. Note that calling Map() can be a
-   * relatively expensive operation. Use care when calling it in
-   * performance-critical code. For example, you should call it only once when
-   * looping over an <code>ArrayBuffer</code>.
+   * <code>ArrayBuffer PP_Var</code>. ArrayBuffers are copied when transmitted,
+   * so changes to the underlying memory are not automatically available to
+   * the embedding page.
+   *
+   * Note that calling Map() can be a relatively expensive operation. Use care
+   * when calling it in performance-critical code. For example, you should call
+   * it only once when looping over an <code>ArrayBuffer</code>.
    *
    * <strong>Example:</strong>
    *
diff --git a/ppapi/c/ppp.h b/ppapi/c/ppp.h
index fad8d6c..588e084 100644
--- a/ppapi/c/ppp.h
+++ b/ppapi/c/ppp.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From ppp.idl modified Mon Nov  5 15:50:24 2012. */
+/* From ppp.idl modified Mon Feb 11 15:48:41 2013. */
 
 #ifndef PPAPI_C_PPP_H_
 #define PPAPI_C_PPP_H_
@@ -88,7 +88,7 @@
  * implementations in certain circumstances when Chrome does "fast shutdown"
  * of a web page.
  */
-PP_EXPORT void PPP_ShutdownModule();
+PP_EXPORT void PPP_ShutdownModule(void);
 /**
  * @}
  */
@@ -145,7 +145,7 @@
 /**
  * Defines the type of the <code>PPP_ShutdownModule</code> function.
  */
-typedef void (*PP_ShutdownModule_Func)();
+typedef void (*PP_ShutdownModule_Func)(void);
 
 /**
  * Defines the type of the <code>PPP_ShutdownModule</code> function.
diff --git a/ppapi/c/private/pp_content_decryptor.h b/ppapi/c/private/pp_content_decryptor.h
index 66011f4..43ea559 100644
--- a/ppapi/c/private/pp_content_decryptor.h
+++ b/ppapi/c/private/pp_content_decryptor.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From private/pp_content_decryptor.idl modified Thu Oct 25 16:40:07 2012. */
+/* From private/pp_content_decryptor.idl modified Tue Dec  4 16:42:46 2012. */
 
 #ifndef PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_
 #define PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_
@@ -31,11 +31,16 @@
    */
   uint32_t request_id;
   /**
-   * 4-byte padding to make the size of <code>PP_DecryptTrackingInfo</code>
-   * a multiple of 8 bytes and make sure |timestamp| starts on 8-byte boundary.
-   * The value of this field should not be used.
+   * A unique buffer ID to identify a PPB_Buffer_Dev. Unlike a PP_Resource,
+   * this ID is identical at both the renderer side and the plugin side.
+   * In <code>PPB_ContentDecryptor_Private</code> calls, this is the ID of the
+   * buffer associated with the decrypted block/frame/samples.
+   * In <code>PPP_ContentDecryptor_Private</code> calls, this is the ID of a
+   * buffer that is no longer need at the renderer side, which can be released
+   * or recycled by the plugin. This ID can be 0 if there is no buffer to be
+   * released or recycled.
    */
-  uint32_t padding;
+  uint32_t buffer_id;
   /**
    * Timestamp in microseconds of the associated block. By using this value,
    * the client can associate the decrypted (and decoded) data with an input
@@ -94,6 +99,10 @@
    */
   struct PP_DecryptTrackingInfo tracking_info;
   /**
+   * Size in bytes of data to be decrypted (data_offset included).
+   */
+  uint32_t data_size;
+  /**
    * Size in bytes of data to be discarded before applying the decryption.
    */
   uint32_t data_offset;
@@ -118,8 +127,13 @@
    */
   struct PP_DecryptSubsampleDescription subsamples[16];
   uint32_t num_subsamples;
+  /**
+   * 4-byte padding to make the size of <code>PP_EncryptedBlockInfo</code>
+   * a multiple of 8 bytes. The value of this field should not be used.
+   */
+  uint32_t padding;
 };
-PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_EncryptedBlockInfo, 240);
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_EncryptedBlockInfo, 248);
 /**
  * @}
  */
@@ -173,11 +187,10 @@
    */
   PP_DecryptResult result;
   /**
-   * 4-byte padding to make the size of <code>PP_DecryptedBlockInfo</code>
-   * a multiple of 8 bytes, and ensure consistent size on all targets. This
-   * value should never be used.
+   * Size in bytes of decrypted data, which may be less than the size of the
+   * corresponding buffer.
    */
-  uint32_t padding;
+  uint32_t data_size;
   /**
    * Information needed by the client to track the block to be decrypted.
    */
diff --git a/ppapi/c/private/ppb_content_decryptor_private.h b/ppapi/c/private/ppb_content_decryptor_private.h
index 7adeb20..984c6c1 100644
--- a/ppapi/c/private/ppb_content_decryptor_private.h
+++ b/ppapi/c/private/ppb_content_decryptor_private.h
@@ -4,7 +4,7 @@
  */
 
 /* From private/ppb_content_decryptor_private.idl,
- *   modified Fri Oct 26 14:47:38 2012.
+ *   modified Mon Dec 10 21:43:51 2012.
  */
 
 #ifndef PPAPI_C_PRIVATE_PPB_CONTENT_DECRYPTOR_PRIVATE_H_
@@ -63,7 +63,7 @@
    * <code>PP_VARTYPE_STRING</code> containing the session ID.
    *
    * @param[in] init_data A <code>PP_Var</code> of type
-   * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container-specific
+   * <code>PP_VARTYPE_ARRAY_BUFFER</code> containing container-specific
    * initialization data.
    */
   void (*NeedKey)(PP_Instance instance,
@@ -112,8 +112,8 @@
    * @param[in] session_id A <code>PP_Var</code> of type
    * <code>PP_VARTYPE_STRING</code> containing the session ID.
    *
-   * @param[in] resource A <code>PP_Resource</code> corresponding to a
-   * <code>PPB_Buffer_Dev</code> resource that contains the message.
+   * @param[in] message A <code>PP_Var</code> of type
+   * <code>PP_VARTYPE_ARRAY_BUFFER</code> that contains the message.
    *
    * @param[in] default_url A <code>PP_Var</code> of type
    * <code>PP_VARTYPE_STRING</code> containing the default URL for the message.
@@ -121,7 +121,7 @@
   void (*KeyMessage)(PP_Instance instance,
                      struct PP_Var key_system,
                      struct PP_Var session_id,
-                     PP_Resource message,
+                     struct PP_Var message,
                      struct PP_Var default_url);
   /**
    * An error occurred in a <code>PPP_ContentDecryptor_Private</code> method,
@@ -147,6 +147,10 @@
    * <code>PPP_ContentDecryptor_Private</code> interface completes to
    * deliver decrypted_block to the browser for decoding and rendering.
    *
+   * The plugin must not hold a reference to the encrypted buffer resource
+   * provided to <code>Decrypt()</code> when it calls this method. The browser
+   * will reuse the buffer in a subsequent <code>Decrypt()</code> call.
+   *
    * @param[in] decrypted_block A <code>PP_Resource</code> corresponding to a
    * <code>PPB_Buffer_Dev</code> resource that contains a decrypted data
    * block.
@@ -214,6 +218,11 @@
    * <code>PPP_ContentDecryptor_Private</code> interface completes to deliver
    * a decrypted and decoded video frame to the browser for rendering.
    *
+   * The plugin must not hold a reference to the encrypted buffer resource
+   * provided to <code>DecryptAndDecode()</code> when it calls this method. The
+   * browser will reuse the buffer in a subsequent
+   * <code>DecryptAndDecode()</code> call.
+   *
    * @param[in] decrypted_frame A <code>PP_Resource</code> corresponding to a
    * <code>PPB_Buffer_Dev</code> resource that contains a video frame.
    *
@@ -227,10 +236,15 @@
       const struct PP_DecryptedFrameInfo* decrypted_frame_info);
   /**
    * Called after the <code>DecryptAndDecode()</code> method on the
-   * <code>PPP_ContentDecryptor_Private</code> interface completes to
-   * deliver a buffer of decrypted and decoded audio samples to the browser for
+   * <code>PPP_ContentDecryptor_Private</code> interface completes to deliver
+   * a buffer of decrypted and decoded audio samples to the browser for
    * rendering.
    *
+   * The plugin must not hold a reference to the encrypted buffer resource
+   * provided to <code>DecryptAndDecode()</code> when it calls this method. The
+   * browser will reuse the buffer in a subsequent
+   * <code>DecryptAndDecode()</code> call.
+   *
    * <code>audio_frames</code> can contain multiple audio output buffers. Each
    * buffer is serialized in this format:
    *
diff --git a/ppapi/c/private/ppb_flash.h b/ppapi/c/private/ppb_flash.h
index 0279556..3a586dd 100644
--- a/ppapi/c/private/ppb_flash.h
+++ b/ppapi/c/private/ppb_flash.h
@@ -3,12 +3,11 @@
  * found in the LICENSE file.
  */
 
-/* From private/ppb_flash.idl modified Mon Oct  8 13:03:27 2012. */
+/* From private/ppb_flash.idl modified Thu Jan 31 16:23:42 2013. */
 
 #ifndef PPAPI_C_PRIVATE_PPB_FLASH_H_
 #define PPAPI_C_PRIVATE_PPB_FLASH_H_
 
-#include "ppapi/c/dev/ppb_font_dev.h"
 #include "ppapi/c/pp_array_output.h"
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_instance.h"
@@ -21,15 +20,13 @@
 #include "ppapi/c/pp_stdint.h"
 #include "ppapi/c/pp_time.h"
 #include "ppapi/c/pp_var.h"
+#include "ppapi/c/trusted/ppb_browser_font_trusted.h"
 
-#define PPB_FLASH_INTERFACE_12_0 "PPB_Flash;12.0"
-#define PPB_FLASH_INTERFACE_12_1 "PPB_Flash;12.1"
-#define PPB_FLASH_INTERFACE_12_2 "PPB_Flash;12.2"
-#define PPB_FLASH_INTERFACE_12_3 "PPB_Flash;12.3"
 #define PPB_FLASH_INTERFACE_12_4 "PPB_Flash;12.4"
 #define PPB_FLASH_INTERFACE_12_5 "PPB_Flash;12.5"
 #define PPB_FLASH_INTERFACE_12_6 "PPB_Flash;12.6"
-#define PPB_FLASH_INTERFACE PPB_FLASH_INTERFACE_12_6
+#define PPB_FLASH_INTERFACE_13_0 "PPB_Flash;13.0"
+#define PPB_FLASH_INTERFACE PPB_FLASH_INTERFACE_13_0
 
 /**
  * @file
@@ -103,7 +100,14 @@
    * Specifies restrictions on how flash should handle LSOs. The result is an
    * int from <code>PP_FlashLSORestrictions</code>.
    */
-  PP_FLASHSETTING_LSORESTRICTIONS = 6
+  PP_FLASHSETTING_LSORESTRICTIONS = 6,
+  /**
+   * Specifies if the driver is reliable enough to use Shader Model 3 commands
+   * with it.
+   *
+   * This should only be enabled if PP_FLASHSETTING_STAGE3DENABLED is true.
+   */
+  PP_FLASHSETTING_STAGE3DBASELINEENABLED = 7
 } PP_FlashSetting;
 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashSetting, 4);
 
@@ -129,7 +133,7 @@
  * The <code>PPB_Flash</code> interface contains pointers to various functions
  * that are only needed to support Pepper Flash.
  */
-struct PPB_Flash_12_6 {
+struct PPB_Flash_13_0 {
   /**
    * Sets or clears the rendering hint that the given plugin instance is always
    * on top of page content. Somewhat more optimized painting can be used in
@@ -144,17 +148,18 @@
    * system settings. For this to work properly, the graphics layer that the
    * text is being drawn into must be opaque.
    */
-  PP_Bool (*DrawGlyphs)(PP_Instance instance,
-                        PP_Resource pp_image_data,
-                        const struct PP_FontDescription_Dev* font_desc,
-                        uint32_t color,
-                        const struct PP_Point* position,
-                        const struct PP_Rect* clip,
-                        const float transformation[3][3],
-                        PP_Bool allow_subpixel_aa,
-                        uint32_t glyph_count,
-                        const uint16_t glyph_indices[],
-                        const struct PP_Point glyph_advances[]);
+  PP_Bool (*DrawGlyphs)(
+      PP_Instance instance,
+      PP_Resource pp_image_data,
+      const struct PP_BrowserFont_Trusted_Description* font_desc,
+      uint32_t color,
+      const struct PP_Point* position,
+      const struct PP_Rect* clip,
+      const float transformation[3][3],
+      PP_Bool allow_subpixel_aa,
+      uint32_t glyph_count,
+      const uint16_t glyph_indices[],
+      const struct PP_Point glyph_advances[]);
   /**
    * Retrieves the proxy that will be used for the given URL. The result will
    * be a string in PAC format, or an undefined var on error.
@@ -168,18 +173,6 @@
                       const char* target,
                       PP_Bool from_user_action);
   /**
-   * Runs a nested message loop. The plugin will be reentered from this call.
-   * This function is used in places where Flash would normally enter a nested
-   * message loop (e.g., when displaying context menus), but Pepper provides
-   * only an asynchronous call. After performing that asynchronous call, call
-   * |RunMessageLoop()|. In the callback, call |QuitMessageLoop()|.
-   */
-  void (*RunMessageLoop)(PP_Instance instance);
-  /* Posts a quit message for the outermost nested message loop. Use this to
-   * exit and return back to the caller after you call RunMessageLoop.
-   */
-  void (*QuitMessageLoop)(PP_Instance instance);
-  /**
    * Retrieves the local time zone offset from GM time for the given UTC time.
    */
   double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t);
@@ -204,24 +197,11 @@
    */
   PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect);
   /**
-   * Does nothing, deprecated. See PPB_Flash_Print.
-   */
-  int32_t (*InvokePrinting)(PP_Instance instance);
-  /**
    * Indicates that there's activity and, e.g., the screensaver shouldn't kick
    * in.
    */
   void (*UpdateActivity)(PP_Instance instance);
   /**
-   * Returns the device ID as a string. Returns a PP_VARTYPE_UNDEFINED on error.
-   * Deprecated, use GetDeviceIDAsync.
-   */
-  struct PP_Var (*GetDeviceID)(PP_Instance instance);
-  /**
-   * Deprecated. See GetSetting().
-   */
-  int32_t (*GetSettingInt)(PP_Instance instance, PP_FlashSetting setting);
-  /**
    * Returns the value associated with the given setting. Invalid enums will
    * result in an undefined PP_Var return value.
    */
@@ -251,129 +231,22 @@
                                           struct PP_ArrayOutput devices);
 };
 
-typedef struct PPB_Flash_12_6 PPB_Flash;
-
-struct PPB_Flash_12_0 {
-  void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
-  PP_Bool (*DrawGlyphs)(PP_Instance instance,
-                        PP_Resource pp_image_data,
-                        const struct PP_FontDescription_Dev* font_desc,
-                        uint32_t color,
-                        const struct PP_Point* position,
-                        const struct PP_Rect* clip,
-                        const float transformation[3][3],
-                        PP_Bool allow_subpixel_aa,
-                        uint32_t glyph_count,
-                        const uint16_t glyph_indices[],
-                        const struct PP_Point glyph_advances[]);
-  struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
-  int32_t (*Navigate)(PP_Resource request_info,
-                      const char* target,
-                      PP_Bool from_user_action);
-  void (*RunMessageLoop)(PP_Instance instance);
-  void (*QuitMessageLoop)(PP_Instance instance);
-  double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t);
-  struct PP_Var (*GetCommandLineArgs)(PP_Module module);
-  void (*PreloadFontWin)(const void* logfontw);
-};
-
-struct PPB_Flash_12_1 {
-  void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
-  PP_Bool (*DrawGlyphs)(PP_Instance instance,
-                        PP_Resource pp_image_data,
-                        const struct PP_FontDescription_Dev* font_desc,
-                        uint32_t color,
-                        const struct PP_Point* position,
-                        const struct PP_Rect* clip,
-                        const float transformation[3][3],
-                        PP_Bool allow_subpixel_aa,
-                        uint32_t glyph_count,
-                        const uint16_t glyph_indices[],
-                        const struct PP_Point glyph_advances[]);
-  struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
-  int32_t (*Navigate)(PP_Resource request_info,
-                      const char* target,
-                      PP_Bool from_user_action);
-  void (*RunMessageLoop)(PP_Instance instance);
-  void (*QuitMessageLoop)(PP_Instance instance);
-  double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t);
-  struct PP_Var (*GetCommandLineArgs)(PP_Module module);
-  void (*PreloadFontWin)(const void* logfontw);
-  PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect);
-  int32_t (*InvokePrinting)(PP_Instance instance);
-  void (*UpdateActivity)(PP_Instance instance);
-};
-
-struct PPB_Flash_12_2 {
-  void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
-  PP_Bool (*DrawGlyphs)(PP_Instance instance,
-                        PP_Resource pp_image_data,
-                        const struct PP_FontDescription_Dev* font_desc,
-                        uint32_t color,
-                        const struct PP_Point* position,
-                        const struct PP_Rect* clip,
-                        const float transformation[3][3],
-                        PP_Bool allow_subpixel_aa,
-                        uint32_t glyph_count,
-                        const uint16_t glyph_indices[],
-                        const struct PP_Point glyph_advances[]);
-  struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
-  int32_t (*Navigate)(PP_Resource request_info,
-                      const char* target,
-                      PP_Bool from_user_action);
-  void (*RunMessageLoop)(PP_Instance instance);
-  void (*QuitMessageLoop)(PP_Instance instance);
-  double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t);
-  struct PP_Var (*GetCommandLineArgs)(PP_Module module);
-  void (*PreloadFontWin)(const void* logfontw);
-  PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect);
-  int32_t (*InvokePrinting)(PP_Instance instance);
-  void (*UpdateActivity)(PP_Instance instance);
-  struct PP_Var (*GetDeviceID)(PP_Instance instance);
-};
-
-struct PPB_Flash_12_3 {
-  void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
-  PP_Bool (*DrawGlyphs)(PP_Instance instance,
-                        PP_Resource pp_image_data,
-                        const struct PP_FontDescription_Dev* font_desc,
-                        uint32_t color,
-                        const struct PP_Point* position,
-                        const struct PP_Rect* clip,
-                        const float transformation[3][3],
-                        PP_Bool allow_subpixel_aa,
-                        uint32_t glyph_count,
-                        const uint16_t glyph_indices[],
-                        const struct PP_Point glyph_advances[]);
-  struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
-  int32_t (*Navigate)(PP_Resource request_info,
-                      const char* target,
-                      PP_Bool from_user_action);
-  void (*RunMessageLoop)(PP_Instance instance);
-  void (*QuitMessageLoop)(PP_Instance instance);
-  double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t);
-  struct PP_Var (*GetCommandLineArgs)(PP_Module module);
-  void (*PreloadFontWin)(const void* logfontw);
-  PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect);
-  int32_t (*InvokePrinting)(PP_Instance instance);
-  void (*UpdateActivity)(PP_Instance instance);
-  struct PP_Var (*GetDeviceID)(PP_Instance instance);
-  int32_t (*GetSettingInt)(PP_Instance instance, PP_FlashSetting setting);
-};
+typedef struct PPB_Flash_13_0 PPB_Flash;
 
 struct PPB_Flash_12_4 {
   void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
-  PP_Bool (*DrawGlyphs)(PP_Instance instance,
-                        PP_Resource pp_image_data,
-                        const struct PP_FontDescription_Dev* font_desc,
-                        uint32_t color,
-                        const struct PP_Point* position,
-                        const struct PP_Rect* clip,
-                        const float transformation[3][3],
-                        PP_Bool allow_subpixel_aa,
-                        uint32_t glyph_count,
-                        const uint16_t glyph_indices[],
-                        const struct PP_Point glyph_advances[]);
+  PP_Bool (*DrawGlyphs)(
+      PP_Instance instance,
+      PP_Resource pp_image_data,
+      const struct PP_BrowserFont_Trusted_Description* font_desc,
+      uint32_t color,
+      const struct PP_Point* position,
+      const struct PP_Rect* clip,
+      const float transformation[3][3],
+      PP_Bool allow_subpixel_aa,
+      uint32_t glyph_count,
+      const uint16_t glyph_indices[],
+      const struct PP_Point glyph_advances[]);
   struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
   int32_t (*Navigate)(PP_Resource request_info,
                       const char* target,
@@ -393,17 +266,18 @@
 
 struct PPB_Flash_12_5 {
   void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
-  PP_Bool (*DrawGlyphs)(PP_Instance instance,
-                        PP_Resource pp_image_data,
-                        const struct PP_FontDescription_Dev* font_desc,
-                        uint32_t color,
-                        const struct PP_Point* position,
-                        const struct PP_Rect* clip,
-                        const float transformation[3][3],
-                        PP_Bool allow_subpixel_aa,
-                        uint32_t glyph_count,
-                        const uint16_t glyph_indices[],
-                        const struct PP_Point glyph_advances[]);
+  PP_Bool (*DrawGlyphs)(
+      PP_Instance instance,
+      PP_Resource pp_image_data,
+      const struct PP_BrowserFont_Trusted_Description* font_desc,
+      uint32_t color,
+      const struct PP_Point* position,
+      const struct PP_Rect* clip,
+      const float transformation[3][3],
+      PP_Bool allow_subpixel_aa,
+      uint32_t glyph_count,
+      const uint16_t glyph_indices[],
+      const struct PP_Point glyph_advances[]);
   struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
   int32_t (*Navigate)(PP_Resource request_info,
                       const char* target,
@@ -423,6 +297,43 @@
                           PP_FlashCrashKey key,
                           struct PP_Var value);
 };
+
+struct PPB_Flash_12_6 {
+  void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
+  PP_Bool (*DrawGlyphs)(
+      PP_Instance instance,
+      PP_Resource pp_image_data,
+      const struct PP_BrowserFont_Trusted_Description* font_desc,
+      uint32_t color,
+      const struct PP_Point* position,
+      const struct PP_Rect* clip,
+      const float transformation[3][3],
+      PP_Bool allow_subpixel_aa,
+      uint32_t glyph_count,
+      const uint16_t glyph_indices[],
+      const struct PP_Point glyph_advances[]);
+  struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
+  int32_t (*Navigate)(PP_Resource request_info,
+                      const char* target,
+                      PP_Bool from_user_action);
+  void (*RunMessageLoop)(PP_Instance instance);
+  void (*QuitMessageLoop)(PP_Instance instance);
+  double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t);
+  struct PP_Var (*GetCommandLineArgs)(PP_Module module);
+  void (*PreloadFontWin)(const void* logfontw);
+  PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect);
+  int32_t (*InvokePrinting)(PP_Instance instance);
+  void (*UpdateActivity)(PP_Instance instance);
+  struct PP_Var (*GetDeviceID)(PP_Instance instance);
+  int32_t (*GetSettingInt)(PP_Instance instance, PP_FlashSetting setting);
+  struct PP_Var (*GetSetting)(PP_Instance instance, PP_FlashSetting setting);
+  PP_Bool (*SetCrashData)(PP_Instance instance,
+                          PP_FlashCrashKey key,
+                          struct PP_Var value);
+  int32_t (*EnumerateVideoCaptureDevices)(PP_Instance instance,
+                                          PP_Resource video_capture,
+                                          struct PP_ArrayOutput devices);
+};
 /**
  * @}
  */
diff --git a/ppapi/c/private/ppb_flash_file.h b/ppapi/c/private/ppb_flash_file.h
index 758056f..1473d45 100644
--- a/ppapi/c/private/ppb_flash_file.h
+++ b/ppapi/c/private/ppb_flash_file.h
@@ -23,7 +23,6 @@
 };
 
 // PPB_Flash_File_ModuleLocal --------------------------------------------------
-#define PPB_FLASH_FILE_MODULELOCAL_INTERFACE_2_0 "PPB_Flash_File_ModuleLocal;2"
 #define PPB_FLASH_FILE_MODULELOCAL_INTERFACE_3_0 "PPB_Flash_File_ModuleLocal;3"
 #define PPB_FLASH_FILE_MODULELOCAL_INTERFACE \
     PPB_FLASH_FILE_MODULELOCAL_INTERFACE_3_0
@@ -32,18 +31,9 @@
 // Module-local file paths are '/'-separated UTF-8 strings, relative to a
 // module-specific root.
 struct PPB_Flash_File_ModuleLocal_3_0 {
-  // Does initialization necessary for proxying this interface on background
-  // threads. You must always call this function before using any other
-  // function in this interface for a given instance ID.
-  //
-  // Returns true if multithreaded access is supported. In this case you can
-  // use the rest of the functions from background threads. You may not call
-  // GetInterface or do any other PPAPI operations on background threads at
-  // this time.
+  // Deprecated. Returns true.
   bool (*CreateThreadAdapterForInstance)(PP_Instance instance);
-
-  // Call when an instance is destroyed when you've previously called
-  // CreateThreadAdapterForInstance.
+  // Deprecated. Does nothing.
   void (*ClearThreadAdapterForInstance)(PP_Instance instance);
 
   // Opens a file, returning a file descriptor (posix) or a HANDLE (win32) into
@@ -99,30 +89,6 @@
   int32_t (*CreateTemporaryFile)(PP_Instance instance, PP_FileHandle* file);
 };
 
-struct PPB_Flash_File_ModuleLocal_2_0 {
-  bool (*CreateThreadAdapterForInstance)(PP_Instance instance);
-  void (*ClearThreadAdapterForInstance)(PP_Instance instance);
-  int32_t (*OpenFile)(PP_Instance instance,
-                      const char* path,
-                      int32_t mode,
-                      PP_FileHandle* file);
-  int32_t (*RenameFile)(PP_Instance instance,
-                        const char* path_from,
-                        const char* path_to);
-  int32_t (*DeleteFileOrDir)(PP_Instance instance,
-                             const char* path,
-                             PP_Bool recursive);
-  int32_t (*CreateDir)(PP_Instance instance, const char* path);
-  int32_t (*QueryFile)(PP_Instance instance,
-                       const char* path,
-                       struct PP_FileInfo* info);
-  int32_t (*GetDirContents)(PP_Instance instance,
-                            const char* path,
-                            struct PP_DirContents_Dev** contents);
-  void (*FreeDirContents)(PP_Instance instance,
-                          struct PP_DirContents_Dev* contents);
-};
-
 typedef struct PPB_Flash_File_ModuleLocal_3_0 PPB_Flash_File_ModuleLocal;
 
 // PPB_Flash_File_FileRef ------------------------------------------------------
diff --git a/ppapi/c/private/ppb_flash_font_file.h b/ppapi/c/private/ppb_flash_font_file.h
index 53bbfda..f50818e 100644
--- a/ppapi/c/private/ppb_flash_font_file.h
+++ b/ppapi/c/private/ppb_flash_font_file.h
@@ -3,12 +3,11 @@
  * found in the LICENSE file.
  */
 
-/* From private/ppb_flash_font_file.idl modified Mon Oct 08 10:46:09 2012. */
+/* From private/ppb_flash_font_file.idl modified Thu Dec 13 10:56:15 2012. */
 
 #ifndef PPAPI_C_PRIVATE_PPB_FLASH_FONT_FILE_H_
 #define PPAPI_C_PRIVATE_PPB_FLASH_FONT_FILE_H_
 
-#include "ppapi/c/dev/ppb_font_dev.h"
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_macros.h"
@@ -16,6 +15,7 @@
 #include "ppapi/c/pp_stdint.h"
 #include "ppapi/c/pp_var.h"
 #include "ppapi/c/private/pp_private_font_charset.h"
+#include "ppapi/c/trusted/ppb_browser_font_trusted.h"
 
 #define PPB_FLASH_FONTFILE_INTERFACE_0_1 "PPB_Flash_FontFile;0.1"
 #define PPB_FLASH_FONTFILE_INTERFACE PPB_FLASH_FONTFILE_INTERFACE_0_1
@@ -34,9 +34,10 @@
   /* Returns a resource identifying a font file corresponding to the given font
    * request after applying the browser-specific fallback.
    */
-  PP_Resource (*Create)(PP_Instance instance,
-                        const struct PP_FontDescription_Dev* description,
-                        PP_PrivateFontCharset charset);
+  PP_Resource (*Create)(
+      PP_Instance instance,
+      const struct PP_BrowserFont_Trusted_Description* description,
+      PP_PrivateFontCharset charset);
   /* Determines if a given resource is Flash font file.
    */
   PP_Bool (*IsFlashFontFile)(PP_Resource resource);
diff --git a/ppapi/c/private/ppb_flash_menu.h b/ppapi/c/private/ppb_flash_menu.h
index fbdaa12..0b32478 100644
--- a/ppapi/c/private/ppb_flash_menu.h
+++ b/ppapi/c/private/ppb_flash_menu.h
@@ -1,29 +1,57 @@
-// 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.
+/* 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.
+ */
+
+/* From private/ppb_flash_menu.idl modified Tue Dec 11 13:47:09 2012. */
 
 #ifndef PPAPI_C_PRIVATE_PPB_FLASH_MENU_H_
 #define PPAPI_C_PRIVATE_PPB_FLASH_MENU_H_
 
 #include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
 #include "ppapi/c/pp_point.h"
 #include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_stdint.h"
+
+/* Struct prototypes */
+struct PP_Flash_Menu;
 
 #define PPB_FLASH_MENU_INTERFACE_0_2 "PPB_Flash_Menu;0.2"
 #define PPB_FLASH_MENU_INTERFACE PPB_FLASH_MENU_INTERFACE_0_2
 
-struct PP_CompletionCallback;
+/**
+ * @file
+ * This file defines the <code>PPB_Flash_Menu</code> interface.
+ */
 
+
+/**
+ * @addtogroup Enums
+ * @{
+ */
+/* Menu item type.
+ *
+ * TODO(viettrungluu): Radio items not supported yet. Will also probably want
+ * special menu items tied to clipboard access.
+ */
 typedef enum {
-  // TODO(viettrungluu): Radio items not supported yet. Will also probably want
-  // special menu items tied to clipboard access.
   PP_FLASH_MENUITEM_TYPE_NORMAL = 0,
-  PP_FLASH_MENUITEM_TYPE_CHECKBOX,
-  PP_FLASH_MENUITEM_TYPE_SEPARATOR,
-  PP_FLASH_MENUITEM_TYPE_SUBMENU
+  PP_FLASH_MENUITEM_TYPE_CHECKBOX = 1,
+  PP_FLASH_MENUITEM_TYPE_SEPARATOR = 2,
+  PP_FLASH_MENUITEM_TYPE_SUBMENU = 3
 } PP_Flash_MenuItem_Type;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_MenuItem_Type, 4);
+/**
+ * @}
+ */
 
+/**
+ * @addtogroup Structs
+ * @{
+ */
 struct PP_Flash_MenuItem {
   PP_Flash_MenuItem_Type type;
   char* name;
@@ -35,18 +63,25 @@
 
 struct PP_Flash_Menu {
   uint32_t count;
-  struct PP_Flash_MenuItem* items;
+  struct PP_Flash_MenuItem *items;
 };
+/**
+ * @}
+ */
 
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
 struct PPB_Flash_Menu_0_2 {
   PP_Resource (*Create)(PP_Instance instance_id,
                         const struct PP_Flash_Menu* menu_data);
   PP_Bool (*IsFlashMenu)(PP_Resource resource_id);
-
-  // Display a context menu at the given location. If the user selects an item,
-  // |selected_id| will be set to its |id| and the callback called with |PP_OK|.
-  // If the user dismisses the menu without selecting an item,
-  // |PP_ERROR_USERCANCEL| will be indicated.
+  /* Display a context menu at the given location. If the user selects an item,
+   * |selected_id| will be set to its |id| and the callback called with |PP_OK|.
+   * If the user dismisses the menu without selecting an item,
+   * |PP_ERROR_USERCANCEL| will be indicated.
+   */
   int32_t (*Show)(PP_Resource menu_id,
                   const struct PP_Point* location,
                   int32_t* selected_id,
@@ -54,5 +89,9 @@
 };
 
 typedef struct PPB_Flash_Menu_0_2 PPB_Flash_Menu;
+/**
+ * @}
+ */
 
-#endif  // PPAPI_C_PRIVATE_PPB_FLASH_MENU_H_
+#endif  /* PPAPI_C_PRIVATE_PPB_FLASH_MENU_H_ */
+
diff --git a/ppapi/c/private/ppb_gpu_blacklist_private.h b/ppapi/c/private/ppb_gpu_blacklist_private.h
index ded56be..f37106e 100644
--- a/ppapi/c/private/ppb_gpu_blacklist_private.h
+++ b/ppapi/c/private/ppb_gpu_blacklist_private.h
@@ -4,7 +4,7 @@
  */
 
 /* From private/ppb_gpu_blacklist_private.idl,
- *   modified Wed Oct 10 15:34:44 2012.
+ *   modified Wed Oct 24 14:41:20 2012.
  */
 
 #ifndef PPAPI_C_PRIVATE_PPB_GPU_BLACKLIST_PRIVATE_H_
@@ -37,7 +37,7 @@
    * expose the 3D interfaces if the 3D support is software-emulated. When the
    * SRPC proxy is removed, this interface can also be removed.
    */
-  PP_Bool (*IsGpuBlacklisted)();
+  PP_Bool (*IsGpuBlacklisted)(void);
 };
 
 typedef struct PPB_GpuBlacklist_Private_0_2 PPB_GpuBlacklist_Private;
diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h
index 2e4d563..b73de17 100644
--- a/ppapi/c/private/ppb_nacl_private.h
+++ b/ppapi/c/private/ppb_nacl_private.h
@@ -1,83 +1,138 @@
-// 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.
+/* 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 PPAPI_C_PRIVATE_PPB_NACL_UTIL_PRIVATE_H_
-#define PPAPI_C_PRIVATE_PPB_NACL_UTIL_PRIVATE_H_
+/* From private/ppb_nacl_private.idl modified Thu Jan 10 15:59:03 2013. */
+
+#ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
+#define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
 
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_macros.h"
 #include "ppapi/c/pp_stdint.h"
+
+#define PPB_NACL_PRIVATE_INTERFACE_1_0 "PPB_NaCl_Private;1.0"
+#define PPB_NACL_PRIVATE_INTERFACE PPB_NACL_PRIVATE_INTERFACE_1_0
+
+/**
+ * @file
+ * This file contains NaCl private interfaces. */
+
+
 #include "ppapi/c/private/pp_file_handle.h"
 
-#define PPB_NACL_PRIVATE_INTERFACE "PPB_NaCl(Private);0.9"
+/**
+ * @addtogroup Enums
+ * @{
+ */
+/**
+ * The <code>PP_NaClResult</code> enum contains NaCl result codes.
+ */
+typedef enum {
+  /** Successful NaCl call */
+  PP_NACL_OK = 0,
+  /** Unspecified NaCl error */
+  PP_NACL_FAILED = 1,
+  /** Error creating the module */
+  PP_NACL_ERROR_MODULE = 2,
+  /** Error creating and initializing the instance */
+  PP_NACL_ERROR_INSTANCE = 3
+} PP_NaClResult;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NaClResult, 4);
 
-struct PPB_NaCl_Private {
-  // This function launches NaCl's sel_ldr process.  On success, the function
-  // returns true, otherwise it returns false.  When it returns true, it will
-  // write |socket_count| nacl::Handles to imc_handles.  The |enable_ppapi_dev|
-  // parameter controls whether GetInterfaces returns 'Dev' interfaces to the
-  // NaCl plugin.
-  //
-  // Unless EnableBackgroundSelLdrLaunch is called, this method must be invoked
-  // from the main thread.
-  PP_Bool (*LaunchSelLdr)(PP_Instance instance,
-                          const char* alleged_url,
-                          bool enable_ppapi_dev,
-                          int socket_count,
-                          void* imc_handles);
+/** NaCl-specific errors that should be reported to the user */
+typedef enum {
+  /**
+   *  The manifest program element does not contain a program usable on the
+   *  user's architecture
+   */
+  PP_NACL_MANIFEST_MISSING_ARCH = 0
+} PP_NaClError;
+/**
+ * @}
+ */
 
-  // This function starts the IPC proxy so the nexe can communicate with the
-  // browser. Returns an error code from pp_errors.h. PP_ERROR_NOTSUPPORTED
-  // signals the plugin to use the SRPC proxy. PP_OK indicates the proxy started
-  // successfully. Any other error indicates the proxy couldn't be started.
-  int32_t (*StartPpapiProxy)(PP_Instance instance);
-
-  // On POSIX systems, this function returns the file descriptor of
-  // /dev/urandom.  On non-POSIX systems, this function returns 0.
-  int (*UrandomFD)(void);
-
-  // Whether the Pepper 3D interfaces should be disabled in the NaCl PPAPI
-  // proxy. This is so paranoid admins can effectively prevent untrusted shader
-  // code to be processed by the graphics stack.
-  bool (*Are3DInterfacesDisabled)();
-
-  // Enables the creation of sel_ldr processes from other than the main thread.
-  void (*EnableBackgroundSelLdrLaunch)();
-
-  // This is Windows-specific.  This is a replacement for
-  // DuplicateHandle() for use inside the Windows sandbox.  Note that
-  // we provide this via dependency injection only to avoid the
-  // linkage problems that occur because the NaCl plugin is built as a
-  // separate DLL/DSO (see
-  // http://code.google.com/p/chromium/issues/detail?id=114439#c8).
-  // We use void* rather than the Windows HANDLE type to avoid an
-  // #ifdef here.  We use int rather than PP_Bool/bool so that this is
-  // usable with NaClSetBrokerDuplicateHandleFunc() without further
-  // wrapping.
-  int (*BrokerDuplicateHandle)(void* source_handle,
-                               uint32_t process_id,
-                               void** target_handle,
-                               uint32_t desired_access,
-                               uint32_t options);
-
-  // Returns a read-only file descriptor of a file rooted in the Pnacl
-  // component directory, or -1 on error.
-  // Do we want this to take a completion callback and be async, or
-  // or could we make this happen on another thread?
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/* PPB_NaCl_Private */
+struct PPB_NaCl_Private_1_0 {
+  /* Launches NaCl's sel_ldr process.  Returns PP_NACL_OK on success and
+   * writes a NaClHandle to imc_handle. Returns PP_NACL_FAILED on failure.
+   * The |enable_ppapi_dev| parameter controls whether GetInterface
+   * returns 'Dev' interfaces to the NaCl plugin.  The |uses_ppapi| flag
+   * indicates that the nexe run by sel_ldr will use the PPAPI APIs.
+   * This implies that LaunchSelLdr is run from the main thread.  If a nexe
+   * does not need PPAPI, then it can run off the main thread.
+   * The |uses_irt| flag indicates whether the IRT should be loaded in this
+   * NaCl process.  This is true for ABI stable nexes.
+   */
+  PP_NaClResult (*LaunchSelLdr)(PP_Instance instance,
+                                const char* alleged_url,
+                                PP_Bool uses_irt,
+                                PP_Bool uses_ppapi,
+                                PP_Bool enable_ppapi_dev,
+                                void* imc_handle);
+  /* This function starts the IPC proxy so the nexe can communicate with the
+   * browser. Returns PP_NACL_OK on success, otherwise a result code indicating
+   * the failure. PP_NACL_FAILED is returned if LaunchSelLdr wasn't called with
+   * the instance. PP_NACL_ERROR_MODULE is returned if the module can't be
+   * initialized. PP_NACL_ERROR_INSTANCE is returned if the instance can't be
+   * initialized. PP_NACL_USE_SRPC is returned if the plugin should use SRPC.
+   */
+  PP_NaClResult (*StartPpapiProxy)(PP_Instance instance);
+  /* On POSIX systems, this function returns the file descriptor of
+   * /dev/urandom.  On non-POSIX systems, this function returns 0.
+   */
+  int32_t (*UrandomFD)(void);
+  /* Whether the Pepper 3D interfaces should be disabled in the NaCl PPAPI
+   * proxy. This is so paranoid admins can effectively prevent untrusted shader
+   * code to be processed by the graphics stack.
+   */
+  PP_Bool (*Are3DInterfacesDisabled)(void);
+  /* Enables the creation of sel_ldr processes off of the main thread.
+   */
+  void (*EnableBackgroundSelLdrLaunch)(void);
+  /* This is Windows-specific.  This is a replacement for DuplicateHandle() for
+   * use inside the Windows sandbox.  Note that we provide this via dependency
+   * injection only to avoid the linkage problems that occur because the NaCl
+   * plugin is built as a separate DLL/DSO
+   * (see http://code.google.com/p/chromium/issues/detail?id=114439#c8).
+   */
+  int32_t (*BrokerDuplicateHandle)(PP_FileHandle source_handle,
+                                   uint32_t process_id,
+                                   PP_FileHandle* target_handle,
+                                   uint32_t desired_access,
+                                   uint32_t options);
+  /* Returns a read-only file descriptor of a file rooted in the Pnacl
+   * component directory, or -1 on error.
+   * Do we want this to take a completion callback and be async, or
+   * could we make this happen on another thread?
+   */
   PP_FileHandle (*GetReadonlyPnaclFd)(const char* filename);
-
-  // This creates a temporary file that will be deleted by the time
-  // the last handle is closed (or earlier on POSIX systems), and
-  // returns a posix handle to that temporary file.
+  /* This creates a temporary file that will be deleted by the time
+   * the last handle is closed (or earlier on POSIX systems), and
+   * returns a posix handle to that temporary file.
+   */
   PP_FileHandle (*CreateTemporaryFile)(PP_Instance instance);
-
-  // Return true if we are off the record.
+  /* Return true if we are off the record.
+   */
   PP_Bool (*IsOffTheRecord)(void);
-
-  // Return true if PNaCl is turned on.
+  /* Return true if PNaCl is turned on.
+   */
   PP_Bool (*IsPnaclEnabled)(void);
+  /* Display a UI message to the user. */
+  PP_NaClResult (*ReportNaClError)(PP_Instance instance,
+                                   PP_NaClError message_id);
 };
 
-#endif  // PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
+typedef struct PPB_NaCl_Private_1_0 PPB_NaCl_Private;
+/**
+ * @}
+ */
+
+#endif  /* PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ */
+
diff --git a/ppapi/c/private/ppb_pdf.h b/ppapi/c/private/ppb_pdf.h
index 86203d1..e9a6d78 100644
--- a/ppapi/c/private/ppb_pdf.h
+++ b/ppapi/c/private/ppb_pdf.h
@@ -133,10 +133,10 @@
   void (*SetContentRestriction)(PP_Instance instance, int restrictions);
 
   // Use UMA so we know average pdf page count.
-  void (*HistogramPDFPageCount)(int count);
+  void (*HistogramPDFPageCount)(PP_Instance instance, int count);
 
   // Notifies the browser that the given action has been performed.
-  void (*UserMetricsRecordAction)(struct PP_Var action);
+  void (*UserMetricsRecordAction)(PP_Instance instance, struct PP_Var action);
 
   // Notifies the browser that the PDF has an unsupported feature.
   void (*HasUnsupportedFeature)(PP_Instance instance);
@@ -147,7 +147,7 @@
   // Invoke Print dialog for plugin.
   void (*Print)(PP_Instance instance);
 
-  PP_Bool(*IsFeatureEnabled)(PP_PDFFeature feature);
+  PP_Bool(*IsFeatureEnabled)(PP_Instance instance, PP_PDFFeature feature);
 
   // Returns a resource image appropriate for a device with |scale| density.
   // Returns 0 (NULL resource) if there is no resource at that scale
diff --git a/ppapi/c/private/ppb_talk_private.h b/ppapi/c/private/ppb_talk_private.h
index 6c51325..5783d8b 100644
--- a/ppapi/c/private/ppb_talk_private.h
+++ b/ppapi/c/private/ppb_talk_private.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From private/ppb_talk_private.idl modified Fri Mar  9 11:03:31 2012. */
+/* From private/ppb_talk_private.idl modified Fri Nov  9 14:42:36 2012. */
 
 #ifndef PPAPI_C_PRIVATE_PPB_TALK_PRIVATE_H_
 #define PPAPI_C_PRIVATE_PPB_TALK_PRIVATE_H_
@@ -38,8 +38,8 @@
   /**
    * Displays security UI.
    *
-   * The callback will be issued with PP_OK as the result of the user gave
-   * permission, or PP_ERROR_NOACCESS if the user denied.
+   * The callback will be issued with 1 as the result if the user gave
+   * permission, or 0 if the user denied.
    *
    * You can only have one call pending. It will return PP_OK_COMPLETIONPENDING
    * if the request is queued, or PP_ERROR_INPROGRESS if there is already a
diff --git a/ppapi/c/private/ppb_tcp_socket_private.h b/ppapi/c/private/ppb_tcp_socket_private.h
index 7d6ca46..6aad467 100644
--- a/ppapi/c/private/ppb_tcp_socket_private.h
+++ b/ppapi/c/private/ppb_tcp_socket_private.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From private/ppb_tcp_socket_private.idl modified Fri Apr  6 14:42:45 2012. */
+/* From private/ppb_tcp_socket_private.idl modified Sun Feb 10 00:28:07 2013. */
 
 #ifndef PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_
 #define PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_
@@ -14,11 +14,13 @@
 #include "ppapi/c/pp_macros.h"
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_var.h"
 #include "ppapi/c/private/ppb_net_address_private.h"
 
 #define PPB_TCPSOCKET_PRIVATE_INTERFACE_0_3 "PPB_TCPSocket_Private;0.3"
 #define PPB_TCPSOCKET_PRIVATE_INTERFACE_0_4 "PPB_TCPSocket_Private;0.4"
-#define PPB_TCPSOCKET_PRIVATE_INTERFACE PPB_TCPSOCKET_PRIVATE_INTERFACE_0_4
+#define PPB_TCPSOCKET_PRIVATE_INTERFACE_0_5 "PPB_TCPSocket_Private;0.5"
+#define PPB_TCPSOCKET_PRIVATE_INTERFACE PPB_TCPSOCKET_PRIVATE_INTERFACE_0_5
 
 /**
  * @file
@@ -27,6 +29,23 @@
 
 
 /**
+ * @addtogroup Enums
+ * @{
+ */
+typedef enum {
+  /* Special value used for testing. Guaranteed to fail SetOption(). */
+  PP_TCPSOCKETOPTION_INVALID = 0,
+  /* Disable coalescing of small writes to make TCP segments, and instead
+   * deliver data immediately. For SSL sockets, this option must be set before
+   * SSLHandshake() is called. Value type is PP_VARTYPE_BOOL. */
+  PP_TCPSOCKETOPTION_NO_DELAY = 1
+} PP_TCPSocketOption_Private;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocketOption_Private, 4);
+/**
+ * @}
+ */
+
+/**
  * @addtogroup Interfaces
  * @{
  */
@@ -34,7 +53,7 @@
  * The <code>PPB_TCPSocket_Private</code> interface provides TCP socket
  * operations.
  */
-struct PPB_TCPSocket_Private_0_4 {
+struct PPB_TCPSocket_Private_0_5 {
   /**
    * Allocates a TCP socket resource.
    */
@@ -139,9 +158,19 @@
    * method.
    */
   void (*Disconnect)(PP_Resource tcp_socket);
+  /**
+   * Sets an option on |tcp_socket|.  Supported |name| and |value| parameters
+   * are as described for PP_TCPSocketOption_Private.  |callback| will be
+   * invoked with PP_OK if setting the option succeeds, or an error code
+   * otherwise. The socket must be connection before SetOption is called.
+   */
+  int32_t (*SetOption)(PP_Resource tcp_socket,
+                       PP_TCPSocketOption_Private name,
+                       struct PP_Var value,
+                       struct PP_CompletionCallback callback);
 };
 
-typedef struct PPB_TCPSocket_Private_0_4 PPB_TCPSocket_Private;
+typedef struct PPB_TCPSocket_Private_0_5 PPB_TCPSocket_Private;
 
 struct PPB_TCPSocket_Private_0_3 {
   PP_Resource (*Create)(PP_Instance instance);
@@ -171,6 +200,39 @@
                    struct PP_CompletionCallback callback);
   void (*Disconnect)(PP_Resource tcp_socket);
 };
+
+struct PPB_TCPSocket_Private_0_4 {
+  PP_Resource (*Create)(PP_Instance instance);
+  PP_Bool (*IsTCPSocket)(PP_Resource resource);
+  int32_t (*Connect)(PP_Resource tcp_socket,
+                     const char* host,
+                     uint16_t port,
+                     struct PP_CompletionCallback callback);
+  int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket,
+                                   const struct PP_NetAddress_Private* addr,
+                                   struct PP_CompletionCallback callback);
+  PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket,
+                             struct PP_NetAddress_Private* local_addr);
+  PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket,
+                              struct PP_NetAddress_Private* remote_addr);
+  int32_t (*SSLHandshake)(PP_Resource tcp_socket,
+                          const char* server_name,
+                          uint16_t server_port,
+                          struct PP_CompletionCallback callback);
+  PP_Resource (*GetServerCertificate)(PP_Resource tcp_socket);
+  PP_Bool (*AddChainBuildingCertificate)(PP_Resource tcp_socket,
+                                         PP_Resource certificate,
+                                         PP_Bool is_trusted);
+  int32_t (*Read)(PP_Resource tcp_socket,
+                  char* buffer,
+                  int32_t bytes_to_read,
+                  struct PP_CompletionCallback callback);
+  int32_t (*Write)(PP_Resource tcp_socket,
+                   const char* buffer,
+                   int32_t bytes_to_write,
+                   struct PP_CompletionCallback callback);
+  void (*Disconnect)(PP_Resource tcp_socket);
+};
 /**
  * @}
  */
diff --git a/ppapi/c/trusted/ppb_broker_trusted.h b/ppapi/c/trusted/ppb_broker_trusted.h
index 44b6118..019e2e9 100644
--- a/ppapi/c/trusted/ppb_broker_trusted.h
+++ b/ppapi/c/trusted/ppb_broker_trusted.h
@@ -3,7 +3,7 @@
  * found in the LICENSE file.
  */
 
-/* From trusted/ppb_broker_trusted.idl modified Wed Oct  5 14:06:02 2011. */
+/* From trusted/ppb_broker_trusted.idl modified Mon Dec  3 11:10:40 2012. */
 
 #ifndef PPAPI_C_TRUSTED_PPB_BROKER_TRUSTED_H_
 #define PPAPI_C_TRUSTED_PPB_BROKER_TRUSTED_H_
@@ -16,7 +16,8 @@
 #include "ppapi/c/pp_stdint.h"
 
 #define PPB_BROKER_TRUSTED_INTERFACE_0_2 "PPB_BrokerTrusted;0.2"
-#define PPB_BROKER_TRUSTED_INTERFACE PPB_BROKER_TRUSTED_INTERFACE_0_2
+#define PPB_BROKER_TRUSTED_INTERFACE_0_3 "PPB_BrokerTrusted;0.3"
+#define PPB_BROKER_TRUSTED_INTERFACE PPB_BROKER_TRUSTED_INTERFACE_0_3
 
 /**
  * @file
@@ -40,7 +41,7 @@
  * handle is closed. The handle should be closed before the resource is
  * released.
  */
-struct PPB_BrokerTrusted_0_2 {
+struct PPB_BrokerTrusted_0_3 {
   /**
    * Returns a trusted broker resource.
    */
@@ -74,9 +75,26 @@
    * before connect has completed will return PP_ERROR_FAILED.
    */
   int32_t (*GetHandle)(PP_Resource broker, int32_t* handle);
+  /**
+   * Returns PP_TRUE if the plugin has permission to launch the broker. A user
+   * must explicitly grant permission to launch the broker for a particular
+   * website. This is done through an infobar that is displayed when |Connect|
+   * is called. This function returns PP_TRUE if the user has already granted
+   * permission to launch the broker for the website containing this plugin
+   * instance. Returns PP_FALSE otherwise.
+   */
+  PP_Bool (*IsAllowed)(PP_Resource broker);
 };
 
-typedef struct PPB_BrokerTrusted_0_2 PPB_BrokerTrusted;
+typedef struct PPB_BrokerTrusted_0_3 PPB_BrokerTrusted;
+
+struct PPB_BrokerTrusted_0_2 {
+  PP_Resource (*CreateTrusted)(PP_Instance instance);
+  PP_Bool (*IsBrokerTrusted)(PP_Resource resource);
+  int32_t (*Connect)(PP_Resource broker,
+                     struct PP_CompletionCallback connect_callback);
+  int32_t (*GetHandle)(PP_Resource broker, int32_t* handle);
+};
 /**
  * @}
  */
diff --git a/ppapi/c/trusted/ppb_graphics_3d_trusted.h b/ppapi/c/trusted/ppb_graphics_3d_trusted.h
index 099ffdc..4f1497b 100644
--- a/ppapi/c/trusted/ppb_graphics_3d_trusted.h
+++ b/ppapi/c/trusted/ppb_graphics_3d_trusted.h
@@ -1,20 +1,33 @@
-// 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.
+/* 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.
+ */
+
+/* From trusted/ppb_graphics_3d_trusted.idl,
+ *   modified Mon Nov 26 15:49:46 2012.
+ */
 
 #ifndef PPAPI_C_TRUSTED_PPB_GRAPHICS_3D_TRUSTED_H_
 #define PPAPI_C_TRUSTED_PPB_GRAPHICS_3D_TRUSTED_H_
 
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/c/pp_stdint.h"
 
-#define PPB_GRAPHICS_3D_TRUSTED_INTERFACE_1_0 \
-    "PPB_Graphics3DTrusted;1.0"
-#define PPB_GRAPHICS_3D_TRUSTED_INTERFACE \
-    PPB_GRAPHICS_3D_TRUSTED_INTERFACE_1_0
+#define PPB_GRAPHICS_3D_TRUSTED_INTERFACE_1_0 "PPB_Graphics3DTrusted;1.0"
+#define PPB_GRAPHICS_3D_TRUSTED_INTERFACE PPB_GRAPHICS_3D_TRUSTED_INTERFACE_1_0
 
+/**
+ * @file
+ * Graphics 3D trusted interfaces. */
+
+
+/**
+ * @addtogroup Enums
+ * @{
+ */
 typedef enum {
   PPB_GRAPHICS3D_TRUSTED_ERROR_OK,
   PPB_GRAPHICS3D_TRUSTED_ERROR_GENERICERROR,
@@ -24,81 +37,85 @@
   PPB_GRAPHICS3D_TRUSTED_ERROR_OUTOFBOUNDS,
   PPB_GRAPHICS3D_TRUSTED_ERROR_UNKNOWNCOMMAND
 } PPB_Graphics3DTrustedError;
+/**
+ * @}
+ */
 
+/**
+ * @addtogroup Structs
+ * @{
+ */
 struct PP_Graphics3DTrustedState {
-  // Size of the command buffer in command buffer entries.
+  /* Size of the command buffer in command buffer entries. */
   int32_t num_entries;
-
-  // The offset (in entries) from which the reader is reading.
+  /* The offset (in entries) from which the reader is reading. */
   int32_t get_offset;
-
-  // The offset (in entries) at which the writer is writing.
+  /* The offset (in entries) at which the writer is writing. */
   int32_t put_offset;
-
-  // The current token value. This is used by the writer to defer
-  // changes to shared memory objects until the reader has reached a certain
-  // point in the command buffer. The reader is responsible for updating the
-  // token value, for example in response to an asynchronous set token command
-  // embedded in the command buffer. The default token value is zero.
+  /* The current token value. This is used by the writer to defer
+   * changes to shared memory objects until the reader has reached a certain
+   * point in the command buffer. The reader is responsible for updating the
+   * token value, for example in response to an asynchronous set token command
+   * embedded in the command buffer. The default token value is zero. */
   int32_t token;
-
-  // Error status.
+  /* Error status. */
   PPB_Graphics3DTrustedError error;
-
-  // Generation index of this state. The generation index is incremented every
-  // time a new state is retrieved from the command processor, so that
-  // consistency can be kept even if IPC messages are processed out-of-order.
+  /* Generation index of this state. The generation index is incremented every
+   * time a new state is retrieved from the command processor, so that
+   * consistency can be kept even if IPC messages are processed out-of-order. */
   uint32_t generation;
 };
+/**
+ * @}
+ */
 
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
 struct PPB_Graphics3DTrusted_1_0 {
-  // Creates a raw Graphics3D resource. A raw Graphics3D is intended to be used
-  // with the trusted interface, through the command buffer (for proxying).
+  /* Creates a raw Graphics3D resource. A raw Graphics3D is intended to be used
+   * with the trusted interface, through the command buffer (for proxying). */
   PP_Resource (*CreateRaw)(PP_Instance instance_id,
                            PP_Resource share_context,
-                           const int32_t* attrib_list);
-
-  // Initializes the command buffer with the given size.
+                           const int32_t attrib_list[]);
+  /* Initializes the command buffer with the given size. */
   PP_Bool (*InitCommandBuffer)(PP_Resource context_id);
-
-  // Sets the buffer used for commands.
+  /* Sets the buffer used for commands. */
   PP_Bool (*SetGetBuffer)(PP_Resource context, int32_t transfer_buffer_id);
-
-  // Returns the current state.
+  /* Returns the current state. */
   struct PP_Graphics3DTrustedState (*GetState)(PP_Resource context);
-
-  // Create a transfer buffer and return a handle that uniquely
-  // identifies it or -1 on error.
+  /* Create a transfer buffer and return a handle that uniquely
+   * identifies it or -1 on error. */
   int32_t (*CreateTransferBuffer)(PP_Resource context, uint32_t size);
-
-  // Destroy a transfer buffer and recycle the handle.
+  /* Destroy a transfer buffer and recycle the handle. */
   PP_Bool (*DestroyTransferBuffer)(PP_Resource context, int32_t id);
-
-  // Get the transfer buffer associated with a handle.
+  /* Get the transfer buffer associated with a handle. */
   PP_Bool (*GetTransferBuffer)(PP_Resource context,
                                int32_t id,
                                int* shm_handle,
                                uint32_t* shm_size);
-
-  // The writer calls this to update its put offset.
+  /* The writer calls this to update its put offset. */
   PP_Bool (*Flush)(PP_Resource context, int32_t put_offset);
-
-  // The writer calls this to update its put offset. This function returns the
-  // reader's most recent get offset. Does not return until after the put offset
-  // change callback has been invoked.
-  // Note: This function remains for backwards compatibility; FlushSyncFast
-  // is now the preferred way to sync.
+  /* The writer calls this to update its put offset. This function returns the
+   * reader's most recent get offset. Does not return until after the put offset
+   * change callback has been invoked.
+   * Note: This function remains for backwards compatibility; FlushSyncFast
+   * is now the preferred way to sync. */
   struct PP_Graphics3DTrustedState (*FlushSync)(PP_Resource context,
                                                 int32_t put_offset);
-
-  // Like FlushSync, but returns before processing commands if the get offset is
-  // different than last_known_get. Allows synchronization with the command
-  // processor without forcing immediate command execution.
+  /* Like FlushSync, but returns before processing commands if the get offset is
+   * different than last_known_get. Allows synchronization with the command
+   * processor without forcing immediate command execution. */
   struct PP_Graphics3DTrustedState (*FlushSyncFast)(PP_Resource context,
                                                     int32_t put_offset,
                                                     int32_t last_known_get);
 };
 
 typedef struct PPB_Graphics3DTrusted_1_0 PPB_Graphics3DTrusted;
+/**
+ * @}
+ */
 
-#endif  // PPAPI_C_TRUSTED_PPB_GRAPHICS_3D_TRUSTED_H_
+#endif  /* PPAPI_C_TRUSTED_PPB_GRAPHICS_3D_TRUSTED_H_ */
+
diff --git a/ppapi/cpp/array_output.h b/ppapi/cpp/array_output.h
index 57fa790..3a52190 100644
--- a/ppapi/cpp/array_output.h
+++ b/ppapi/cpp/array_output.h
@@ -7,8 +7,10 @@
 
 #include <vector>
 
+#include "ppapi/c/dev/ppb_directory_reader_dev.h"
 #include "ppapi/c/pp_array_output.h"
 #include "ppapi/c/pp_resource.h"
+#include "ppapi/cpp/dev/directory_entry_dev.h"
 #include "ppapi/cpp/logging.h"
 #include "ppapi/cpp/pass_ref.h"
 #include "ppapi/cpp/var.h"
@@ -176,7 +178,7 @@
 class ArrayOutputAdapterWithStorage : public ArrayOutputAdapter<T> {
  public:
   ArrayOutputAdapterWithStorage() {
-    set_output(&output_storage_);
+    this->set_output(&output_storage_);
   }
 
   std::vector<T>& output() { return output_storage_; }
@@ -267,6 +269,47 @@
   std::vector<T> output_storage_;
 };
 
+class DirectoryEntryArrayOutputAdapterWithStorage
+    : public ArrayOutputAdapter<PP_DirectoryEntry_Dev> {
+ public:
+  DirectoryEntryArrayOutputAdapterWithStorage() {
+    set_output(&temp_storage_);
+  };
+
+  virtual ~DirectoryEntryArrayOutputAdapterWithStorage() {
+    if (!temp_storage_.empty()) {
+      // An easy way to release the resource references held by |temp_storage_|.
+      // A destructor for PP_DirectoryEntry_Dev will release them.
+      output();
+    }
+  };
+
+  // Returns the final array of resource objects, converting the
+  // PP_DirectoryEntry_Dev written by the browser to pp::DirectoryEntry_Dev
+  // objects.
+  //
+  // This function should only be called once or we would end up converting
+  // the array more than once, which would mess up the refcounting.
+  std::vector<pp::DirectoryEntry_Dev>& output() {
+    PP_DCHECK(output_storage_.empty());
+    typedef std::vector<PP_DirectoryEntry_Dev> Entries;
+    for (Entries::iterator it = temp_storage_.begin();
+         it != temp_storage_.end(); ++it)
+      output_storage_.push_back(DirectoryEntry_Dev(PASS_REF, *it));
+    temp_storage_.clear();
+    return output_storage_;
+  }
+
+ private:
+  // The browser will write the PP_DirectoryEntry_Devs into this array.
+  std::vector<PP_DirectoryEntry_Dev> temp_storage_;
+
+  // When asked for the output, the PP_DirectoryEntry_Devs above will be
+  // converted to the pp::DirectoryEntry_Devs in this array for passing to the
+  // calling code.
+  std::vector<pp::DirectoryEntry_Dev> output_storage_;
+};
+
 }  // namespace pp
 
 #endif  // PPAPI_CPP_ARRAY_OUTPUT_H_
diff --git a/ppapi/cpp/dev/audio_input_dev.cc b/ppapi/cpp/dev/audio_input_dev.cc
index 4c161a1..cc0f08b 100644
--- a/ppapi/cpp/dev/audio_input_dev.cc
+++ b/ppapi/cpp/dev/audio_input_dev.cc
@@ -18,13 +18,20 @@
   return PPB_AUDIO_INPUT_DEV_INTERFACE_0_2;
 }
 
+template <> const char* interface_name<PPB_AudioInput_Dev_0_3>() {
+  return PPB_AUDIO_INPUT_DEV_INTERFACE_0_3;
+}
+
 }  // namespace
 
 AudioInput_Dev::AudioInput_Dev() {
 }
 
 AudioInput_Dev::AudioInput_Dev(const InstanceHandle& instance) {
-  if (has_interface<PPB_AudioInput_Dev_0_2>()) {
+  if (has_interface<PPB_AudioInput_Dev_0_3>()) {
+    PassRefFromConstructor(get_interface<PPB_AudioInput_Dev_0_3>()->Create(
+        instance.pp_instance()));
+  } else if (has_interface<PPB_AudioInput_Dev_0_2>()) {
     PassRefFromConstructor(get_interface<PPB_AudioInput_Dev_0_2>()->Create(
         instance.pp_instance()));
   }
@@ -35,24 +42,42 @@
 
 // static
 bool AudioInput_Dev::IsAvailable() {
-  return has_interface<PPB_AudioInput_Dev_0_2>();
+  return has_interface<PPB_AudioInput_Dev_0_3>() ||
+         has_interface<PPB_AudioInput_Dev_0_2>();
 }
 
 int32_t AudioInput_Dev::EnumerateDevices(
     const CompletionCallbackWithOutput<std::vector<DeviceRef_Dev> >& callback) {
-  if (!has_interface<PPB_AudioInput_Dev_0_2>())
-    return callback.MayForce(PP_ERROR_NOINTERFACE);
-  if (!callback.pp_completion_callback().func)
-    return callback.MayForce(PP_ERROR_BLOCKS_MAIN_THREAD);
+  if (has_interface<PPB_AudioInput_Dev_0_3>()) {
+    return get_interface<PPB_AudioInput_Dev_0_3>()->EnumerateDevices(
+        pp_resource(), callback.output(), callback.pp_completion_callback());
+  }
+  if (has_interface<PPB_AudioInput_Dev_0_2>()) {
+    if (!callback.pp_completion_callback().func)
+      return callback.MayForce(PP_ERROR_BLOCKS_MAIN_THREAD);
 
-  // ArrayOutputCallbackConverter is responsible to delete it.
-  ResourceArray_Dev::ArrayOutputCallbackData* data =
-      new ResourceArray_Dev::ArrayOutputCallbackData(
-          callback.output(), callback.pp_completion_callback());
-  return get_interface<PPB_AudioInput_Dev_0_2>()->EnumerateDevices(
-      pp_resource(), &data->resource_array_output,
-      PP_MakeCompletionCallback(
-          &ResourceArray_Dev::ArrayOutputCallbackConverter, data));
+    // ArrayOutputCallbackConverter is responsible to delete it.
+    ResourceArray_Dev::ArrayOutputCallbackData* data =
+        new ResourceArray_Dev::ArrayOutputCallbackData(
+            callback.output(), callback.pp_completion_callback());
+    return get_interface<PPB_AudioInput_Dev_0_2>()->EnumerateDevices(
+        pp_resource(), &data->resource_array_output,
+        PP_MakeCompletionCallback(
+            &ResourceArray_Dev::ArrayOutputCallbackConverter, data));
+  }
+
+  return callback.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+int32_t AudioInput_Dev::MonitorDeviceChange(
+    PP_MonitorDeviceChangeCallback callback,
+    void* user_data) {
+  if (has_interface<PPB_AudioInput_Dev_0_3>()) {
+    return get_interface<PPB_AudioInput_Dev_0_3>()->MonitorDeviceChange(
+        pp_resource(), callback, user_data);
+  }
+
+  return PP_ERROR_NOINTERFACE;
 }
 
 int32_t AudioInput_Dev::Open(const DeviceRef_Dev& device_ref,
@@ -60,6 +85,11 @@
                              PPB_AudioInput_Callback audio_input_callback,
                              void* user_data,
                              const CompletionCallback& callback) {
+  if (has_interface<PPB_AudioInput_Dev_0_3>()) {
+    return get_interface<PPB_AudioInput_Dev_0_3>()->Open(
+        pp_resource(), device_ref.pp_resource(), config.pp_resource(),
+        audio_input_callback, user_data, callback.pp_completion_callback());
+  }
   if (has_interface<PPB_AudioInput_Dev_0_2>()) {
     return get_interface<PPB_AudioInput_Dev_0_2>()->Open(
         pp_resource(), device_ref.pp_resource(), config.pp_resource(),
@@ -70,6 +100,10 @@
 }
 
 bool AudioInput_Dev::StartCapture() {
+  if (has_interface<PPB_AudioInput_Dev_0_3>()) {
+    return PP_ToBool(get_interface<PPB_AudioInput_Dev_0_3>()->StartCapture(
+        pp_resource()));
+  }
   if (has_interface<PPB_AudioInput_Dev_0_2>()) {
     return PP_ToBool(get_interface<PPB_AudioInput_Dev_0_2>()->StartCapture(
         pp_resource()));
@@ -79,6 +113,10 @@
 }
 
 bool AudioInput_Dev::StopCapture() {
+  if (has_interface<PPB_AudioInput_Dev_0_3>()) {
+    return PP_ToBool(get_interface<PPB_AudioInput_Dev_0_3>()->StopCapture(
+        pp_resource()));
+  }
   if (has_interface<PPB_AudioInput_Dev_0_2>()) {
     return PP_ToBool(get_interface<PPB_AudioInput_Dev_0_2>()->StopCapture(
         pp_resource()));
@@ -88,8 +126,11 @@
 }
 
 void AudioInput_Dev::Close() {
-  if (has_interface<PPB_AudioInput_Dev_0_2>())
+  if (has_interface<PPB_AudioInput_Dev_0_3>()) {
+    get_interface<PPB_AudioInput_Dev_0_3>()->Close(pp_resource());
+  } else if (has_interface<PPB_AudioInput_Dev_0_2>()) {
     get_interface<PPB_AudioInput_Dev_0_2>()->Close(pp_resource());
+  }
 }
 
 }  // namespace pp
diff --git a/ppapi/cpp/dev/audio_input_dev.h b/ppapi/cpp/dev/audio_input_dev.h
index fc336a9..22408cd 100644
--- a/ppapi/cpp/dev/audio_input_dev.h
+++ b/ppapi/cpp/dev/audio_input_dev.h
@@ -37,6 +37,9 @@
       const CompletionCallbackWithOutput<std::vector<DeviceRef_Dev> >&
           callback);
 
+  int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback,
+                              void* user_data);
+
   /// If |device_ref| is null (i.e., is_null() returns true), the default device
   /// will be used.
   int32_t Open(const DeviceRef_Dev& device_ref,
diff --git a/ppapi/cpp/dev/directory_entry_dev.cc b/ppapi/cpp/dev/directory_entry_dev.cc
index 80de22f..bef42c3 100644
--- a/ppapi/cpp/dev/directory_entry_dev.cc
+++ b/ppapi/cpp/dev/directory_entry_dev.cc
@@ -14,6 +14,12 @@
   memset(&data_, 0, sizeof(data_));
 }
 
+DirectoryEntry_Dev::DirectoryEntry_Dev(
+    PassRef, const PP_DirectoryEntry_Dev& data) {
+  data_.file_ref = data.file_ref;
+  data_.file_type = data.file_type;
+}
+
 DirectoryEntry_Dev::DirectoryEntry_Dev(const DirectoryEntry_Dev& other) {
   data_.file_ref = other.data_.file_ref;
   data_.file_type = other.data_.file_type;
diff --git a/ppapi/cpp/dev/directory_entry_dev.h b/ppapi/cpp/dev/directory_entry_dev.h
index 6b91ebf..9866213 100644
--- a/ppapi/cpp/dev/directory_entry_dev.h
+++ b/ppapi/cpp/dev/directory_entry_dev.h
@@ -13,7 +13,9 @@
 class DirectoryEntry_Dev {
  public:
   DirectoryEntry_Dev();
+  DirectoryEntry_Dev(PassRef, const PP_DirectoryEntry_Dev& data);
   DirectoryEntry_Dev(const DirectoryEntry_Dev& other);
+
   ~DirectoryEntry_Dev();
 
   DirectoryEntry_Dev& operator=(const DirectoryEntry_Dev& other);
@@ -28,7 +30,6 @@
   PP_FileType file_type() const { return data_.file_type; }
 
  private:
-  friend class DirectoryReader_Dev;
   PP_DirectoryEntry_Dev data_;
 };
 
diff --git a/ppapi/cpp/dev/directory_reader_dev.cc b/ppapi/cpp/dev/directory_reader_dev.cc
index 3a53ca1..aebdca5 100644
--- a/ppapi/cpp/dev/directory_reader_dev.cc
+++ b/ppapi/cpp/dev/directory_reader_dev.cc
@@ -15,16 +15,16 @@
 
 namespace {
 
-template <> const char* interface_name<PPB_DirectoryReader_Dev>() {
-  return PPB_DIRECTORYREADER_DEV_INTERFACE;
+template <> const char* interface_name<PPB_DirectoryReader_Dev_0_6>() {
+  return PPB_DIRECTORYREADER_DEV_INTERFACE_0_6;
 }
 
 }  // namespace
 
 DirectoryReader_Dev::DirectoryReader_Dev(const FileRef& directory_ref) {
-  if (!has_interface<PPB_DirectoryReader_Dev>())
+  if (!has_interface<PPB_DirectoryReader_Dev_0_6>())
     return;
-  PassRefFromConstructor(get_interface<PPB_DirectoryReader_Dev>()->Create(
+  PassRefFromConstructor(get_interface<PPB_DirectoryReader_Dev_0_6>()->Create(
       directory_ref.pp_resource()));
 }
 
@@ -32,12 +32,13 @@
     : Resource(other) {
 }
 
-int32_t DirectoryReader_Dev::GetNextEntry(DirectoryEntry_Dev* entry,
-                                          const CompletionCallback& cc) {
-  if (!has_interface<PPB_DirectoryReader_Dev>())
-    return cc.MayForce(PP_ERROR_NOINTERFACE);
-  return get_interface<PPB_DirectoryReader_Dev>()->GetNextEntry(
-      pp_resource(), &entry->data_, cc.pp_completion_callback());
+int32_t DirectoryReader_Dev::ReadEntries(
+    const CompletionCallbackWithOutput< std::vector<DirectoryEntry_Dev> >&
+        callback) {
+  if (!has_interface<PPB_DirectoryReader_Dev_0_6>())
+    return callback.MayForce(PP_ERROR_NOINTERFACE);
+  return get_interface<PPB_DirectoryReader_Dev_0_6>()->ReadEntries(
+      pp_resource(), callback.output(), callback.pp_completion_callback());
 }
 
 }  // namespace pp
diff --git a/ppapi/cpp/dev/directory_reader_dev.h b/ppapi/cpp/dev/directory_reader_dev.h
index 09b2e57..cd2ce78 100644
--- a/ppapi/cpp/dev/directory_reader_dev.h
+++ b/ppapi/cpp/dev/directory_reader_dev.h
@@ -5,27 +5,50 @@
 #ifndef PPAPI_CPP_DEV_DIRECTORY_READER_DEV_H_
 #define PPAPI_CPP_DEV_DIRECTORY_READER_DEV_H_
 
-#include <stdlib.h>
+#include <vector>
 
 #include "ppapi/c/dev/ppb_directory_reader_dev.h"
 #include "ppapi/cpp/resource.h"
 
 namespace pp {
 
-class CompletionCallback;
 class DirectoryEntry_Dev;
 class FileRef;
+template<typename T> class CompletionCallbackWithOutput;
 
 class DirectoryReader_Dev : public Resource {
  public:
-  // Creates a DirectoryReader for the given directory.
+  /// A constructor that creates a DirectoryReader resource for the given
+  /// directory.
+  ///
+  /// @param[in] directory_ref A <code>PP_Resource</code> corresponding to the
+  /// directory reference to be read.
   explicit DirectoryReader_Dev(const FileRef& directory_ref);
 
   DirectoryReader_Dev(const DirectoryReader_Dev& other);
 
-  // See PPB_DirectoryReader::GetNextEntry.
-  int32_t GetNextEntry(DirectoryEntry_Dev* entry,
-                       const CompletionCallback& cc);
+  /// ReadEntries() Reads all entries in the directory.
+  ///
+  /// @param[in] cc A <code>CompletionCallbackWithOutput</code> to be called
+  /// upon completion of ReadEntries(). On success, the directory entries will
+  /// be passed to the given function.
+  ///
+  /// Normally you would use a CompletionCallbackFactory to allow callbacks to
+  /// be bound to your class. See completion_callback_factory.h for more
+  /// discussion on how to use this. Your callback will generally look like:
+  ///
+  /// @code
+  ///   void OnReadEntries(int32_t result,
+  ///                      const std::vector<DirectoryEntry_Dev>& entries) {
+  ///     if (result == PP_OK)
+  ///       // use entries...
+  ///   }
+  /// @endcode
+  ///
+  /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
+  int32_t ReadEntries(
+      const CompletionCallbackWithOutput< std::vector<DirectoryEntry_Dev> >&
+          callback);
 };
 
 }  // namespace pp
diff --git a/ppapi/cpp/dev/message_loop_dev.cc b/ppapi/cpp/dev/message_loop_dev.cc
deleted file mode 100644
index cbe589f..0000000
--- a/ppapi/cpp/dev/message_loop_dev.cc
+++ /dev/null
@@ -1,87 +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 "ppapi/cpp/dev/message_loop_dev.h"
-
-#include "ppapi/c/dev/ppb_message_loop_dev.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/cpp/completion_callback.h"
-#include "ppapi/cpp/instance_handle.h"
-#include "ppapi/cpp/module_impl.h"
-
-namespace pp {
-
-namespace {
-
-template <> const char* interface_name<PPB_MessageLoop_Dev>() {
-  return PPB_MESSAGELOOP_DEV_INTERFACE_0_1;
-}
-
-}  // namespace
-
-MessageLoop_Dev::MessageLoop_Dev() : Resource() {
-}
-
-MessageLoop_Dev::MessageLoop_Dev(const InstanceHandle& instance) : Resource() {
-  if (has_interface<PPB_MessageLoop_Dev>()) {
-    PassRefFromConstructor(get_interface<PPB_MessageLoop_Dev>()->Create(
-        instance.pp_instance()));
-  }
-}
-
-MessageLoop_Dev::MessageLoop_Dev(const MessageLoop_Dev& other)
-    : Resource(other) {
-}
-
-MessageLoop_Dev::MessageLoop_Dev(PP_Resource pp_message_loop)
-    : Resource(pp_message_loop) {
-}
-
-// static
-MessageLoop_Dev MessageLoop_Dev::GetForMainThread() {
-  if (!has_interface<PPB_MessageLoop_Dev>())
-    return MessageLoop_Dev();
-  return MessageLoop_Dev(
-      get_interface<PPB_MessageLoop_Dev>()->GetForMainThread());
-}
-
-// static
-MessageLoop_Dev MessageLoop_Dev::GetCurrent() {
-  if (!has_interface<PPB_MessageLoop_Dev>())
-    return MessageLoop_Dev();
-  return MessageLoop_Dev(
-      get_interface<PPB_MessageLoop_Dev>()->GetCurrent());
-}
-
-int32_t MessageLoop_Dev::AttachToCurrentThread() {
-  if (!has_interface<PPB_MessageLoop_Dev>())
-    return PP_ERROR_NOINTERFACE;
-  return get_interface<PPB_MessageLoop_Dev>()->AttachToCurrentThread(
-      pp_resource());
-}
-
-int32_t MessageLoop_Dev::Run() {
-  if (!has_interface<PPB_MessageLoop_Dev>())
-    return PP_ERROR_NOINTERFACE;
-  return get_interface<PPB_MessageLoop_Dev>()->Run(pp_resource());
-}
-
-int32_t MessageLoop_Dev::PostWork(const CompletionCallback& callback,
-                                  int64_t delay_ms) {
-  if (!has_interface<PPB_MessageLoop_Dev>())
-    return PP_ERROR_NOINTERFACE;
-  return get_interface<PPB_MessageLoop_Dev>()->PostWork(
-      pp_resource(),
-      callback.pp_completion_callback(),
-      delay_ms);
-}
-
-int32_t MessageLoop_Dev::PostQuit(bool should_destroy) {
-  if (!has_interface<PPB_MessageLoop_Dev>())
-    return PP_ERROR_NOINTERFACE;
-  return get_interface<PPB_MessageLoop_Dev>()->PostQuit(
-      pp_resource(), PP_FromBool(should_destroy));
-}
-
-}  // namespace pp
diff --git a/ppapi/cpp/dev/truetype_font_dev.cc b/ppapi/cpp/dev/truetype_font_dev.cc
new file mode 100644
index 0000000..3de81fd
--- /dev/null
+++ b/ppapi/cpp/dev/truetype_font_dev.cc
@@ -0,0 +1,142 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/cpp/dev/truetype_font_dev.h"
+
+#include <stdio.h>
+#include <string.h>  // memcpy
+
+#include "ppapi/c/dev/ppb_truetype_font_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_var.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/instance_handle.h"
+#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/module_impl.h"
+#include "ppapi/cpp/var.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_TrueTypeFont_Dev_0_1>() {
+  return PPB_TRUETYPEFONT_DEV_INTERFACE_0_1;
+}
+
+}  // namespace
+
+// TrueTypeFontDesc_Dev --------------------------------------------------------
+
+TrueTypeFontDesc_Dev::TrueTypeFontDesc_Dev() {
+  desc_.family = family_.pp_var();
+  set_generic_family(PP_TRUETYPEFONTFAMILY_SERIF);
+  set_style(PP_TRUETYPEFONTSTYLE_NORMAL);
+  set_weight(PP_TRUETYPEFONTWEIGHT_NORMAL);
+  set_width(PP_TRUETYPEFONTWIDTH_NORMAL);
+  set_charset(PP_TRUETYPEFONTCHARSET_DEFAULT);
+}
+
+TrueTypeFontDesc_Dev::TrueTypeFontDesc_Dev(
+    PassRef,
+    const PP_TrueTypeFontDesc_Dev& pp_desc) {
+  desc_ = pp_desc;
+  family_ = Var(PASS_REF, pp_desc.family);
+}
+
+TrueTypeFontDesc_Dev::TrueTypeFontDesc_Dev(const TrueTypeFontDesc_Dev& other) {
+  set_family(other.family());
+  set_generic_family(other.generic_family());
+  set_style(other.style());
+  set_weight(other.weight());
+  set_width(other.width());
+  set_charset(other.charset());
+}
+
+TrueTypeFontDesc_Dev::~TrueTypeFontDesc_Dev() {
+}
+
+TrueTypeFontDesc_Dev& TrueTypeFontDesc_Dev::operator=(
+    const TrueTypeFontDesc_Dev& other) {
+  if (this == &other)
+    return *this;
+
+  desc_ = other.desc_;
+  // Be careful about the refcount of the string, the assignment above doesn't
+  // copy a ref. The assignments below take a ref to the new name and copy the
+  // PP_Var into the wrapped descriptor.
+  family_ = other.family();
+  desc_.family = family_.pp_var();
+
+  return *this;
+}
+
+// TrueTypeFont_Dev ------------------------------------------------------------
+
+TrueTypeFont_Dev::TrueTypeFont_Dev() {
+}
+
+TrueTypeFont_Dev::TrueTypeFont_Dev(const InstanceHandle& instance,
+                                   const TrueTypeFontDesc_Dev& desc) {
+  if (!has_interface<PPB_TrueTypeFont_Dev_0_1>())
+    return;
+  PassRefFromConstructor(get_interface<PPB_TrueTypeFont_Dev_0_1>()->Create(
+      instance.pp_instance(), &desc.pp_desc()));
+}
+
+TrueTypeFont_Dev::TrueTypeFont_Dev(const TrueTypeFont_Dev& other)
+    : Resource(other) {
+}
+
+TrueTypeFont_Dev::TrueTypeFont_Dev(PassRef, PP_Resource resource)
+    : Resource(PASS_REF, resource) {
+}
+
+// static
+int32_t TrueTypeFont_Dev::GetFontFamilies(
+    const InstanceHandle& instance,
+    const CompletionCallbackWithOutput<std::vector<Var> >& cc) {
+  if (has_interface<PPB_TrueTypeFont_Dev_0_1>()) {
+    return get_interface<PPB_TrueTypeFont_Dev_0_1>()->GetFontFamilies(
+        instance.pp_instance(),
+        cc.output(), cc.pp_completion_callback());
+  }
+  return cc.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+int32_t TrueTypeFont_Dev::Describe(
+    const CompletionCallbackWithOutput<TrueTypeFontDesc_Dev>& cc) {
+  if (has_interface<PPB_TrueTypeFont_Dev_0_1>()) {
+    int32_t result =
+        get_interface<PPB_TrueTypeFont_Dev_0_1>()->Describe(
+            pp_resource(), cc.output(), cc.pp_completion_callback());
+    return result;
+  }
+  return cc.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+int32_t TrueTypeFont_Dev::GetTableTags(
+    const CompletionCallbackWithOutput<std::vector<uint32_t> >& cc) {
+  if (has_interface<PPB_TrueTypeFont_Dev_0_1>()) {
+    return get_interface<PPB_TrueTypeFont_Dev_0_1>()->GetTableTags(
+        pp_resource(),
+        cc.output(), cc.pp_completion_callback());
+  }
+  return cc.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+int32_t TrueTypeFont_Dev::GetTable(
+    uint32_t table,
+    int32_t offset,
+    int32_t max_data_length,
+    const CompletionCallbackWithOutput<std::vector<char> >& cc) {
+  if (has_interface<PPB_TrueTypeFont_Dev_0_1>()) {
+    return get_interface<PPB_TrueTypeFont_Dev_0_1>()->GetTable(
+        pp_resource(),
+        table, offset, max_data_length,
+        cc.output(), cc.pp_completion_callback());
+  }
+  return cc.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+}  // namespace pp
diff --git a/ppapi/cpp/dev/truetype_font_dev.h b/ppapi/cpp/dev/truetype_font_dev.h
new file mode 100644
index 0000000..124d3eb
--- /dev/null
+++ b/ppapi/cpp/dev/truetype_font_dev.h
@@ -0,0 +1,199 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_TRUETYPE_FONT_H_
+#define PPAPI_CPP_TRUETYPE_FONT_H_
+
+#include "ppapi/c/dev/ppb_truetype_font_dev.h"
+#include "ppapi/c/pp_time.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/pass_ref.h"
+#include "ppapi/cpp/resource.h"
+
+/// @file
+/// This file defines the API to create a TrueType font object.
+
+namespace pp {
+
+class InstanceHandle;
+
+// TrueTypeFontDesc_Dev --------------------------------------------------------
+
+/// The <code>TrueTypeFontDesc_Dev</code> class represents a TrueType font
+/// descriptor, used to Create and Describe fonts.
+class TrueTypeFontDesc_Dev {
+ public:
+  /// Default constructor for creating a <code>TrueTypeFontDesc_Dev</code>
+  /// object.
+  TrueTypeFontDesc_Dev();
+  /// Constructor that takes an existing <code>PP_TrueTypeFontDesc_Dev</code>
+  /// structure. The 'family' PP_Var field in the structure will be managed by
+  /// this instance.
+  TrueTypeFontDesc_Dev(PassRef, const PP_TrueTypeFontDesc_Dev& pp_desc);
+  /// The copy constructor for <code>TrueTypeFontDesc_Dev</code>.
+  ///
+  /// @param[in] other A reference to a <code>TrueTypeFontDesc_Dev</code>.
+  TrueTypeFontDesc_Dev(const TrueTypeFontDesc_Dev& other);
+  ~TrueTypeFontDesc_Dev();
+
+  TrueTypeFontDesc_Dev& operator=(const TrueTypeFontDesc_Dev& other);
+
+  const PP_TrueTypeFontDesc_Dev& pp_desc() const {
+    return desc_;
+  }
+
+  Var family() const {
+    return family_;
+  }
+  void set_family(const Var& family) {
+    family_ = family;
+    // The assignment above manages the underlying PP_Vars. Copy the new one
+    // into the wrapped desc struct.
+    desc_.family = family_.pp_var();
+  }
+
+  PP_TrueTypeFontFamily_Dev generic_family() const {
+    return desc_.generic_family;
+  }
+  void set_generic_family(PP_TrueTypeFontFamily_Dev family) {
+    desc_.generic_family = family;
+  }
+
+  PP_TrueTypeFontStyle_Dev style() const { return desc_.style; }
+  void set_style(PP_TrueTypeFontStyle_Dev style) {
+    desc_.style = style;
+  }
+
+  PP_TrueTypeFontWeight_Dev weight() const { return desc_.weight; }
+  void set_weight(PP_TrueTypeFontWeight_Dev weight) {
+    desc_.weight = weight;
+  }
+
+  PP_TrueTypeFontWidth_Dev width() const { return desc_.width; }
+  void set_width(PP_TrueTypeFontWidth_Dev width) {
+    desc_.width = width;
+  }
+
+  PP_TrueTypeFontCharset_Dev charset() const { return desc_.charset; }
+  void set_charset(PP_TrueTypeFontCharset_Dev charset) {
+    desc_.charset = charset;
+  }
+
+ private:
+  friend class TrueTypeFont_Dev;
+
+  pp::Var family_;  // This manages the PP_Var embedded in desc_.
+  PP_TrueTypeFontDesc_Dev desc_;
+};
+
+// TrueTypeFont_Dev ------------------------------------------------------------
+
+/// The <code>TrueTypeFont_Dev</code> class represents a TrueType font resource.
+class TrueTypeFont_Dev : public Resource {
+ public:
+  /// Default constructor for creating a <code>TrueTypeFont_Dev</code> object.
+  TrueTypeFont_Dev();
+
+  /// A constructor used to create a <code>TrueTypeFont_Dev</code> and associate
+  /// it with the provided <code>Instance</code>.
+  ///
+  /// @param[in] instance The instance that owns this resource.
+  TrueTypeFont_Dev(const InstanceHandle& instance,
+                   const TrueTypeFontDesc_Dev& desc);
+
+  /// The copy constructor for <code>TrueTypeFont_Dev</code>.
+  ///
+  /// @param[in] other A reference to a <code>TrueTypeFont_Dev</code>.
+  TrueTypeFont_Dev(const TrueTypeFont_Dev& other);
+
+  /// A constructor used when you have received a PP_Resource as a return
+  /// value that has had its reference count incremented for you.
+  ///
+  /// @param[in] resource A PP_Resource corresponding to a TrueType font.
+  TrueTypeFont_Dev(PassRef, PP_Resource resource);
+
+  /// Gets an array of TrueType font family names available on the host.
+  /// These names can be used to create a font from a specific family.
+  ///
+  /// @param[in] instance A <code>InstanceHandle</code> requesting the family
+  /// names.
+  /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be
+  /// called upon completion of GetFontFamilies.
+  ///
+  /// @return If >= 0, the number of family names returned, otherwise an error
+  /// code from <code>pp_errors.h</code>.
+  static int32_t GetFontFamilies(
+      const InstanceHandle& instance,
+      const CompletionCallbackWithOutput<std::vector<Var> >& cc);
+
+  /// Returns a description of the given font resource. This description may
+  /// differ from the description passed to Create, reflecting the host's font
+  /// matching and fallback algorithm.
+  ///
+  /// @param[in] callback A <code>CompletionCallback</code> to be called upon
+  /// completion of Describe.
+  ///
+  /// @return A return code from <code>pp_errors.h</code>. If an error code is
+  /// returned, the descriptor will be left unchanged.
+  int32_t Describe(
+      const CompletionCallbackWithOutput<TrueTypeFontDesc_Dev>& cc);
+
+  /// Gets an array of identifying tags for each table in the font.
+  /// These tags can be used to request specific tables using GetTable.
+  ///
+  /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be
+  /// called upon completion of GetTableTags.
+  ///
+  /// @return If >= 0, the number of table tags returned, otherwise an error
+  /// code from <code>pp_errors.h</code>.
+  int32_t GetTableTags(
+      const CompletionCallbackWithOutput<std::vector<uint32_t> >& cc);
+
+  /// Copies the given font table into client memory.
+  ///
+  /// @param[in] table A 4 byte value indicating which table to copy.
+  /// For example, 'glyf' will cause the outline table to be copied into the
+  /// output array. A zero tag value will cause the entire font to be copied.
+  /// @param[in] offset The offset into the font table.
+  /// @param[in] max_data_length The maximum number of bytes to transfer from
+  /// <code>offset</code>.
+  /// @param[in] output A <code>PP_ArrayOutput</code> to hold the font data.
+  /// The data is an array of bytes.
+  /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be
+  /// called upon completion of GetTable.
+  ///
+  /// @return If >= 0, the table size in bytes, otherwise an error code from
+  /// <code>pp_errors.h</code>.
+  int32_t GetTable(
+      uint32_t table,
+      int32_t offset,
+      int32_t max_data_length,
+      const CompletionCallbackWithOutput<std::vector<char> >& cc);
+};
+
+namespace internal {
+
+// A specialization of CallbackOutputTraits to provide the callback system the
+// information on how to handle pp::TrueTypeFontDesc_Dev. This converts
+// PP_TrueTypeFontDesc_Dev to pp::TrueTypeFontDesc_Dev when passing to the
+// plugin, and specifically manages the PP_Var embedded in the desc_ field.
+template<>
+struct CallbackOutputTraits<pp::TrueTypeFontDesc_Dev> {
+  typedef PP_TrueTypeFontDesc_Dev* APIArgType;
+  typedef PP_TrueTypeFontDesc_Dev StorageType;
+
+  static inline APIArgType StorageToAPIArg(StorageType& t) {
+    return &t;
+  }
+
+  static inline pp::TrueTypeFontDesc_Dev StorageToPluginArg(StorageType& t) {
+    return pp::TrueTypeFontDesc_Dev(PASS_REF, t);
+  }
+};
+
+}  // namespace internal
+
+}  // namespace pp
+
+#endif  // PPAPI_CPP_TRUETYPE_FONT_H_
diff --git a/ppapi/cpp/dev/var_array_dev.cc b/ppapi/cpp/dev/var_array_dev.cc
new file mode 100644
index 0000000..247e9c4
--- /dev/null
+++ b/ppapi/cpp/dev/var_array_dev.cc
@@ -0,0 +1,96 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/cpp/dev/var_array_dev.h"
+
+#include "ppapi/c/dev/ppb_var_array_dev.h"
+#include "ppapi/cpp/logging.h"
+#include "ppapi/cpp/module_impl.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_VarArray_Dev_0_1>() {
+  return PPB_VAR_ARRAY_DEV_INTERFACE_0_1;
+}
+
+}  // namespace
+
+VarArray_Dev::VarArray_Dev() : Var(Null()) {
+  if (has_interface<PPB_VarArray_Dev_0_1>())
+    var_ = get_interface<PPB_VarArray_Dev_0_1>()->Create();
+  else
+    PP_NOTREACHED();
+}
+
+VarArray_Dev::VarArray_Dev(const Var& var) : Var(var) {
+  if (!var.is_array()) {
+    PP_NOTREACHED();
+
+    // This takes care of releasing the reference that this object holds.
+    Var::operator=(Var(Null()));
+  }
+}
+
+VarArray_Dev::VarArray_Dev(const PP_Var& var) : Var(var) {
+  if (var.type != PP_VARTYPE_ARRAY) {
+    PP_NOTREACHED();
+
+    // This takes care of releasing the reference that this object holds.
+    Var::operator=(Var(Null()));
+  }
+}
+
+VarArray_Dev::VarArray_Dev(const VarArray_Dev& other) : Var(other) {
+}
+
+VarArray_Dev::~VarArray_Dev() {
+}
+
+VarArray_Dev& VarArray_Dev::operator=(const VarArray_Dev& other) {
+  Var::operator=(other);
+  return *this;
+}
+
+Var& VarArray_Dev::operator=(const Var& other) {
+  if (other.is_array()) {
+    Var::operator=(other);
+  } else {
+    PP_NOTREACHED();
+    Var::operator=(Var(Null()));
+  }
+  return *this;
+}
+
+Var VarArray_Dev::Get(uint32_t index) const {
+  if (!has_interface<PPB_VarArray_Dev_0_1>())
+    return Var();
+
+  return Var(PASS_REF, get_interface<PPB_VarArray_Dev_0_1>()->Get(var_, index));
+}
+
+PP_Bool VarArray_Dev::Set(uint32_t index, const Var& value) {
+  if (!has_interface<PPB_VarArray_Dev_0_1>())
+    return PP_FALSE;
+
+  return get_interface<PPB_VarArray_Dev_0_1>()->Set(var_, index,
+                                                    value.pp_var());
+}
+
+uint32_t VarArray_Dev::GetLength() const {
+  if (!has_interface<PPB_VarArray_Dev_0_1>())
+    return 0;
+
+  return get_interface<PPB_VarArray_Dev_0_1>()->GetLength(var_);
+}
+
+PP_Bool VarArray_Dev::SetLength(uint32_t length) {
+  if (!has_interface<PPB_VarArray_Dev_0_1>())
+    return PP_FALSE;
+
+  return get_interface<PPB_VarArray_Dev_0_1>()->SetLength(var_, length);
+}
+
+}  // namespace pp
diff --git a/ppapi/cpp/dev/var_array_dev.h b/ppapi/cpp/dev/var_array_dev.h
new file mode 100644
index 0000000..e790f97
--- /dev/null
+++ b/ppapi/cpp/dev/var_array_dev.h
@@ -0,0 +1,90 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_DEV_VAR_ARRAY_DEV_H_
+#define PPAPI_CPP_DEV_VAR_ARRAY_DEV_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/cpp/var.h"
+
+/// @file
+/// This file defines the API for interacting with array vars.
+
+namespace pp {
+
+class VarArray_Dev : public Var {
+ public:
+  /// Constructs a new array var.
+  VarArray_Dev();
+
+  /// Contructs a <code>VarArray_Dev</code> given a var for which is_array() is
+  /// true. This will refer to the same array var, but allow you to access
+  /// methods specific to arrays.
+  ///
+  /// @param[in] var An array var.
+  explicit VarArray_Dev(const Var& var);
+
+  /// Contructs a <code>VarArray_Dev</code> given a <code>PP_Var</code> of type
+  /// PP_VARTYPE_ARRAY.
+  ///
+  /// @param[in] var A <code>PP_Var</code> of type PP_VARTYPE_ARRAY.
+  explicit VarArray_Dev(const PP_Var& var);
+
+  /// Copy constructor.
+  VarArray_Dev(const VarArray_Dev& other);
+
+  virtual ~VarArray_Dev();
+
+  /// Assignment operator.
+  VarArray_Dev& operator=(const VarArray_Dev& other);
+
+  /// The <code>Var</code> assignment operator is overridden here so that we can
+  /// check for assigning a non-array var to a <code>VarArray_Dev</code>.
+  ///
+  /// @param[in] other The array var to be assigned.
+  ///
+  /// @return The resulting <code>VarArray_Dev</code> (as a <code>Var</code>&).
+  virtual Var& operator=(const Var& other);
+
+  /// Gets an element from the array.
+  ///
+  /// @param[in] index An index indicating which element to return.
+  ///
+  /// @return The element at the specified position. If <code>index</code> is
+  /// larger than or equal to the array length, an undefined var is returned.
+  Var Get(uint32_t index) const;
+
+  /// Sets the value of an element in the array.
+  ///
+  /// @param[in] index An index indicating which element to modify. If
+  /// <code>index</code> is larger than or equal to the array length, the length
+  /// is updated to be <code>index</code> + 1. Any position in the array that
+  /// hasn't been set before is set to undefined, i.e., <code>PP_Var</code> of
+  /// type <code>PP_VARTYPE_UNDEFINED</code>.
+  /// @param[in] value The value to set.
+  ///
+  /// @return A <code>PP_Bool</code> indicating whether the operation succeeds.
+  PP_Bool Set(uint32_t index, const Var& value);
+
+  /// Gets the array length.
+  ///
+  /// @return The array length.
+  uint32_t GetLength() const;
+
+  /// Sets the array length.
+  ///
+  /// @param[in] length The new array length. If <code>length</code> is smaller
+  /// than its current value, the array is truncated to the new length; any
+  /// elements that no longer fit are removed. If <code>length</code> is larger
+  /// than its current value, undefined vars are appended to increase the array
+  /// to the specified length.
+  ///
+  /// @return A <code>PP_Bool</code> indicating whether the operation succeeds.
+  PP_Bool SetLength(uint32_t length);
+};
+
+}  // namespace pp
+
+#endif  // PPAPI_CPP_DEV_VAR_ARRAY_DEV_H_
diff --git a/ppapi/cpp/dev/var_dictionary_dev.cc b/ppapi/cpp/dev/var_dictionary_dev.cc
new file mode 100644
index 0000000..8fa3f6c
--- /dev/null
+++ b/ppapi/cpp/dev/var_dictionary_dev.cc
@@ -0,0 +1,110 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/cpp/dev/var_dictionary_dev.h"
+
+#include "ppapi/c/dev/ppb_var_dictionary_dev.h"
+#include "ppapi/cpp/logging.h"
+#include "ppapi/cpp/module_impl.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_VarDictionary_Dev_0_1>() {
+  return PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1;
+}
+
+}  // namespace
+
+VarDictionary_Dev::VarDictionary_Dev() : Var(Null()) {
+  if (has_interface<PPB_VarDictionary_Dev_0_1>())
+    var_ = get_interface<PPB_VarDictionary_Dev_0_1>()->Create();
+  else
+    PP_NOTREACHED();
+}
+
+VarDictionary_Dev::VarDictionary_Dev(const Var& var) : Var(var) {
+  if (!var.is_dictionary()) {
+    PP_NOTREACHED();
+
+    // This takes care of releasing the reference that this object holds.
+    Var::operator=(Var(Null()));
+  }
+}
+
+VarDictionary_Dev::VarDictionary_Dev(const PP_Var& var) : Var(var) {
+  if (var.type != PP_VARTYPE_DICTIONARY) {
+    PP_NOTREACHED();
+
+    // This takes care of releasing the reference that this object holds.
+    Var::operator=(Var(Null()));
+  }
+}
+
+VarDictionary_Dev::VarDictionary_Dev(const VarDictionary_Dev& other)
+    : Var(other) {
+}
+
+VarDictionary_Dev::~VarDictionary_Dev() {
+}
+
+VarDictionary_Dev& VarDictionary_Dev::operator=(
+    const VarDictionary_Dev& other) {
+  Var::operator=(other);
+  return *this;
+}
+
+Var& VarDictionary_Dev::operator=(const Var& other) {
+  if (other.is_dictionary()) {
+    Var::operator=(other);
+  } else {
+    PP_NOTREACHED();
+    Var::operator=(Var(Null()));
+  }
+  return *this;
+}
+
+Var VarDictionary_Dev::Get(const Var& key) const {
+  if (!has_interface<PPB_VarDictionary_Dev_0_1>())
+    return Var();
+
+  return Var(
+      PASS_REF,
+      get_interface<PPB_VarDictionary_Dev_0_1>()->Get(var_, key.pp_var()));
+}
+
+PP_Bool VarDictionary_Dev::Set(const Var& key, const Var& value) {
+  if (!has_interface<PPB_VarDictionary_Dev_0_1>())
+    return PP_FALSE;
+
+  return get_interface<PPB_VarDictionary_Dev_0_1>()->Set(var_, key.pp_var(),
+                                                         value.pp_var());
+}
+
+void VarDictionary_Dev::Delete(const Var& key) {
+  if (has_interface<PPB_VarDictionary_Dev_0_1>())
+    get_interface<PPB_VarDictionary_Dev_0_1>()->Delete(var_, key.pp_var());
+}
+
+PP_Bool VarDictionary_Dev::HasKey(const Var& key) const {
+  if (!has_interface<PPB_VarDictionary_Dev_0_1>())
+    return PP_FALSE;
+
+  return get_interface<PPB_VarDictionary_Dev_0_1>()->HasKey(var_, key.pp_var());
+}
+
+VarArray_Dev VarDictionary_Dev::GetKeys() const {
+  if (!has_interface<PPB_VarDictionary_Dev_0_1>())
+    return VarArray_Dev();
+
+  Var result(PASS_REF,
+             get_interface<PPB_VarDictionary_Dev_0_1>()->GetKeys(var_));
+  if (result.is_array())
+    return VarArray_Dev(result);
+  else
+    return VarArray_Dev();
+}
+
+}  // namespace pp
diff --git a/ppapi/cpp/dev/var_dictionary_dev.h b/ppapi/cpp/dev/var_dictionary_dev.h
new file mode 100644
index 0000000..5934b81
--- /dev/null
+++ b/ppapi/cpp/dev/var_dictionary_dev.h
@@ -0,0 +1,93 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_DEV_VAR_DICTIONARY_DEV_H_
+#define PPAPI_CPP_DEV_VAR_DICTIONARY_DEV_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/cpp/dev/var_array_dev.h"
+#include "ppapi/cpp/var.h"
+
+/// @file
+/// This file defines the API for interacting with dictionary vars.
+
+namespace pp {
+
+class VarDictionary_Dev : public Var {
+ public:
+  /// Constructs a new dictionary var.
+  VarDictionary_Dev();
+
+  /// Contructs a <code>VarDictionary_Dev</code> given a var for which
+  /// is_dictionary() is true. This will refer to the same dictionary var, but
+  /// allow you to access methods specific to dictionary.
+  ///
+  /// @param[in] var A dictionary var.
+  explicit VarDictionary_Dev(const Var& var);
+
+  /// Contructs a <code>VarDictionary_Dev</code> given a <code>PP_Var</code>
+  /// of type PP_VARTYPE_DICTIONARY.
+  ///
+  /// @param[in] var A <code>PP_Var</code> of type PP_VARTYPE_DICTIONARY.
+  explicit VarDictionary_Dev(const PP_Var& var);
+
+  /// Copy constructor.
+  VarDictionary_Dev(const VarDictionary_Dev& other);
+
+  virtual ~VarDictionary_Dev();
+
+  /// Assignment operator.
+  VarDictionary_Dev& operator=(const VarDictionary_Dev& other);
+
+  /// The <code>Var</code> assignment operator is overridden here so that we can
+  /// check for assigning a non-dictionary var to a
+  /// <code>VarDictionary_Dev</code>.
+  ///
+  /// @param[in] other The dictionary var to be assigned.
+  ///
+  /// @return The resulting <code>VarDictionary_Dev</code> (as a
+  /// <code>Var</code>&).
+  virtual Var& operator=(const Var& other);
+
+  /// Gets the value associated with the specified key.
+  ///
+  /// @param[in] key A string var.
+  ///
+  /// @return The value that is associated with <code>key</code>. If
+  /// <code>key</code> is not a string var, or it doesn't exist in the
+  /// dictionary, an undefined var is returned.
+  Var Get(const Var& key) const;
+
+  /// Sets the value associated with the specified key.
+  ///
+  /// @param[in] key A string var. If this key hasn't existed in the dictionary,
+  /// it is added and associated with <code>value</code>; otherwise, the
+  /// previous value is replaced with <code>value</code>.
+  /// @param[in] value The value to set.
+  ///
+  /// @return A <code>PP_Bool</code> indicating whether the operation succeeds.
+  PP_Bool Set(const Var& key, const Var& value);
+
+  /// Deletes the specified key and its associated value, if the key exists.
+  ///
+  /// @param[in] key A string var.
+  void Delete(const Var& key);
+
+  /// Checks whether a key exists.
+  ///
+  /// @param[in] key A string var.
+  ///
+  /// @return A <code>PP_Bool</code> indicating whether the key exists.
+  PP_Bool HasKey(const Var& key) const;
+
+  /// Gets all the keys in the dictionary.
+  ///
+  /// @return An array var which contains all the keys of the dictionary.
+  /// The elements are string vars. Returns an empty array var if failed.
+  VarArray_Dev GetKeys() const;
+};
+
+}  // namespace pp
+
+#endif  // PPAPI_CPP_DEV_VAR_DICTIONARY_DEV_H_
diff --git a/ppapi/cpp/dev/video_capture_dev.cc b/ppapi/cpp/dev/video_capture_dev.cc
index 4fc11d5..46fdb59 100644
--- a/ppapi/cpp/dev/video_capture_dev.cc
+++ b/ppapi/cpp/dev/video_capture_dev.cc
@@ -18,28 +18,24 @@
   return PPB_VIDEOCAPTURE_DEV_INTERFACE_0_2;
 }
 
-template <> const char* interface_name<PPB_VideoCapture_Dev_0_1>() {
-  return PPB_VIDEOCAPTURE_DEV_INTERFACE_0_1;
+template <> const char* interface_name<PPB_VideoCapture_Dev_0_3>() {
+  return PPB_VIDEOCAPTURE_DEV_INTERFACE_0_3;
 }
 
 }  // namespace
 
-VideoCapture_Dev::VideoCapture_Dev(const InstanceHandle& instance)
-    : requested_info_(),
-      buffer_count_(0) {
-  if (has_interface<PPB_VideoCapture_Dev_0_2>()) {
-    PassRefFromConstructor(get_interface<PPB_VideoCapture_Dev_0_2>()->Create(
+VideoCapture_Dev::VideoCapture_Dev(const InstanceHandle& instance) {
+  if (has_interface<PPB_VideoCapture_Dev_0_3>()) {
+    PassRefFromConstructor(get_interface<PPB_VideoCapture_Dev_0_3>()->Create(
         instance.pp_instance()));
-  } else if (has_interface<PPB_VideoCapture_Dev_0_1>()) {
-    PassRefFromConstructor(get_interface<PPB_VideoCapture_Dev_0_1>()->Create(
+  } else if (has_interface<PPB_VideoCapture_Dev_0_2>()) {
+    PassRefFromConstructor(get_interface<PPB_VideoCapture_Dev_0_2>()->Create(
         instance.pp_instance()));
   }
 }
 
 VideoCapture_Dev::VideoCapture_Dev(PP_Resource resource)
-    : Resource(resource),
-      requested_info_(),
-      buffer_count_(0) {
+    : Resource(resource) {
 }
 
 VideoCapture_Dev::~VideoCapture_Dev() {
@@ -47,25 +43,43 @@
 
 // static
 bool VideoCapture_Dev::IsAvailable() {
-  return has_interface<PPB_VideoCapture_Dev_0_2>() ||
-         has_interface<PPB_VideoCapture_Dev_0_1>();
+  return has_interface<PPB_VideoCapture_Dev_0_3>() ||
+         has_interface<PPB_VideoCapture_Dev_0_2>();
 }
 
 int32_t VideoCapture_Dev::EnumerateDevices(
     const CompletionCallbackWithOutput<std::vector<DeviceRef_Dev> >& callback) {
-  if (!has_interface<PPB_VideoCapture_Dev_0_2>())
-    return callback.MayForce(PP_ERROR_NOINTERFACE);
-  if (!callback.pp_completion_callback().func)
-    return callback.MayForce(PP_ERROR_BLOCKS_MAIN_THREAD);
+  if (has_interface<PPB_VideoCapture_Dev_0_3>()) {
+    return get_interface<PPB_VideoCapture_Dev_0_3>()->EnumerateDevices(
+        pp_resource(), callback.output(), callback.pp_completion_callback());
+  }
 
-  // ArrayOutputCallbackConverter is responsible to delete it.
-  ResourceArray_Dev::ArrayOutputCallbackData* data =
-      new ResourceArray_Dev::ArrayOutputCallbackData(
-          callback.output(), callback.pp_completion_callback());
-  return get_interface<PPB_VideoCapture_Dev_0_2>()->EnumerateDevices(
-      pp_resource(), &data->resource_array_output,
-      PP_MakeCompletionCallback(
-          &ResourceArray_Dev::ArrayOutputCallbackConverter, data));
+  if (has_interface<PPB_VideoCapture_Dev_0_2>()) {
+    if (!callback.pp_completion_callback().func)
+      return callback.MayForce(PP_ERROR_BLOCKS_MAIN_THREAD);
+
+    // ArrayOutputCallbackConverter is responsible to delete it.
+    ResourceArray_Dev::ArrayOutputCallbackData* data =
+        new ResourceArray_Dev::ArrayOutputCallbackData(
+            callback.output(), callback.pp_completion_callback());
+    return get_interface<PPB_VideoCapture_Dev_0_2>()->EnumerateDevices(
+        pp_resource(), &data->resource_array_output,
+        PP_MakeCompletionCallback(
+            &ResourceArray_Dev::ArrayOutputCallbackConverter, data));
+  }
+
+  return callback.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+int32_t VideoCapture_Dev::MonitorDeviceChange(
+    PP_MonitorDeviceChangeCallback callback,
+    void* user_data) {
+  if (has_interface<PPB_VideoCapture_Dev_0_3>()) {
+    return get_interface<PPB_VideoCapture_Dev_0_3>()->MonitorDeviceChange(
+        pp_resource(), callback, user_data);
+  }
+
+  return PP_ERROR_NOINTERFACE;
 }
 
 int32_t VideoCapture_Dev::Open(
@@ -73,46 +87,40 @@
     const PP_VideoCaptureDeviceInfo_Dev& requested_info,
     uint32_t buffer_count,
     const CompletionCallback& callback) {
+  if (has_interface<PPB_VideoCapture_Dev_0_3>()) {
+    return get_interface<PPB_VideoCapture_Dev_0_3>()->Open(
+        pp_resource(), device_ref.pp_resource(), &requested_info, buffer_count,
+        callback.pp_completion_callback());
+  }
   if (has_interface<PPB_VideoCapture_Dev_0_2>()) {
     return get_interface<PPB_VideoCapture_Dev_0_2>()->Open(
         pp_resource(), device_ref.pp_resource(), &requested_info, buffer_count,
         callback.pp_completion_callback());
   }
 
-  if (has_interface<PPB_VideoCapture_Dev_0_1>()) {
-    if (device_ref.is_null()) {
-      requested_info_ = requested_info;
-      buffer_count_ = buffer_count;
-      return callback.MayForce(PP_OK);
-    }
-    return callback.MayForce(PP_ERROR_NOTSUPPORTED);
-  }
-
   return callback.MayForce(PP_ERROR_NOINTERFACE);
 }
 
 int32_t VideoCapture_Dev::StartCapture() {
+  if (has_interface<PPB_VideoCapture_Dev_0_3>()) {
+    return get_interface<PPB_VideoCapture_Dev_0_3>()->StartCapture(
+        pp_resource());
+  }
   if (has_interface<PPB_VideoCapture_Dev_0_2>()) {
     return get_interface<PPB_VideoCapture_Dev_0_2>()->StartCapture(
         pp_resource());
   }
 
-  if (has_interface<PPB_VideoCapture_Dev_0_1>()) {
-    return get_interface<PPB_VideoCapture_Dev_0_1>()->StartCapture(
-        pp_resource(), &requested_info_, buffer_count_);
-  }
-
   return PP_ERROR_NOINTERFACE;
 }
 
 int32_t VideoCapture_Dev::ReuseBuffer(uint32_t buffer) {
-  if (has_interface<PPB_VideoCapture_Dev_0_2>()) {
-    return get_interface<PPB_VideoCapture_Dev_0_2>()->ReuseBuffer(pp_resource(),
+  if (has_interface<PPB_VideoCapture_Dev_0_3>()) {
+    return get_interface<PPB_VideoCapture_Dev_0_3>()->ReuseBuffer(pp_resource(),
                                                                   buffer);
   }
-
-  if (has_interface<PPB_VideoCapture_Dev_0_1>()) {
-    return get_interface<PPB_VideoCapture_Dev_0_1>()->ReuseBuffer(pp_resource(),
+  if (has_interface<PPB_VideoCapture_Dev_0_2>()) {
+    return get_interface<PPB_VideoCapture_Dev_0_2>()->ReuseBuffer(pp_resource(),
                                                                   buffer);
   }
 
@@ -120,13 +128,12 @@
 }
 
 int32_t VideoCapture_Dev::StopCapture() {
-  if (has_interface<PPB_VideoCapture_Dev_0_2>()) {
-    return get_interface<PPB_VideoCapture_Dev_0_2>()->StopCapture(
+  if (has_interface<PPB_VideoCapture_Dev_0_3>()) {
+    return get_interface<PPB_VideoCapture_Dev_0_3>()->StopCapture(
         pp_resource());
   }
-
-  if (has_interface<PPB_VideoCapture_Dev_0_1>()) {
-    return get_interface<PPB_VideoCapture_Dev_0_1>()->StopCapture(
+  if (has_interface<PPB_VideoCapture_Dev_0_2>()) {
+    return get_interface<PPB_VideoCapture_Dev_0_2>()->StopCapture(
         pp_resource());
   }
 
@@ -134,8 +141,11 @@
 }
 
 void VideoCapture_Dev::Close() {
-  if (has_interface<PPB_VideoCapture_Dev_0_2>())
+  if (has_interface<PPB_VideoCapture_Dev_0_3>()) {
+    get_interface<PPB_VideoCapture_Dev_0_3>()->Close(pp_resource());
+  } else if (has_interface<PPB_VideoCapture_Dev_0_2>()) {
     get_interface<PPB_VideoCapture_Dev_0_2>()->Close(pp_resource());
+  }
 }
 
 }  // namespace pp
diff --git a/ppapi/cpp/dev/video_capture_dev.h b/ppapi/cpp/dev/video_capture_dev.h
index 87ce50d..649254e 100644
--- a/ppapi/cpp/dev/video_capture_dev.h
+++ b/ppapi/cpp/dev/video_capture_dev.h
@@ -29,6 +29,8 @@
   int32_t EnumerateDevices(
       const CompletionCallbackWithOutput<std::vector<DeviceRef_Dev> >&
           callback);
+  int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback,
+                              void* user_data);
   int32_t Open(const DeviceRef_Dev& device_ref,
                const PP_VideoCaptureDeviceInfo_Dev& requested_info,
                uint32_t buffer_count,
@@ -37,11 +39,6 @@
   int32_t ReuseBuffer(uint32_t buffer);
   int32_t StopCapture();
   void Close();
-
- private:
-  // Used to store the arguments of Open() when using the v0.1 interface.
-  PP_VideoCaptureDeviceInfo_Dev requested_info_;
-  uint32_t buffer_count_;
 };
 
 }  // namespace pp
diff --git a/ppapi/cpp/documentation/check.sh b/ppapi/cpp/documentation/check.sh
index ce3b49f..793f408 100755
--- a/ppapi/cpp/documentation/check.sh
+++ b/ppapi/cpp/documentation/check.sh
@@ -1,4 +1,7 @@
 #!/bin/bash
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
 # simple script to check html via tidy. Either specify html files on
 # command line or rely on default which checks all html files in
diff --git a/ppapi/cpp/extensions/dev/alarms_dev.cc b/ppapi/cpp/extensions/dev/alarms_dev.cc
new file mode 100644
index 0000000..879efec
--- /dev/null
+++ b/ppapi/cpp/extensions/dev/alarms_dev.cc
@@ -0,0 +1,181 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/cpp/extensions/dev/alarms_dev.h"
+
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/dev/var_dictionary_dev.h"
+#include "ppapi/cpp/extensions/optional.h"
+#include "ppapi/cpp/extensions/to_var_converter.h"
+#include "ppapi/cpp/logging.h"
+#include "ppapi/cpp/module_impl.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_Ext_Alarms_Dev_0_1>() {
+  return PPB_EXT_ALARMS_DEV_INTERFACE_0_1;
+}
+
+}  // namespace
+
+namespace ext {
+namespace alarms {
+
+const char* const Alarm_Dev::kName = "name";
+const char* const Alarm_Dev::kScheduledTime = "scheduledTime";
+const char* const Alarm_Dev::kPeriodInMinutes = "periodInMinutes";
+
+Alarm_Dev::Alarm_Dev()
+    : name(kName),
+      scheduled_time(kScheduledTime),
+      period_in_minutes(kPeriodInMinutes) {
+}
+
+Alarm_Dev::~Alarm_Dev() {
+}
+
+bool Alarm_Dev::Populate(const PP_Ext_Alarms_Alarm_Dev& value) {
+  if (value.type != PP_VARTYPE_DICTIONARY)
+    return false;
+
+  VarDictionary_Dev dict(value);
+  bool result = name.Populate(dict);
+  result = scheduled_time.Populate(dict) && result;
+  result = period_in_minutes.Populate(dict) && result;
+
+  return result;
+}
+
+Var Alarm_Dev::CreateVar() const {
+  VarDictionary_Dev dict;
+
+  bool result = name.AddTo(&dict);
+  result = scheduled_time.AddTo(&dict) && result;
+  result = period_in_minutes.MayAddTo(&dict) && result;
+  PP_DCHECK(result);
+
+  return dict;
+}
+
+const char* const AlarmCreateInfo_Dev::kWhen = "when";
+const char* const AlarmCreateInfo_Dev::kDelayInMinutes = "delayInMinutes";
+const char* const AlarmCreateInfo_Dev::kPeriodInMinutes = "periodInMinutes";
+
+AlarmCreateInfo_Dev::AlarmCreateInfo_Dev()
+    : when(kWhen),
+      delay_in_minutes(kDelayInMinutes),
+      period_in_minutes(kPeriodInMinutes) {
+}
+
+AlarmCreateInfo_Dev::~AlarmCreateInfo_Dev() {
+}
+
+bool AlarmCreateInfo_Dev::Populate(
+    const PP_Ext_Alarms_AlarmCreateInfo_Dev& value) {
+  if (value.type != PP_VARTYPE_DICTIONARY)
+    return false;
+
+  VarDictionary_Dev dict(value);
+  bool result = when.Populate(dict);
+  result = delay_in_minutes.Populate(dict) && result;
+  result = period_in_minutes.Populate(dict) && result;
+
+  return result;
+}
+
+Var AlarmCreateInfo_Dev::CreateVar() const {
+  VarDictionary_Dev dict;
+
+  bool result = when.MayAddTo(&dict);
+  result = delay_in_minutes.MayAddTo(&dict) && result;
+  result = period_in_minutes.MayAddTo(&dict) && result;
+  PP_DCHECK(result);
+
+  return dict;
+}
+
+Alarms_Dev::Alarms_Dev(const InstanceHandle& instance) : instance_(instance) {
+}
+
+Alarms_Dev::~Alarms_Dev() {
+}
+
+void Alarms_Dev::Create(const Optional<std::string>& name,
+                        const AlarmCreateInfo_Dev& alarm_info) {
+  if (!has_interface<PPB_Ext_Alarms_Dev_0_1>())
+    return;
+
+  internal::ToVarConverter<Optional<std::string> > name_var(name);
+  internal::ToVarConverter<AlarmCreateInfo_Dev> alarm_info_var(alarm_info);
+
+  return get_interface<PPB_Ext_Alarms_Dev_0_1>()->Create(
+      instance_.pp_instance(),
+      name_var.pp_var(),
+      alarm_info_var.pp_var());
+}
+
+int32_t Alarms_Dev::Get(
+    const Optional<std::string>& name,
+    const CompletionCallbackWithOutput<Alarm_Dev>& callback) {
+  if (!has_interface<PPB_Ext_Alarms_Dev_0_1>())
+    return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+  internal::ToVarConverter<Optional<std::string> > name_var(name);
+
+  return get_interface<PPB_Ext_Alarms_Dev_0_1>()->Get(
+      instance_.pp_instance(),
+      name_var.pp_var(),
+      callback.output(),
+      callback.pp_completion_callback());
+}
+
+int32_t Alarms_Dev::GetAll(
+    const CompletionCallbackWithOutput<std::vector<Alarm_Dev> >& callback) {
+  if (!has_interface<PPB_Ext_Alarms_Dev_0_1>())
+    return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+  return get_interface<PPB_Ext_Alarms_Dev_0_1>()->GetAll(
+      instance_.pp_instance(),
+      callback.output(),
+      callback.pp_completion_callback());
+}
+
+void Alarms_Dev::Clear(const Optional<std::string>& name) {
+  if (!has_interface<PPB_Ext_Alarms_Dev_0_1>())
+    return;
+
+  internal::ToVarConverter<Optional<std::string> > name_var(name);
+
+  return get_interface<PPB_Ext_Alarms_Dev_0_1>()->Clear(
+      instance_.pp_instance(),
+      name_var.pp_var());
+}
+
+void Alarms_Dev::ClearAll() {
+  if (!has_interface<PPB_Ext_Alarms_Dev_0_1>())
+    return;
+
+  return get_interface<PPB_Ext_Alarms_Dev_0_1>()->ClearAll(
+      instance_.pp_instance());
+}
+
+OnAlarmEvent_Dev::OnAlarmEvent_Dev(
+    const InstanceHandle& instance,
+    Listener* listener)
+    : internal::EventBase1<PP_Ext_Alarms_OnAlarm_Dev, Alarm_Dev>(instance),
+      listener_(listener) {
+}
+
+OnAlarmEvent_Dev::~OnAlarmEvent_Dev() {
+}
+
+void OnAlarmEvent_Dev::Callback(Alarm_Dev& alarm) {
+  listener_->OnAlarm(alarm);
+}
+
+}  // namespace alarms
+}  // namespace ext
+}  // namespace pp
diff --git a/ppapi/cpp/extensions/dev/alarms_dev.h b/ppapi/cpp/extensions/dev/alarms_dev.h
new file mode 100644
index 0000000..762e006
--- /dev/null
+++ b/ppapi/cpp/extensions/dev/alarms_dev.h
@@ -0,0 +1,113 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_EXTENSIONS_DEV_ALARMS_DEV_H_
+#define PPAPI_CPP_EXTENSIONS_DEV_ALARMS_DEV_H_
+
+#include <string>
+#include <vector>
+
+#include "ppapi/c/extensions/dev/ppb_alarms_dev.h"
+#include "ppapi/cpp/extensions/dict_field.h"
+#include "ppapi/cpp/extensions/event_base.h"
+#include "ppapi/cpp/extensions/ext_output_traits.h"
+#include "ppapi/cpp/instance_handle.h"
+#include "ppapi/cpp/var.h"
+
+namespace pp {
+
+template <class T>
+class CompletionCallbackWithOutput;
+
+namespace ext {
+
+template <class T>
+class Optional;
+
+namespace alarms {
+
+// Data types ------------------------------------------------------------------
+class Alarm_Dev : public internal::OutputObjectBase {
+ public:
+  Alarm_Dev();
+  ~Alarm_Dev();
+
+  bool Populate(const PP_Ext_Alarms_Alarm_Dev& value);
+
+  Var CreateVar() const;
+
+  static const char* const kName;
+  static const char* const kScheduledTime;
+  static const char* const kPeriodInMinutes;
+
+  DictField<std::string> name;
+  DictField<double> scheduled_time;
+  OptionalDictField<double> period_in_minutes;
+};
+
+class AlarmCreateInfo_Dev {
+ public:
+  AlarmCreateInfo_Dev();
+  ~AlarmCreateInfo_Dev();
+
+  bool Populate(const PP_Ext_Alarms_AlarmCreateInfo_Dev& value);
+
+  Var CreateVar() const;
+
+  static const char* const kWhen;
+  static const char* const kDelayInMinutes;
+  static const char* const kPeriodInMinutes;
+
+  OptionalDictField<double> when;
+  OptionalDictField<double> delay_in_minutes;
+  OptionalDictField<double> period_in_minutes;
+};
+
+// Functions -------------------------------------------------------------------
+class Alarms_Dev {
+ public:
+  explicit Alarms_Dev(const InstanceHandle& instance);
+  ~Alarms_Dev();
+
+  void Create(const Optional<std::string>& name,
+              const AlarmCreateInfo_Dev& alarm_info);
+  int32_t Get(const Optional<std::string>& name,
+              const CompletionCallbackWithOutput<Alarm_Dev>& callback);
+  int32_t GetAll(
+      const CompletionCallbackWithOutput<std::vector<Alarm_Dev> >& callback);
+  void Clear(const Optional<std::string>& name);
+  void ClearAll();
+
+ private:
+  InstanceHandle instance_;
+};
+
+// Events ----------------------------------------------------------------------
+// Please see ppapi/cpp/extensions/event_base.h for how to use an event class.
+
+class OnAlarmEvent_Dev
+    : public internal::EventBase1<PP_Ext_Alarms_OnAlarm_Dev, Alarm_Dev> {
+ public:
+  class Listener {
+   public:
+    virtual ~Listener() {}
+
+    virtual void OnAlarm(Alarm_Dev& alarm) = 0;
+  };
+
+  // |listener| is not owned by this instance and must outlive it.
+  OnAlarmEvent_Dev(const InstanceHandle& instance, Listener* listener);
+  virtual ~OnAlarmEvent_Dev();
+
+ private:
+  virtual void Callback(Alarm_Dev& alarm);
+
+  Listener* listener_;
+};
+
+}  // namespace alarms
+}  // namespace ext
+}  // namespace pp
+
+#endif  // PPAPI_CPP_EXTENSIONS_DEV_ALARMS_DEV_H_
diff --git a/ppapi/cpp/extensions/dev/events_dev.cc b/ppapi/cpp/extensions/dev/events_dev.cc
new file mode 100644
index 0000000..4b51fb5
--- /dev/null
+++ b/ppapi/cpp/extensions/dev/events_dev.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/cpp/extensions/dev/events_dev.h"
+
+#include "ppapi/c/extensions/dev/ppb_events_dev.h"
+#include "ppapi/cpp/module_impl.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_Ext_Events_Dev_0_1>() {
+  return PPB_EXT_EVENTS_DEV_INTERFACE_0_1;
+}
+
+}  // namespace
+
+namespace ext {
+namespace events {
+
+// static
+uint32_t Events_Dev::AddListener(PP_Instance instance,
+                                 const PP_Ext_EventListener& listener) {
+  if (!has_interface<PPB_Ext_Events_Dev_0_1>())
+    return 0;
+  return get_interface<PPB_Ext_Events_Dev_0_1>()->AddListener(instance,
+                                                              listener);
+}
+
+// static
+void Events_Dev::RemoveListener(PP_Instance instance,
+                                uint32_t listener_id) {
+  if (has_interface<PPB_Ext_Events_Dev_0_1>()) {
+    get_interface<PPB_Ext_Events_Dev_0_1>()->RemoveListener(instance,
+                                                            listener_id);
+  }
+}
+
+}  // namespace events
+}  // namespace ext
+}  // namespace pp
diff --git a/ppapi/cpp/extensions/dev/events_dev.h b/ppapi/cpp/extensions/dev/events_dev.h
new file mode 100644
index 0000000..e816ca5
--- /dev/null
+++ b/ppapi/cpp/extensions/dev/events_dev.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_EXTENSIONS_DEV_EVENTS_DEV_H_
+#define PPAPI_CPP_EXTENSIONS_DEV_EVENTS_DEV_H_
+
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_stdint.h"
+
+struct PP_Ext_EventListener;
+
+namespace pp {
+namespace ext {
+namespace events {
+
+// This is a simple wrapper of the PPB_Ext_Events_Dev interface.
+//
+// Usually you don't have to directly use this interface. Instead, you could
+// use those more object-oriented event classes. Please see
+// ppapi/cpp/extensions/event_base.h for more details.
+class Events_Dev {
+ public:
+  static uint32_t AddListener(PP_Instance instance,
+                              const PP_Ext_EventListener& listener);
+
+  static void RemoveListener(PP_Instance instance, uint32_t listener_id);
+};
+
+}  // namespace events
+}  // namespace ext
+}  // namespace pp
+
+#endif  // PPAPI_CPP_EXTENSIONS_DEV_EVENTS_DEV_H_
diff --git a/ppapi/cpp/extensions/dict_field.h b/ppapi/cpp/extensions/dict_field.h
new file mode 100644
index 0000000..1a01e44
--- /dev/null
+++ b/ppapi/cpp/extensions/dict_field.h
@@ -0,0 +1,98 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_EXTENSIONS_DICT_FIELD_H_
+#define PPAPI_CPP_EXTENSIONS_DICT_FIELD_H_
+
+#include <string>
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/cpp/dev/var_dictionary_dev.h"
+#include "ppapi/cpp/extensions/from_var_converter.h"
+#include "ppapi/cpp/extensions/optional.h"
+#include "ppapi/cpp/extensions/to_var_converter.h"
+#include "ppapi/cpp/var.h"
+
+namespace pp {
+namespace ext {
+
+template <class T>
+class DictField {
+ public:
+  explicit DictField(const std::string& key) : key_(key), value_() {
+  }
+
+  ~DictField() {
+  }
+
+  const std::string& key() const { return key_; }
+
+  T& value() { return value_; }
+  const T& value() const { return value_; }
+
+  // Adds this field to the dictionary var.
+  bool AddTo(VarDictionary_Dev* dict) const {
+    if (!dict)
+      return false;
+
+    internal::ToVarConverter<T> converter(value_);
+    return PP_ToBool(dict->Set(Var(key_), converter.var()));
+  }
+
+  bool Populate(const VarDictionary_Dev& dict) {
+    Var value_var = dict.Get(Var(key_));
+    if (value_var.is_undefined())
+      return false;
+
+    internal::FromVarConverter<T> converter(value_var.pp_var());
+    value_ = converter.value();
+    return true;
+  }
+
+ private:
+  std::string key_;
+  T value_;
+};
+
+template <class T>
+class OptionalDictField {
+ public:
+  explicit OptionalDictField(const std::string& key) : key_(key) {
+  }
+
+  ~OptionalDictField() {
+  }
+
+  const std::string& key() const { return key_; }
+
+  Optional<T>& value() { return value_; }
+  const Optional<T>& value() const { return value_; }
+
+  // Adds this field to the dictionary var, if |value| has been set.
+  bool MayAddTo(VarDictionary_Dev* dict) const {
+    if (!dict)
+      return false;
+    if (!value_.IsSet())
+      return true;
+
+    internal::ToVarConverter<T> converter(*value_);
+    return PP_ToBool(dict->Set(Var(key_), converter.var()));
+  }
+
+  bool Populate(const VarDictionary_Dev& dict) {
+    Var value_var = dict.Get(Var(key_));
+    internal::FromVarConverter<Optional<T> > converter(value_var.pp_var());
+    value_.Swap(&converter.value());
+    return true;
+  }
+
+ private:
+  std::string key_;
+  Optional<T> value_;
+};
+
+}  // namespace ext
+}  // namespace pp
+
+#endif  // PPAPI_CPP_EXTENSIONS_DICT_FIELD_H_
diff --git a/ppapi/cpp/extensions/event_base.cc b/ppapi/cpp/extensions/event_base.cc
new file mode 100644
index 0000000..210b213
--- /dev/null
+++ b/ppapi/cpp/extensions/event_base.cc
@@ -0,0 +1,44 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/cpp/extensions/event_base.h"
+
+#include "ppapi/cpp/extensions/dev/events_dev.h"
+
+namespace pp {
+namespace ext {
+namespace internal {
+
+GenericEventBase::GenericEventBase(
+    const InstanceHandle& instance,
+    const PP_Ext_EventListener& pp_listener)
+    : instance_(instance),
+      listener_id_(0),
+      pp_listener_(pp_listener) {
+}
+
+GenericEventBase::~GenericEventBase() {
+  StopListening();
+}
+
+bool GenericEventBase::StartListening() {
+  if (IsListening())
+    return true;
+
+  listener_id_ = events::Events_Dev::AddListener(instance_.pp_instance(),
+                                                 pp_listener_);
+  return IsListening();
+}
+
+void GenericEventBase::StopListening() {
+  if (!IsListening())
+    return;
+
+  events::Events_Dev::RemoveListener(instance_.pp_instance(), listener_id_);
+  listener_id_ = 0;
+}
+
+}  // namespace internal
+}  // namespace ext
+}  // namespace pp
diff --git a/ppapi/cpp/extensions/event_base.h b/ppapi/cpp/extensions/event_base.h
new file mode 100644
index 0000000..8a65fb0
--- /dev/null
+++ b/ppapi/cpp/extensions/event_base.h
@@ -0,0 +1,232 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_EXTENSIONS_EVENT_BASE_H_
+#define PPAPI_CPP_EXTENSIONS_EVENT_BASE_H_
+
+#include "ppapi/c/extensions/dev/ppb_events_dev.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/cpp/extensions/from_var_converter.h"
+#include "ppapi/cpp/instance_handle.h"
+#include "ppapi/cpp/logging.h"
+
+namespace pp {
+namespace ext {
+namespace internal {
+
+// This file contains base classes for events. Usually you don't need to use
+// them directly.
+//
+// For each event type, there is a corresponding event class derived from
+// EventBase[0-3]. The event class defines a Listener interface and exposes the
+// public methods of GenericEventBase.
+//
+// Take pp::ext::alarms::OnAlarmEvent_Dev as example, your code to listen to the
+// event would look like this:
+//
+//   class MyListener : public pp::ext::alarms::OnAlarmEvent_Dev {
+//     ...
+//     // The parameter is a non-const reference so you could directly modify it
+//     // if necessary.
+//     virtual void OnAlarm(Alarm_Dev& alarm) {
+//       ...handle the event...
+//     }
+//   };
+//
+//   MyListener on_alarm_listener;
+//   // The listener is not owned by the event and must outlive it.
+//   pp::ext::alarms::OnAlarmEvent_Dev on_alarm(instance, &on_alarm_listener);
+//   on_alarm.StartListening();
+//   ...
+//   // It is guaranteed that |on_alarm_listener| won't get called after
+//   // |on_alarm| goes away. So this step is optional.
+//   on_alarm.StopListening();
+
+class GenericEventBase {
+ public:
+  bool StartListening();
+  void StopListening();
+
+  bool IsListening() const { return listener_id_ != 0; }
+  uint32_t listener_id() const { return listener_id_; }
+
+ protected:
+  GenericEventBase(const InstanceHandle& instance,
+                   const PP_Ext_EventListener& pp_listener);
+  ~GenericEventBase();
+
+  InstanceHandle instance_;
+  uint32_t listener_id_;
+  const PP_Ext_EventListener pp_listener_;
+
+ private:
+  // Disallow copying and assignment.
+  GenericEventBase(const GenericEventBase&);
+  GenericEventBase& operator=(const GenericEventBase&);
+};
+
+// EventBase[0-3] are event base classes which can be instantiated with a
+// pointer to a PP_Ext_EventListener creation function and the input parameter
+// types of the listener callback.
+//
+// For example, EvenBase1<PP_Ext_Alarms_OnAlarm_Dev, Alarm_Dev> deals with
+// the event type defined by the PP_Ext_Alarms_OnAlarm_Dev function pointer. And
+// it defines a pure virtual method as the listener callback:
+//   virtual void Callback(Alarm_Dev&) = 0;
+
+typedef PP_Ext_EventListener (*CreatePPEventListener0)(
+    void (*)(uint32_t, void*), void*);
+template <const CreatePPEventListener0 kCreatePPEventListener0>
+class EventBase0 : public GenericEventBase {
+ public:
+  explicit EventBase0(const InstanceHandle& instance)
+      : PP_ALLOW_THIS_IN_INITIALIZER_LIST(
+            GenericEventBase(instance,
+                             kCreatePPEventListener0(&CallbackThunk, this))) {
+  }
+
+  virtual ~EventBase0() {}
+
+ private:
+  virtual void Callback() = 0;
+
+  static void CallbackThunk(uint32_t listener_id, void* user_data) {
+    EventBase0<kCreatePPEventListener0>* event_base =
+        static_cast<EventBase0<kCreatePPEventListener0>*>(user_data);
+    PP_DCHECK(listener_id == event_base->listener_id_);
+    // Suppress unused variable warnings.
+    static_cast<void>(listener_id);
+
+    event_base->Callback();
+  }
+
+  // Disallow copying and assignment.
+  EventBase0(const EventBase0<kCreatePPEventListener0>&);
+  EventBase0<kCreatePPEventListener0>& operator=(
+      const EventBase0<kCreatePPEventListener0>&);
+};
+
+typedef PP_Ext_EventListener (*CreatePPEventListener1)(
+    void (*)(uint32_t, void*, PP_Var), void*);
+template <const CreatePPEventListener1 kCreatePPEventListener1, class A>
+class EventBase1 : public GenericEventBase {
+ public:
+  explicit EventBase1(const InstanceHandle& instance)
+      : PP_ALLOW_THIS_IN_INITIALIZER_LIST(
+            GenericEventBase(instance,
+                             kCreatePPEventListener1(&CallbackThunk, this))) {
+  }
+
+  virtual ~EventBase1() {}
+
+ private:
+  virtual void Callback(A&) = 0;
+
+  static void CallbackThunk(uint32_t listener_id,
+                            void* user_data,
+                            PP_Var var_a) {
+    EventBase1<kCreatePPEventListener1, A>* event_base =
+        static_cast<EventBase1<kCreatePPEventListener1, A>*>(user_data);
+    PP_DCHECK(listener_id == event_base->listener_id_);
+    // Suppress unused variable warnings.
+    static_cast<void>(listener_id);
+
+    FromVarConverter<A> a(var_a);
+    event_base->Callback(a.value());
+  }
+
+  // Disallow copying and assignment.
+  EventBase1(const EventBase1<kCreatePPEventListener1, A>&);
+  EventBase1<kCreatePPEventListener1, A>& operator=(
+      const EventBase1<kCreatePPEventListener1, A>&);
+};
+
+typedef PP_Ext_EventListener (*CreatePPEventListener2)(
+    void (*)(uint32_t, void*, PP_Var, PP_Var), void*);
+template <const CreatePPEventListener2 kCreatePPEventListener2,
+          class A,
+          class B>
+class EventBase2 : public GenericEventBase {
+ public:
+  explicit EventBase2(const InstanceHandle& instance)
+      : PP_ALLOW_THIS_IN_INITIALIZER_LIST(
+            GenericEventBase(instance,
+                             kCreatePPEventListener2(&CallbackThunk, this))) {
+  }
+
+  virtual ~EventBase2() {}
+
+ private:
+  virtual void Callback(A&, B&) = 0;
+
+  static void CallbackThunk(uint32_t listener_id,
+                            void* user_data,
+                            PP_Var var_a,
+                            PP_Var var_b) {
+    EventBase2<kCreatePPEventListener2, A, B>* event_base =
+        static_cast<EventBase2<kCreatePPEventListener2, A, B>*>(user_data);
+    PP_DCHECK(listener_id == event_base->listener_id_);
+    // Suppress unused variable warnings.
+    static_cast<void>(listener_id);
+
+    FromVarConverter<A> a(var_a);
+    FromVarConverter<B> b(var_b);
+    event_base->Callback(a.value(), b.value());
+  }
+
+  // Disallow copying and assignment.
+  EventBase2(const EventBase2<kCreatePPEventListener2, A, B>&);
+  EventBase2<kCreatePPEventListener2, A, B>& operator=(
+      const EventBase2<kCreatePPEventListener2, A, B>&);
+};
+
+typedef PP_Ext_EventListener (*CreatePPEventListener3)(
+    void (*)(uint32_t, void*, PP_Var, PP_Var, PP_Var), void*);
+template <const CreatePPEventListener3 kCreatePPEventListener3,
+          class A,
+          class B,
+          class C>
+class EventBase3 : public GenericEventBase {
+ public:
+  explicit EventBase3(const InstanceHandle& instance)
+      : PP_ALLOW_THIS_IN_INITIALIZER_LIST(
+            GenericEventBase(instance,
+                             kCreatePPEventListener3(&CallbackThunk, this))) {
+  }
+
+  virtual ~EventBase3() {}
+
+ private:
+  virtual void Callback(A&, B&, C&) = 0;
+
+  static void CallbackThunk(uint32_t listener_id,
+                            void* user_data,
+                            PP_Var var_a,
+                            PP_Var var_b,
+                            PP_Var var_c) {
+    EventBase3<kCreatePPEventListener3, A, B, C>* event_base =
+        static_cast<EventBase3<kCreatePPEventListener3, A, B, C>*>(user_data);
+    PP_DCHECK(listener_id == event_base->listener_id_);
+    // Suppress unused variable warnings.
+    static_cast<void>(listener_id);
+
+    FromVarConverter<A> a(var_a);
+    FromVarConverter<B> b(var_b);
+    FromVarConverter<C> c(var_c);
+    event_base->Callback(a.value(), b.value(), c.value());
+  }
+
+  // Disallow copying and assignment.
+  EventBase3(const EventBase3<kCreatePPEventListener3, A, B, C>&);
+  EventBase3<kCreatePPEventListener3, A, B, C>& operator=(
+      const EventBase3<kCreatePPEventListener3, A, B, C>&);
+};
+
+}  // namespace internal
+}  // namespace ext
+}  // namespace pp
+
+#endif  // PPAPI_CPP_EXTENSIONS_EVENT_BASE_H_
diff --git a/ppapi/cpp/extensions/ext_output_traits.h b/ppapi/cpp/extensions/ext_output_traits.h
new file mode 100644
index 0000000..d03258d
--- /dev/null
+++ b/ppapi/cpp/extensions/ext_output_traits.h
@@ -0,0 +1,143 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_EXTENSIONS_OUTPUT_TRAITS_H_
+#define PPAPI_CPP_EXTENSIONS_OUTPUT_TRAITS_H_
+
+#include <vector>
+
+#include "ppapi/c/pp_var.h"
+#include "ppapi/cpp/dev/var_array_dev.h"
+#include "ppapi/cpp/extensions/from_var_converter.h"
+#include "ppapi/cpp/logging.h"
+#include "ppapi/cpp/pass_ref.h"
+#include "ppapi/cpp/var.h"
+
+namespace pp {
+namespace ext {
+namespace internal {
+
+// Base class for all those types within the pp::ext namespace that are used
+// with CompletionCallbackWithOutput. This class doesn't do anything itself,
+// but it affects the behavior of CallbackOutputTraits for all its subclasses.
+//
+// TODO(yzshen): Within pp::ext, basic types such as std::string or double may
+// be used with CompletionCallbackWithOutput as well. This approach doesn't
+// work for them. One way is to refactor CallbackOutputTraits to consider not
+// only the output C++ object type, but also the output parameter type that the
+// C interface uses. And then we can remove this class.
+class OutputObjectBase {
+};
+
+template <class T>
+class VarOutputAdapterWithStorage {
+ public:
+  VarOutputAdapterWithStorage() : pp_var_(PP_MakeUndefined()) {
+  }
+
+  ~VarOutputAdapterWithStorage() {
+    PP_DCHECK(pp_var_.type == PP_VARTYPE_UNDEFINED);
+  }
+
+  PP_Var& pp_var() { return pp_var_; }
+
+  T& output() {
+    Var auto_release(PASS_REF, pp_var_);
+    converter_.Set(pp_var_);
+    pp_var_ = PP_MakeUndefined();
+    return converter_.value();
+  }
+
+ private:
+  PP_Var pp_var_;
+  FromVarConverter<T> converter_;
+
+  // Disallow copying and assignment.
+  VarOutputAdapterWithStorage(const VarOutputAdapterWithStorage<T>&);
+  VarOutputAdapterWithStorage<T>& operator=(
+      const VarOutputAdapterWithStorage<T>&);
+};
+
+template <class T>
+struct ExtensionsCallbackOutputTraits {
+  typedef PP_Var* APIArgType;
+  typedef VarOutputAdapterWithStorage<T> StorageType;
+
+  static inline APIArgType StorageToAPIArg(StorageType& t) {
+    return &t.pp_var();
+  }
+
+  // This must be called exactly once to consume the one PP_Var reference
+  // assigned to us by the browser.
+  static inline T& StorageToPluginArg(StorageType& t) {
+    return t.output();
+  }
+};
+
+// This class provides storage for a PP_Var and a vector of objects which are
+// of type T. The PP_Var is used as an output parameter to recevie an array var
+// from the browser. Each element in the array var is converted to a T object,
+// using FromVarConverter, and stores in the vector.
+template <class T>
+class ArrayVarOutputAdapterWithStorage {
+ public:
+  ArrayVarOutputAdapterWithStorage() : pp_var_(PP_MakeUndefined()) {
+  }
+
+  ~ArrayVarOutputAdapterWithStorage() {
+    PP_DCHECK(pp_var_.type == PP_VARTYPE_UNDEFINED);
+  }
+
+  PP_Var& pp_var() { return pp_var_; }
+
+  std::vector<T>& output() {
+    PP_DCHECK(output_storage_.empty());
+
+    Var var(PASS_REF, pp_var_);
+    pp_var_ = PP_MakeUndefined();
+    if (var.is_array()) {
+      VarArray_Dev array(var);
+
+      uint32_t length = array.GetLength();
+      output_storage_.reserve(length);
+      for (uint32_t i = 0; i < length; ++i) {
+        FromVarConverter<T> converter(array.Get(i).pp_var());
+        output_storage_.push_back(converter.value());
+      }
+    }
+
+    return output_storage_;
+  }
+
+ private:
+  PP_Var pp_var_;
+  std::vector<T> output_storage_;
+
+  // Disallow copying and assignment.
+  ArrayVarOutputAdapterWithStorage(const ArrayVarOutputAdapterWithStorage<T>&);
+  ArrayVarOutputAdapterWithStorage<T>& operator=(
+      const ArrayVarOutputAdapterWithStorage<T>&);
+};
+
+template <class T>
+struct ExtensionsVectorCallbackOutputTraits {
+  typedef PP_Var* APIArgType;
+  typedef ArrayVarOutputAdapterWithStorage<T> StorageType;
+
+  static inline APIArgType StorageToAPIArg(StorageType& t) {
+    return &t.pp_var();
+  }
+
+  // This must be called exactly once to consume the one PP_Var reference
+  // assigned to us by the browser.
+  static inline std::vector<T>& StorageToPluginArg(StorageType& t) {
+    return t.output();
+  }
+};
+
+}  // namespace internal
+}  // namespace ext
+}  // namespace pp
+
+#endif  // PPAPI_CPP_EXTENSIONS_OUTPUT_TRAITS_H_
diff --git a/ppapi/cpp/extensions/from_var_converter.h b/ppapi/cpp/extensions/from_var_converter.h
new file mode 100644
index 0000000..6fb8a32
--- /dev/null
+++ b/ppapi/cpp/extensions/from_var_converter.h
@@ -0,0 +1,122 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_EXTENSIONS_FROM_VAR_CONVERTOR_H_
+#define PPAPI_CPP_EXTENSIONS_FROM_VAR_CONVERTOR_H_
+
+#include <string>
+
+#include "ppapi/c/pp_var.h"
+#include "ppapi/cpp/extensions/optional.h"
+#include "ppapi/cpp/logging.h"
+#include "ppapi/cpp/var.h"
+
+namespace pp {
+namespace ext {
+namespace internal {
+
+template <class T>
+class FromVarConverterBase {
+ public:
+  T& value() { return value_; }
+
+ protected:
+  FromVarConverterBase() : value_() {
+  }
+
+  explicit FromVarConverterBase(const T& value) : value_(value) {
+  }
+
+  ~FromVarConverterBase() {
+  }
+
+  T value_;
+};
+
+template <class T>
+class FromVarConverter : public FromVarConverterBase<T> {
+ public:
+  FromVarConverter() {
+  }
+
+  FromVarConverter(const PP_Var& var) {
+    Set(var);
+  }
+
+  ~FromVarConverter() {
+  }
+
+  void Set(const PP_Var& var) {
+    bool succeeded = FromVarConverterBase<T>::value_.Populate(var);
+    // Suppress unused variable warnings.
+    static_cast<void>(succeeded);
+    PP_DCHECK(succeeded);
+  }
+};
+
+template <class T>
+class FromVarConverter<Optional<T> >
+    : public FromVarConverterBase<Optional<T> > {
+ public:
+  FromVarConverter() {
+  }
+
+  FromVarConverter(const PP_Var& var) {
+    Set(var);
+  }
+
+  ~FromVarConverter() {
+  }
+
+  void Set(const PP_Var& var) {
+    if (var.type == PP_VARTYPE_UNDEFINED) {
+      FromVarConverterBase<Optional<T> >::value_.Reset();
+    } else {
+      FromVarConverter<T> converter(var);
+      FromVarConverterBase<Optional<T> >::value_ = converter.value();
+    }
+  }
+};
+
+template <>
+class FromVarConverter<std::string> : public FromVarConverterBase<std::string> {
+ public:
+  FromVarConverter() {
+  }
+
+  FromVarConverter(const PP_Var& var) {
+    Set(var);
+  }
+
+  ~FromVarConverter() {
+  }
+
+  void Set(const PP_Var& var) {
+    FromVarConverterBase<std::string>::value_ = Var(var).AsString();
+  }
+};
+
+template <>
+class FromVarConverter<double> : public FromVarConverterBase<double> {
+ public:
+  FromVarConverter() {
+  }
+
+  FromVarConverter(const PP_Var& var) {
+    Set(var);
+  }
+
+  ~FromVarConverter() {
+  }
+
+  void Set(const PP_Var& var) {
+    FromVarConverterBase<double>::value_ = Var(var).AsDouble();
+  }
+};
+
+}  // namespace internal
+}  // namespace ext
+}  // namespace pp
+
+#endif  // PPAPI_CPP_EXTENSIONS_FROM_VAR_CONVERTOR_H_
diff --git a/ppapi/cpp/extensions/optional.h b/ppapi/cpp/extensions/optional.h
new file mode 100644
index 0000000..fdef839
--- /dev/null
+++ b/ppapi/cpp/extensions/optional.h
@@ -0,0 +1,97 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_EXTENSIONS_OPTIONAL_H_
+#define PPAPI_CPP_EXTENSIONS_OPTIONAL_H_
+
+namespace pp {
+namespace ext {
+
+template <class T>
+class Optional {
+ public:
+  Optional() : value_(NULL) {
+  }
+  // Takes ownership of |value|.
+  explicit Optional(T* value) : value_(value) {
+  }
+  Optional(const T& value) : value_(new T(value)) {
+  }
+  Optional(const Optional<T>& other)
+      : value_(other.value_ ? new T(*other.value_) : NULL) {
+  }
+
+  ~Optional() {
+    Reset();
+  }
+
+  Optional<T>& operator=(const T& other) {
+    if (value_ == &other)
+      return *this;
+
+    Reset();
+    value_ = new T(other);
+
+    return *this;
+  }
+
+  Optional<T>& operator=(const Optional<T>& other) {
+    if (value_ == other.value_)
+      return *this;
+
+    Reset();
+    if (other.value_)
+      value_ = new T(*other.value_);
+
+    return *this;
+  }
+
+  bool IsSet() const {
+    return !!value_;
+  }
+
+  T* Get() const {
+    return value_;
+  }
+
+  // Should only be used when IsSet() is true.
+  T& operator*() const {
+    return *value_;
+  }
+
+  // Should only be used when IsSet() is true.
+  T* operator->() const {
+    PP_DCHECK(value_);
+    return value_;
+  }
+
+  // Takes ownership of |value|.
+  void Set(T* value) {
+    if (value == value_)
+      return;
+
+    Reset();
+    *value_ = value;
+  }
+
+  void Reset() {
+    T* value = value_;
+    value_ = NULL;
+    delete value;
+  }
+
+  void Swap(Optional<T>* other) {
+    T* temp = value_;
+    value_ = other->value_;
+    other->value_ = temp;
+  }
+
+ private:
+  T* value_;
+};
+
+}  // namespace ext
+}  // namespace pp
+
+#endif  // PPAPI_CPP_EXTENSIONS_OPTIONAL_H_
diff --git a/ppapi/cpp/extensions/to_var_converter.h b/ppapi/cpp/extensions/to_var_converter.h
new file mode 100644
index 0000000..ba05064
--- /dev/null
+++ b/ppapi/cpp/extensions/to_var_converter.h
@@ -0,0 +1,93 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_EXTENSIONS_TO_VAR_CONVERTOR_H_
+#define PPAPI_CPP_EXTENSIONS_TO_VAR_CONVERTOR_H_
+
+#include <string>
+
+#include "ppapi/c/pp_var.h"
+#include "ppapi/cpp/extensions/optional.h"
+#include "ppapi/cpp/var.h"
+
+namespace pp {
+namespace ext {
+namespace internal {
+
+class ToVarConverterBase {
+ public:
+  PP_Var pp_var() const {
+    return var_.pp_var();
+  }
+
+  const Var& var() const {
+    return var_;
+  }
+
+ protected:
+  ToVarConverterBase() {
+  }
+
+  explicit ToVarConverterBase(const PP_Var& var) : var_(var) {
+  }
+
+  explicit ToVarConverterBase(const Var& var): var_(var) {
+  }
+
+  ~ToVarConverterBase() {
+  }
+
+  Var var_;
+};
+
+template <class T>
+class ToVarConverter : public ToVarConverterBase {
+ public:
+  explicit ToVarConverter(const T& object)
+      : ToVarConverterBase(object.CreateVar()) {
+  }
+
+  ~ToVarConverter() {
+  }
+};
+
+template <class T>
+class ToVarConverter<Optional<T> > : public ToVarConverterBase {
+ public:
+  explicit ToVarConverter(const Optional<T>& object)
+      : ToVarConverterBase(
+          object.IsSet() ? ToVarConverter<T>(*object).pp_var() :
+                           PP_MakeUndefined()) {
+  }
+
+  ~ToVarConverter() {
+  }
+};
+
+template <>
+class ToVarConverter<std::string> : public ToVarConverterBase {
+ public:
+  explicit ToVarConverter(const std::string& object)
+      : ToVarConverterBase(Var(object)) {
+  }
+
+  ~ToVarConverter() {
+  }
+};
+
+template <>
+class ToVarConverter<double> : public ToVarConverterBase {
+ public:
+  explicit ToVarConverter(double object) : ToVarConverterBase(Var(object)) {
+  }
+
+  ~ToVarConverter() {
+  }
+};
+
+}  // namespace internal
+}  // namespace ext
+}  // namespace pp
+
+#endif  // PPAPI_CPP_EXTENSIONS_TO_VAR_CONVERTOR_H_
diff --git a/ppapi/cpp/file_io.cc b/ppapi/cpp/file_io.cc
index e596577..faaf284 100644
--- a/ppapi/cpp/file_io.cc
+++ b/ppapi/cpp/file_io.cc
@@ -4,9 +4,12 @@
 
 #include "ppapi/cpp/file_io.h"
 
+#include <string.h>  // memcpy
+
 #include "ppapi/c/ppb_file_io.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/dev/resource_array_dev.h"
 #include "ppapi/cpp/file_ref.h"
 #include "ppapi/cpp/instance_handle.h"
 #include "ppapi/cpp/module.h"
@@ -20,16 +23,23 @@
   return PPB_FILEIO_INTERFACE_1_0;
 }
 
+template <> const char* interface_name<PPB_FileIO_1_1>() {
+  return PPB_FILEIO_INTERFACE_1_1;
+}
+
 }  // namespace
 
 FileIO::FileIO() {
 }
 
 FileIO::FileIO(const InstanceHandle& instance) {
-  if (!has_interface<PPB_FileIO_1_0>())
-    return;
-  PassRefFromConstructor(get_interface<PPB_FileIO_1_0>()->Create(
-      instance.pp_instance()));
+  if (has_interface<PPB_FileIO_1_1>()) {
+    PassRefFromConstructor(get_interface<PPB_FileIO_1_1>()->Create(
+        instance.pp_instance()));
+  } else if (has_interface<PPB_FileIO_1_0>()) {
+    PassRefFromConstructor(get_interface<PPB_FileIO_1_0>()->Create(
+        instance.pp_instance()));
+  }
 }
 
 FileIO::FileIO(const FileIO& other)
@@ -39,71 +49,147 @@
 int32_t FileIO::Open(const FileRef& file_ref,
                      int32_t open_flags,
                      const CompletionCallback& cc) {
-  if (!has_interface<PPB_FileIO_1_0>())
-    return cc.MayForce(PP_ERROR_NOINTERFACE);
-  return get_interface<PPB_FileIO_1_0>()->Open(
-      pp_resource(), file_ref.pp_resource(), open_flags,
-      cc.pp_completion_callback());
+  if (has_interface<PPB_FileIO_1_1>()) {
+    return get_interface<PPB_FileIO_1_1>()->Open(
+        pp_resource(), file_ref.pp_resource(), open_flags,
+        cc.pp_completion_callback());
+  } else if (has_interface<PPB_FileIO_1_0>()) {
+    return get_interface<PPB_FileIO_1_0>()->Open(
+        pp_resource(), file_ref.pp_resource(), open_flags,
+        cc.pp_completion_callback());
+  }
+  return cc.MayForce(PP_ERROR_NOINTERFACE);
 }
 
 int32_t FileIO::Query(PP_FileInfo* result_buf,
                       const CompletionCallback& cc) {
-  if (!has_interface<PPB_FileIO_1_0>())
-    return cc.MayForce(PP_ERROR_NOINTERFACE);
-  return get_interface<PPB_FileIO_1_0>()->Query(
-      pp_resource(), result_buf, cc.pp_completion_callback());
+  if (has_interface<PPB_FileIO_1_1>()) {
+    return get_interface<PPB_FileIO_1_1>()->Query(
+        pp_resource(), result_buf, cc.pp_completion_callback());
+  } else if (has_interface<PPB_FileIO_1_0>()) {
+    return get_interface<PPB_FileIO_1_0>()->Query(
+        pp_resource(), result_buf, cc.pp_completion_callback());
+  }
+  return cc.MayForce(PP_ERROR_NOINTERFACE);
 }
 
 int32_t FileIO::Touch(PP_Time last_access_time,
                       PP_Time last_modified_time,
                       const CompletionCallback& cc) {
-  if (!has_interface<PPB_FileIO_1_0>())
-    return cc.MayForce(PP_ERROR_NOINTERFACE);
-  return get_interface<PPB_FileIO_1_0>()->Touch(
-      pp_resource(), last_access_time, last_modified_time,
-      cc.pp_completion_callback());
+  if (has_interface<PPB_FileIO_1_1>()) {
+    return get_interface<PPB_FileIO_1_1>()->Touch(
+        pp_resource(), last_access_time, last_modified_time,
+        cc.pp_completion_callback());
+  } else if (has_interface<PPB_FileIO_1_0>()) {
+    return get_interface<PPB_FileIO_1_0>()->Touch(
+        pp_resource(), last_access_time, last_modified_time,
+        cc.pp_completion_callback());
+  }
+  return cc.MayForce(PP_ERROR_NOINTERFACE);
 }
 
 int32_t FileIO::Read(int64_t offset,
                      char* buffer,
                      int32_t bytes_to_read,
                      const CompletionCallback& cc) {
-  if (!has_interface<PPB_FileIO_1_0>())
-    return cc.MayForce(PP_ERROR_NOINTERFACE);
-  return get_interface<PPB_FileIO_1_0>()->Read(pp_resource(),
-      offset, buffer, bytes_to_read, cc.pp_completion_callback());
+  if (has_interface<PPB_FileIO_1_1>()) {
+    return get_interface<PPB_FileIO_1_1>()->Read(pp_resource(),
+        offset, buffer, bytes_to_read, cc.pp_completion_callback());
+  } else if (has_interface<PPB_FileIO_1_0>()) {
+    return get_interface<PPB_FileIO_1_0>()->Read(pp_resource(),
+        offset, buffer, bytes_to_read, cc.pp_completion_callback());
+  }
+  return cc.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+int32_t FileIO::Read(
+    int32_t offset,
+    int32_t max_read_length,
+    const CompletionCallbackWithOutput< std::vector<char> >& cc) {
+  if (has_interface<PPB_FileIO_1_1>()) {
+    PP_ArrayOutput array_output = cc.output();
+    return get_interface<PPB_FileIO_1_1>()->ReadToArray(pp_resource(),
+        offset, max_read_length, &array_output,
+        cc.pp_completion_callback());
+  } else if (has_interface<PPB_FileIO_1_0>()) {
+    // Data for our callback wrapper. The callback handler will delete it and
+    // temp_buffer.
+    CallbackData1_0* data = new CallbackData1_0;
+    data->output = cc.output();
+    data->temp_buffer = max_read_length >= 0 ? new char[max_read_length] : NULL;
+    data->original_callback = cc.pp_completion_callback();
+
+    // Actual returned bytes might not equals to max_read_length.  We need to
+    // read to a temporary buffer first and copy later to make sure the array
+    // buffer has correct size.
+    return get_interface<PPB_FileIO_1_0>()->Read(
+        pp_resource(), offset, data->temp_buffer, max_read_length,
+        PP_MakeCompletionCallback(&CallbackConverter, data));
+  }
+  return cc.MayForce(PP_ERROR_NOINTERFACE);
 }
 
 int32_t FileIO::Write(int64_t offset,
                       const char* buffer,
                       int32_t bytes_to_write,
                       const CompletionCallback& cc) {
-  if (!has_interface<PPB_FileIO_1_0>())
-    return cc.MayForce(PP_ERROR_NOINTERFACE);
-  return get_interface<PPB_FileIO_1_0>()->Write(
-      pp_resource(), offset, buffer, bytes_to_write,
-      cc.pp_completion_callback());
+  if (has_interface<PPB_FileIO_1_1>()) {
+    return get_interface<PPB_FileIO_1_1>()->Write(
+        pp_resource(), offset, buffer, bytes_to_write,
+        cc.pp_completion_callback());
+  } else if (has_interface<PPB_FileIO_1_0>()) {
+    return get_interface<PPB_FileIO_1_0>()->Write(
+        pp_resource(), offset, buffer, bytes_to_write,
+        cc.pp_completion_callback());
+  }
+  return cc.MayForce(PP_ERROR_NOINTERFACE);
 }
 
 int32_t FileIO::SetLength(int64_t length,
                           const CompletionCallback& cc) {
-  if (!has_interface<PPB_FileIO_1_0>())
-    return cc.MayForce(PP_ERROR_NOINTERFACE);
-  return get_interface<PPB_FileIO_1_0>()->SetLength(
-      pp_resource(), length, cc.pp_completion_callback());
+  if (has_interface<PPB_FileIO_1_1>()) {
+    return get_interface<PPB_FileIO_1_1>()->SetLength(
+        pp_resource(), length, cc.pp_completion_callback());
+  } else if (has_interface<PPB_FileIO_1_0>()) {
+    return get_interface<PPB_FileIO_1_0>()->SetLength(
+        pp_resource(), length, cc.pp_completion_callback());
+  }
+  return cc.MayForce(PP_ERROR_NOINTERFACE);
 }
 
 int32_t FileIO::Flush(const CompletionCallback& cc) {
-  if (!has_interface<PPB_FileIO_1_0>())
-    return cc.MayForce(PP_ERROR_NOINTERFACE);
-  return get_interface<PPB_FileIO_1_0>()->Flush(
-      pp_resource(), cc.pp_completion_callback());
+  if (has_interface<PPB_FileIO_1_1>()) {
+    return get_interface<PPB_FileIO_1_1>()->Flush(
+        pp_resource(), cc.pp_completion_callback());
+  } else if (has_interface<PPB_FileIO_1_0>()) {
+    return get_interface<PPB_FileIO_1_0>()->Flush(
+        pp_resource(), cc.pp_completion_callback());
+  }
+  return cc.MayForce(PP_ERROR_NOINTERFACE);
 }
 
 void FileIO::Close() {
-  if (!has_interface<PPB_FileIO_1_0>())
-    return;
-  get_interface<PPB_FileIO_1_0>()->Close(pp_resource());
+  if (has_interface<PPB_FileIO_1_1>())
+    get_interface<PPB_FileIO_1_1>()->Close(pp_resource());
+  else if (has_interface<PPB_FileIO_1_0>())
+    get_interface<PPB_FileIO_1_0>()->Close(pp_resource());
+}
+
+// static
+void FileIO::CallbackConverter(void* user_data, int32_t result) {
+  CallbackData1_0* data = static_cast<CallbackData1_0*>(user_data);
+
+  if (result >= 0) {
+    // Copy to the destination buffer owned by the callback.
+    char* buffer = static_cast<char*>(data->output.GetDataBuffer(
+        data->output.user_data, result, sizeof(char)));
+    memcpy(buffer, data->temp_buffer, result);
+    delete[] data->temp_buffer;
+  }
+
+  // Now execute the original callback.
+  PP_RunCompletionCallback(&data->original_callback, result);
+  delete data;
 }
 
 }  // namespace pp
diff --git a/ppapi/cpp/file_io.h b/ppapi/cpp/file_io.h
index 0d8dcc9..bf2c857 100644
--- a/ppapi/cpp/file_io.h
+++ b/ppapi/cpp/file_io.h
@@ -6,6 +6,7 @@
 #define PPAPI_CPP_FILE_IO_H_
 
 #include "ppapi/c/pp_time.h"
+#include "ppapi/cpp/completion_callback.h"
 #include "ppapi/cpp/resource.h"
 
 /// @file
@@ -15,7 +16,6 @@
 
 namespace pp {
 
-class CompletionCallback;
 class FileRef;
 class InstanceHandle;
 
@@ -45,8 +45,17 @@
   ///
   /// @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
   /// reference.
+  ///
   /// @param[in] open_flags A bit-mask of the <code>PP_FileOpenFlags</code>
-  /// values.
+  /// values. Valid values are:
+  ///  - PP_FILEOPENFLAG_READ
+  ///  - PP_FILEOPENFLAG_WRITE
+  ///  - PP_FILEOPENFLAG_CREATE
+  ///  - PP_FILEOPENFLAG_TRUNCATE
+  ///  - PP_FILEOPENFLAG_EXCLUSIVE
+  /// See <code>PP_FileOpenFlags</code> in <code>ppb_file_io.h</code> for more
+  /// details on these flags.
+  ///
   /// @param[in] cc A <code>CompletionCallback</code> to be called upon
   /// completion of Open().
   ///
@@ -83,9 +92,46 @@
                 PP_Time last_modified_time,
                 const CompletionCallback& cc);
 
-  /// Read() reads from an offset in the file.  The size of the buffer must be
-  /// large enough to hold the specified number of bytes to read.  This
-  /// function might perform a partial read.
+  /// Reads from an offset in the file.
+  ///
+  /// The size of the buffer must be large enough to hold the specified number
+  /// of bytes to read.  This function might perform a partial read, meaning
+  /// that all the requested bytes might not be returned, even if the end of the
+  /// file has not been reached.
+  ///
+  /// This function reads into a buffer that the caller supplies. This buffer
+  /// must remain valid as long as the FileIO resource is alive. If you use
+  /// a completion callback factory and it goes out of scope, it will not issue
+  /// the callback on your class, BUT the callback factory can NOT cancel
+  /// the request from the browser's perspective. This means that the browser
+  /// will still try to write to your buffer even if the callback factory is
+  /// destroyed!
+  ///
+  /// So you must ensure that your buffer outlives the FileIO resource. If you
+  /// have one class and use the FileIO resource exclusively from that class
+  /// and never make any copies, this will be fine: the resource will be
+  /// destroyed when your class is. But keep in mind that copying a pp::FileIO
+  /// object just creates a second reference to the original resource. For
+  /// example, if you have a function like this:
+  ///   pp::FileIO MyClass::GetFileIO();
+  /// where a copy of your FileIO resource could outlive your class, the
+  /// callback will still be pending when your class goes out of scope, creating
+  /// the possibility of writing into invalid memory. So it's recommended to
+  /// keep your FileIO resource and any oubput buffers tightly controlled in
+  /// the same scope.
+  ///
+  /// <strong>Caveat:</strong> This Read() is potentially unsafe if you're using
+  /// a CompletionCallbackFactory to scope callbacks to the lifetime of your
+  /// class.  When your class goes out of scope, the callback factory will not
+  /// actually cancel the callback, but will rather just skip issuing the
+  /// callback on your class.  This means that if the FileIO object outlives
+  /// your class (if you made a copy saved somewhere else, for example), then
+  /// the browser will still try to write into your buffer when the
+  /// asynchronous read completes, potentially causing a crash.
+  ///
+  /// See the other version of Read() which avoids this problem by writing into
+  /// CompletionCallbackWithOutput, where the output buffer is automatically
+  /// managed by the callback.
   ///
   /// @param[in] offset The offset into the file.
   /// @param[in] buffer The buffer to hold the specified number of bytes read.
@@ -103,6 +149,28 @@
                int32_t bytes_to_read,
                const CompletionCallback& cc);
 
+  /// Read() reads from an offset in the file.  A PP_ArrayOutput must be
+  /// provided so that output will be stored in its allocated buffer.  This
+  /// function might perform a partial read.
+  ///
+  /// @param[in] file_io A <code>PP_Resource</code> corresponding to a file
+  /// FileIO.
+  /// @param[in] offset The offset into the file.
+  /// @param[in] max_read_length The maximum number of bytes to read from
+  /// <code>offset</code>.
+  /// @param[in] output A <code>PP_ArrayOutput</code> to hold the output data.
+  /// @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+  /// completion of Read().
+  ///
+  /// @return The number of bytes read or an error code from
+  /// <code>pp_errors.h</code>. If the return value is 0, then end-of-file was
+  /// reached. It is valid to call Read() multiple times with a completion
+  /// callback to queue up parallel reads from the file, but pending reads
+  /// cannot be interleaved with other operations.
+  int32_t Read(int32_t offset,
+               int32_t max_read_length,
+               const CompletionCallbackWithOutput< std::vector<char> >& cc);
+
   /// Write() writes to an offset in the file.  This function might perform a
   /// partial write. The FileIO object must have been opened with write access.
   ///
@@ -153,6 +221,21 @@
   /// open, then it will be implicitly closed, so you are not required to call
   /// Close().
   void Close();
+
+ private:
+  struct CallbackData1_0 {
+    PP_ArrayOutput output;
+    char* temp_buffer;
+    PP_CompletionCallback original_callback;
+  };
+
+  // Provide backwards-compatability for older Read versions. Converts the
+  // old-style "char*" output buffer of 1.0 to the new "PP_ArrayOutput"
+  // interface in 1.1.
+  //
+  // This takes a heap-allocated CallbackData1_0 struct passed as the user data
+  // and deletes it when the call completes.
+  static void CallbackConverter(void* user_data, int32_t result);
 };
 
 }  // namespace pp
diff --git a/ppapi/cpp/graphics_2d.cc b/ppapi/cpp/graphics_2d.cc
index 69bba9c..f4cd645 100644
--- a/ppapi/cpp/graphics_2d.cc
+++ b/ppapi/cpp/graphics_2d.cc
@@ -62,9 +62,9 @@
   if (!has_interface<PPB_Graphics2D_1_0>())
     return;
   get_interface<PPB_Graphics2D_1_0>()->PaintImageData(pp_resource(),
-                                                  image.pp_resource(),
-                                                  &top_left.pp_point(),
-                                                  NULL);
+                                                      image.pp_resource(),
+                                                      &top_left.pp_point(),
+                                                      NULL);
 }
 
 void Graphics2D::PaintImageData(const ImageData& image,
@@ -73,24 +73,24 @@
   if (!has_interface<PPB_Graphics2D_1_0>())
     return;
   get_interface<PPB_Graphics2D_1_0>()->PaintImageData(pp_resource(),
-                                                  image.pp_resource(),
-                                                  &top_left.pp_point(),
-                                                  &src_rect.pp_rect());
+                                                      image.pp_resource(),
+                                                      &top_left.pp_point(),
+                                                      &src_rect.pp_rect());
 }
 
 void Graphics2D::Scroll(const Rect& clip, const Point& amount) {
   if (!has_interface<PPB_Graphics2D_1_0>())
     return;
   get_interface<PPB_Graphics2D_1_0>()->Scroll(pp_resource(),
-                                          &clip.pp_rect(),
-                                          &amount.pp_point());
+                                              &clip.pp_rect(),
+                                              &amount.pp_point());
 }
 
 void Graphics2D::ReplaceContents(ImageData* image) {
   if (!has_interface<PPB_Graphics2D_1_0>())
     return;
   get_interface<PPB_Graphics2D_1_0>()->ReplaceContents(pp_resource(),
-                                                   image->pp_resource());
+                                                       image->pp_resource());
 
   // On success, reset the image data. This is to help prevent people
   // from continuing to use the resource which will result in artifacts.
@@ -100,8 +100,8 @@
 int32_t Graphics2D::Flush(const CompletionCallback& cc) {
   if (!has_interface<PPB_Graphics2D_1_0>())
     return cc.MayForce(PP_ERROR_NOINTERFACE);
-  return get_interface<PPB_Graphics2D_1_0>()->Flush(pp_resource(),
-                                                cc.pp_completion_callback());
+  return get_interface<PPB_Graphics2D_1_0>()->Flush(
+      pp_resource(), cc.pp_completion_callback());
 }
 
 }  // namespace pp
diff --git a/ppapi/cpp/instance.cc b/ppapi/cpp/instance.cc
index e000f9c..d285fd4 100644
--- a/ppapi/cpp/instance.cc
+++ b/ppapi/cpp/instance.cc
@@ -5,6 +5,7 @@
 #include "ppapi/cpp/instance.h"
 
 #include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_console.h"
 #include "ppapi/c/ppb_input_event.h"
 #include "ppapi/c/ppb_instance.h"
 #include "ppapi/c/ppb_messaging.h"
@@ -24,6 +25,10 @@
 
 namespace {
 
+template <> const char* interface_name<PPB_Console_1_0>() {
+  return PPB_CONSOLE_INTERFACE_1_0;
+}
+
 template <> const char* interface_name<PPB_InputEvent_1_0>() {
   return PPB_INPUT_EVENT_INTERFACE_1_0;
 }
@@ -123,6 +128,22 @@
                                               message.pp_var());
 }
 
+void Instance::LogToConsole(PP_LogLevel level, const Var& value) {
+  if (!has_interface<PPB_Console_1_0>())
+    return;
+  get_interface<PPB_Console_1_0>()->Log(
+      pp_instance(), level, value.pp_var());
+}
+
+void Instance::LogToConsoleWithSource(PP_LogLevel level,
+                                      const Var& source,
+                                      const Var& value) {
+  if (!has_interface<PPB_Console_1_0>())
+    return;
+  get_interface<PPB_Console_1_0>()->LogWithSource(
+      pp_instance(), level, source.pp_var(), value.pp_var());
+}
+
 void Instance::AddPerInstanceObject(const std::string& interface_name,
                                     void* object) {
   // Ensure we're not trying to register more than one object per interface
diff --git a/ppapi/cpp/instance.h b/ppapi/cpp/instance.h
index 5e7931c..00eaadc 100644
--- a/ppapi/cpp/instance.h
+++ b/ppapi/cpp/instance.h
@@ -14,6 +14,7 @@
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/ppb_console.h"
 #include "ppapi/cpp/instance_handle.h"
 #include "ppapi/cpp/view.h"
 
@@ -472,6 +473,29 @@
 
   /// @}
 
+  /// @{
+  /// @name PPB_Console methods for logging to the console:
+
+  /// Logs the given message to the JavaScript console associated with the
+  /// given plugin instance with the given logging level. The name of the plugin
+  /// issuing the log message will be automatically prepended to the message.
+  /// The value may be any type of Var.
+  void LogToConsole(PP_LogLevel level, const Var& value);
+
+  /// Logs a message to the console with the given source information rather
+  /// than using the internal PPAPI plugin name. The name must be a string var.
+  ///
+  /// The regular log function will automatically prepend the name of your
+  /// plugin to the message as the "source" of the message. Some plugins may
+  /// wish to override this. For example, if your plugin is a Python
+  /// interpreter, you would want log messages to contain the source .py file
+  /// doing the log statement rather than have "python" show up in the console.
+  void LogToConsoleWithSource(PP_LogLevel level,
+                              const Var& source,
+                              const Var& value);
+
+  /// @}
+
   /// AddPerInstanceObject() associates an instance with an interface,
   /// creating an object.
   ///
diff --git a/ppapi/cpp/message_loop.cc b/ppapi/cpp/message_loop.cc
new file mode 100644
index 0000000..df38007
--- /dev/null
+++ b/ppapi/cpp/message_loop.cc
@@ -0,0 +1,87 @@
+// 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 "ppapi/cpp/message_loop.h"
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_message_loop.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/instance_handle.h"
+#include "ppapi/cpp/module_impl.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_MessageLoop>() {
+  return PPB_MESSAGELOOP_INTERFACE_1_0;
+}
+
+}  // namespace
+
+MessageLoop::MessageLoop() : Resource() {
+}
+
+MessageLoop::MessageLoop(const InstanceHandle& instance) : Resource() {
+  if (has_interface<PPB_MessageLoop>()) {
+    PassRefFromConstructor(get_interface<PPB_MessageLoop>()->Create(
+        instance.pp_instance()));
+  }
+}
+
+MessageLoop::MessageLoop(const MessageLoop& other)
+    : Resource(other) {
+}
+
+MessageLoop::MessageLoop(PP_Resource pp_message_loop)
+    : Resource(pp_message_loop) {
+}
+
+// static
+MessageLoop MessageLoop::GetForMainThread() {
+  if (!has_interface<PPB_MessageLoop>())
+    return MessageLoop();
+  return MessageLoop(
+      get_interface<PPB_MessageLoop>()->GetForMainThread());
+}
+
+// static
+MessageLoop MessageLoop::GetCurrent() {
+  if (!has_interface<PPB_MessageLoop>())
+    return MessageLoop();
+  return MessageLoop(
+      get_interface<PPB_MessageLoop>()->GetCurrent());
+}
+
+int32_t MessageLoop::AttachToCurrentThread() {
+  if (!has_interface<PPB_MessageLoop>())
+    return PP_ERROR_NOINTERFACE;
+  return get_interface<PPB_MessageLoop>()->AttachToCurrentThread(
+      pp_resource());
+}
+
+int32_t MessageLoop::Run() {
+  if (!has_interface<PPB_MessageLoop>())
+    return PP_ERROR_NOINTERFACE;
+  return get_interface<PPB_MessageLoop>()->Run(pp_resource());
+}
+
+int32_t MessageLoop::PostWork(const CompletionCallback& callback,
+                                  int64_t delay_ms) {
+  if (!has_interface<PPB_MessageLoop>())
+    return PP_ERROR_NOINTERFACE;
+  return get_interface<PPB_MessageLoop>()->PostWork(
+      pp_resource(),
+      callback.pp_completion_callback(),
+      delay_ms);
+}
+
+int32_t MessageLoop::PostQuit(bool should_destroy) {
+  if (!has_interface<PPB_MessageLoop>())
+    return PP_ERROR_NOINTERFACE;
+  return get_interface<PPB_MessageLoop>()->PostQuit(
+      pp_resource(), PP_FromBool(should_destroy));
+}
+
+}  // namespace pp
diff --git a/ppapi/cpp/dev/message_loop_dev.h b/ppapi/cpp/message_loop.h
similarity index 93%
rename from ppapi/cpp/dev/message_loop_dev.h
rename to ppapi/cpp/message_loop.h
index b3aebab..fa38c66 100644
--- a/ppapi/cpp/dev/message_loop_dev.h
+++ b/ppapi/cpp/message_loop.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef PPAPI_CPP_DEV_MESSAGE_LOOP_DEV_H_
-#define PPAPI_CPP_DEV_MESSAGE_LOOP_DEV_H_
+#ifndef PPAPI_CPP_MESSAGE_LOOP_H_
+#define PPAPI_CPP_MESSAGE_LOOP_H_
 
 #include "ppapi/cpp/resource.h"
 
@@ -118,16 +118,16 @@
 ///
 ///   pp::CompletionCallback callback = factory_.NewOptionalCallback(...);
 ///   int32_t result = message_loop.PostWork(callback);
-///   if (result != PP_OK_COMPLETIONPENDING)
+///   if (result != PP_OK)
 ///     callback.Run(result);
 ///
 /// This will run the callback with an error value, and assumes that the
 /// implementation of your callback checks the "result" argument and returns
 /// immediately on error.
-class MessageLoop_Dev : public Resource {
+class MessageLoop : public Resource {
  public:
   /// Creates an is_null() MessageLoop resource.
-  MessageLoop_Dev();
+  MessageLoop();
 
   /// Creates a message loop associated with the given instance. The resource
   /// will be is_null() on failure.
@@ -135,15 +135,15 @@
   /// This may be called from any thread. After your thread starts but before
   /// issuing any other PPAPI calls on it, you must associate it with a message
   /// loop by calling AttachToCurrentThread.
-  explicit MessageLoop_Dev(const InstanceHandle& instance);
+  explicit MessageLoop(const InstanceHandle& instance);
 
-  MessageLoop_Dev(const MessageLoop_Dev& other);
+  MessageLoop(const MessageLoop& other);
 
   /// Takes an additional ref to the resource.
-  explicit MessageLoop_Dev(PP_Resource pp_message_loop);
+  explicit MessageLoop(PP_Resource pp_message_loop);
 
-  static MessageLoop_Dev GetForMainThread();
-  static MessageLoop_Dev GetCurrent();
+  static MessageLoop GetForMainThread();
+  static MessageLoop GetCurrent();
 
   /// Sets the given message loop resource as being the associated message loop
   /// for the currently running thread.
@@ -224,9 +224,9 @@
   /// PP_FALSE. It will be queued until the next invocation of Run().
   ///
   /// @return
-  ///   - PP_OK_COMPLETIONPENDING: The work was posted to the message loop's
-  ///     queue. As described above, this does not mean that the work has been
-  ///     or will be executed (if you never run the message loop after posting).
+  ///   - PP_OK: The work was posted to the message loop's queue. As described
+  ///     above, this does not mean that the work has been or will be executed
+  ///     (if you never run the message loop after posting).
   ///   - PP_ERROR_BADRESOURCE: The given message loop resource is invalid.
   ///   - PP_ERROR_BADARGUMENT: The function pointer for the completion callback
   ///     is null (this will be the case if you pass PP_BlockUntilComplete()).
@@ -238,7 +238,8 @@
   /// before that point will be processed before quitting.
   ///
   /// This may be called on the message loop registered for the current thread,
-  /// or it may be called on the message loop registered for another thread.
+  /// or it may be called on the message loop registered for another thread. It
+  /// is an error to attempt to quit the main thread loop.
   ///
   /// @param should_destroy Marks the message loop as being in a destroyed
   /// state and prevents further posting of messages.
@@ -258,4 +259,4 @@
 
 }  // namespace pp
 
-#endif  // PPAPI_CPP_DEV_MESSAGE_LOOP_DEV_H_
+#endif  // PPAPI_CPP_MESSAGE_LOOP_H_
diff --git a/ppapi/cpp/mouse_lock.h b/ppapi/cpp/mouse_lock.h
index f52fe10..c743aed 100644
--- a/ppapi/cpp/mouse_lock.h
+++ b/ppapi/cpp/mouse_lock.h
@@ -61,8 +61,7 @@
   /// PPP_MouseLock functions exposed as virtual functions for you to override.
   virtual void MouseLockLost() = 0;
 
-  /// LockMouse() requests the mouse to be locked. The browser will permit
-  /// mouse lock only while the tab is in fullscreen mode.
+  /// LockMouse() requests the mouse to be locked.
   ///
   /// While the mouse is locked, the cursor is implicitly hidden from the user.
   /// Any movement of the mouse will generate a
diff --git a/ppapi/cpp/output_traits.h b/ppapi/cpp/output_traits.h
index 5b45aa4..889c612 100644
--- a/ppapi/cpp/output_traits.h
+++ b/ppapi/cpp/output_traits.h
@@ -5,8 +5,13 @@
 #ifndef PPAPI_CPP_OUTPUT_TRAITS_H_
 #define PPAPI_CPP_OUTPUT_TRAITS_H_
 
+#include <vector>
+
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/cpp/array_output.h"
+#include "ppapi/cpp/dev/directory_entry_dev.h"
+#include "ppapi/cpp/extensions/ext_output_traits.h"
+#include "ppapi/cpp/resource.h"
 
 /// @file
 /// This file defines internal templates for defining how data is passed to the
@@ -20,7 +25,6 @@
 
 namespace pp {
 
-class Resource;
 class Var;
 
 namespace internal {
@@ -114,16 +118,20 @@
 };
 
 // The general templatized base class for all CallbackOutputTraits. This class
-// covers both resources and POD (ints, structs, etc.) by inheriting from the
-// appropriate base class depending on whether the given type derives from
-// pp::Resource. This trick allows us to do this once rather than writing
-// specializations for every resource object type.
+// covers resources, extensions API output objects and POD (ints, structs, etc.)
+// by inheriting from the appropriate base class depending on whether the given
+// type derives from pp::Resource or ext::internal::OutputObjectBase. This trick
+// allows us to do this once rather than writing specializations for every
+// object type.
 template<typename T>
 struct CallbackOutputTraits
-    : public InheritIf<GenericCallbackOutputTraits<T>,
-                       !IsBaseOf<Resource, T>::value>,
-      public InheritIf<ResourceCallbackOutputTraits<T>,
-                       IsBaseOf<Resource, T>::value> {
+    : public InheritIf<ResourceCallbackOutputTraits<T>,
+                       IsBaseOf<Resource, T>::value>,
+      public InheritIf<ext::internal::ExtensionsCallbackOutputTraits<T>,
+                       IsBaseOf<ext::internal::OutputObjectBase, T>::value>,
+      public InheritIf<GenericCallbackOutputTraits<T>,
+                       !IsBaseOf<Resource, T>::value &&
+                       !IsBaseOf<ext::internal::OutputObjectBase, T>::value> {
 };
 
 // A specialization of CallbackOutputTraits for pp::Var output parameters.
@@ -196,17 +204,21 @@
   }
 };
 
-// Specialization of CallbackOutputTraits for vectors. This struct covers both
-// arrays of resources and arrays of POD (ints, structs, etc.) by inheriting
-// from the appropriate base class depending on whether the given type derives
-// from pp::Resource. This trick allows us to do this once rather than writing
-// specializations for every resource object type.
+// Specialization of CallbackOutputTraits for vectors. This struct covers arrays
+// of resources, extensions API output objects and POD (ints, structs, etc.) by
+// inheriting from the appropriate base class depending on whether the given
+// type derives from pp::Resource or ext::internal::OutputObjectBase. This trick
+// allows us to do this once rather than writing specializations for every
+// object type.
 template<typename T>
 struct CallbackOutputTraits< std::vector<T> >
-    : public InheritIf<GenericVectorCallbackOutputTraits<T>,
-                       !IsBaseOf<Resource, T>::value>,
-      public InheritIf<ResourceVectorCallbackOutputTraits<T>,
-                       IsBaseOf<Resource, T>::value> {
+    : public InheritIf<ResourceVectorCallbackOutputTraits<T>,
+                       IsBaseOf<Resource, T>::value>,
+      public InheritIf<ext::internal::ExtensionsVectorCallbackOutputTraits<T>,
+                       IsBaseOf<ext::internal::OutputObjectBase, T>::value>,
+      public InheritIf<GenericVectorCallbackOutputTraits<T>,
+                       !IsBaseOf<Resource, T>::value &&
+                       !IsBaseOf<ext::internal::OutputObjectBase, T>::value> {
 };
 
 // A specialization of CallbackOutputTraits to provide the callback system
@@ -233,6 +245,24 @@
   }
 };
 
+// A specialization of CallbackOutputTraits to provide the callback system the
+// information on how to handle vectors of pp::DirectoryEntry_Dev. This converts
+// PP_DirectoryEntry_Dev to pp::DirectoryEntry_Dev when passing to the plugin.
+template<>
+struct CallbackOutputTraits< std::vector<pp::DirectoryEntry_Dev> > {
+  typedef PP_ArrayOutput APIArgType;
+  typedef DirectoryEntryArrayOutputAdapterWithStorage StorageType;
+
+  static inline APIArgType StorageToAPIArg(StorageType& t) {
+    return t.pp_array_output();
+  }
+
+  static inline std::vector<pp::DirectoryEntry_Dev>& StorageToPluginArg(
+      StorageType& t) {
+    return t.output();
+  }
+};
+
 }  // namespace internal
 }  // namespace pp
 
diff --git a/ppapi/cpp/private/DEPS b/ppapi/cpp/private/DEPS
index f11fdd6..89916e4 100644
--- a/ppapi/cpp/private/DEPS
+++ b/ppapi/cpp/private/DEPS
@@ -1,3 +1,5 @@
 include_rules = [
   "+ppapi/c/private",
+  "+ppapi/c/trusted",
+  "+ppapi/cpp/trusted",
 ]
diff --git a/ppapi/cpp/private/content_decryptor_private.cc b/ppapi/cpp/private/content_decryptor_private.cc
index 3c649f1..4869094 100644
--- a/ppapi/cpp/private/content_decryptor_private.cc
+++ b/ppapi/cpp/private/content_decryptor_private.cc
@@ -99,13 +99,13 @@
 void Decrypt(PP_Instance instance,
              PP_Resource encrypted_resource,
              const PP_EncryptedBlockInfo* encrypted_block_info) {
+  pp::Buffer_Dev encrypted_block(encrypted_resource);
+
   void* object =
       Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
   if (!object)
     return;
 
-  pp::Buffer_Dev encrypted_block(pp::PassRef(), encrypted_resource);
-
   static_cast<ContentDecryptor_Private*>(object)->Decrypt(
       encrypted_block,
       *encrypted_block_info);
@@ -115,13 +115,13 @@
     PP_Instance instance,
     const PP_AudioDecoderConfig* decoder_config,
     PP_Resource extra_data_resource) {
+  pp::Buffer_Dev extra_data_buffer(extra_data_resource);
+
   void* object =
       Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
   if (!object)
     return;
 
-  pp::Buffer_Dev extra_data_buffer(pp::PASS_REF, extra_data_resource);
-
   static_cast<ContentDecryptor_Private*>(object)->InitializeAudioDecoder(
       *decoder_config,
       extra_data_buffer);
@@ -131,13 +131,13 @@
     PP_Instance instance,
     const PP_VideoDecoderConfig* decoder_config,
     PP_Resource extra_data_resource) {
+  pp::Buffer_Dev extra_data_buffer(extra_data_resource);
+
   void* object =
       Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
   if (!object)
     return;
 
-  pp::Buffer_Dev extra_data_buffer(pp::PASS_REF, extra_data_resource);
-
   static_cast<ContentDecryptor_Private*>(object)->InitializeVideoDecoder(
       *decoder_config,
       extra_data_buffer);
@@ -170,13 +170,13 @@
                       PP_DecryptorStreamType decoder_type,
                       PP_Resource encrypted_resource,
                       const PP_EncryptedBlockInfo* encrypted_block_info) {
+  pp::Buffer_Dev encrypted_buffer(encrypted_resource);
+
   void* object =
       Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
   if (!object)
     return;
 
-  pp::Buffer_Dev encrypted_buffer(pp::PassRef(), encrypted_resource);
-
   static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecode(
       decoder_type,
       encrypted_buffer,
@@ -244,7 +244,7 @@
 
 void ContentDecryptor_Private::KeyMessage(const std::string& key_system,
                                           const std::string& session_id,
-                                          pp::Buffer_Dev message,
+                                          pp::VarArrayBuffer message,
                                           const std::string& default_url) {
   if (has_interface<PPB_ContentDecryptor_Private>()) {
     pp::Var key_system_var(key_system);
@@ -254,7 +254,7 @@
         associated_instance_.pp_instance(),
         key_system_var.pp_var(),
         session_id_var.pp_var(),
-        message.pp_resource(),
+        message.pp_var(),
         default_url_var.pp_var());
   }
 }
diff --git a/ppapi/cpp/private/content_decryptor_private.h b/ppapi/cpp/private/content_decryptor_private.h
index 629540a..477c6de 100644
--- a/ppapi/cpp/private/content_decryptor_private.h
+++ b/ppapi/cpp/private/content_decryptor_private.h
@@ -18,6 +18,9 @@
 
 class Instance;
 
+// TODO(tomfinegan): Remove redundant pp:: usage, and pass VarArrayBuffers as
+// const references.
+
 class ContentDecryptor_Private {
  public:
   explicit ContentDecryptor_Private(Instance* instance);
@@ -62,14 +65,19 @@
                 const std::string& session_id);
   void KeyMessage(const std::string& key_system,
                   const std::string& session_id,
-                  pp::Buffer_Dev message,
+                  pp::VarArrayBuffer message,
                   const std::string& default_url);
   void KeyError(const std::string& key_system,
                 const std::string& session_id,
                 int32_t media_error,
                 int32_t system_code);
+
+  // The plugin must not hold a reference to the encrypted buffer resource
+  // provided to Decrypt() when it calls this method. The browser will reuse
+  // the buffer in a subsequent Decrypt() call.
   void DeliverBlock(pp::Buffer_Dev decrypted_block,
                     const PP_DecryptedBlockInfo& decrypted_block_info);
+
   void DecoderInitializeDone(PP_DecryptorStreamType decoder_type,
                              uint32_t request_id,
                              bool status);
@@ -77,8 +85,16 @@
                                uint32_t request_id);
   void DecoderResetDone(PP_DecryptorStreamType decoder_type,
                         uint32_t request_id);
+
+  // The plugin must not hold a reference to the encrypted buffer resource
+  // provided to DecryptAndDecode() when it calls this method. The browser will
+  // reuse the buffer in a subsequent DecryptAndDecode() call.
   void DeliverFrame(pp::Buffer_Dev decrypted_frame,
                     const PP_DecryptedFrameInfo& decrypted_frame_info);
+
+  // The plugin must not hold a reference to the encrypted buffer resource
+  // provided to DecryptAndDecode() when it calls this method. The browser will
+  // reuse the buffer in a subsequent DecryptAndDecode() call.
   void DeliverSamples(pp::Buffer_Dev audio_frames,
                       const PP_DecryptedBlockInfo& decrypted_block_info);
 
diff --git a/ppapi/cpp/private/flash.cc b/ppapi/cpp/private/flash.cc
index 5707b70..757dbec 100644
--- a/ppapi/cpp/private/flash.cc
+++ b/ppapi/cpp/private/flash.cc
@@ -9,7 +9,6 @@
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/cpp/dev/device_ref_dev.h"
-#include "ppapi/cpp/dev/font_dev.h"
 #include "ppapi/cpp/dev/video_capture_dev.h"
 #include "ppapi/cpp/image_data.h"
 #include "ppapi/cpp/instance_handle.h"
@@ -17,6 +16,7 @@
 #include "ppapi/cpp/module_impl.h"
 #include "ppapi/cpp/point.h"
 #include "ppapi/cpp/rect.h"
+#include "ppapi/cpp/trusted/browser_font_trusted.h"
 #include "ppapi/cpp/url_request_info.h"
 #include "ppapi/cpp/var.h"
 #include "ppapi/c/private/ppb_flash.h"
@@ -26,6 +26,10 @@
 
 namespace {
 
+template <> const char* interface_name<PPB_Flash_13_0>() {
+  return PPB_FLASH_INTERFACE_13_0;
+}
+
 template <> const char* interface_name<PPB_Flash_12_6>() {
   return PPB_FLASH_INTERFACE_12_6;
 }
@@ -38,10 +42,6 @@
   return PPB_FLASH_INTERFACE_12_4;
 }
 
-template <> const char* interface_name<PPB_Flash_12_3>() {
-  return PPB_FLASH_INTERFACE_12_3;
-}
-
 template <> const char* interface_name<PPB_Flash_Print_1_0>() {
   return PPB_FLASH_PRINT_INTERFACE_1_0;
 }
@@ -51,7 +51,7 @@
 // have this meta one at the most recent version. Function pointers will be
 // null if they're not supported on the current Chrome version.
 bool initialized_combined_interface = false;
-PPB_Flash flash_12_combined_interface;
+PPB_Flash_12_6 flash_12_combined_interface;
 
 // Makes sure that the most recent version is loaded into the combined
 // interface struct above. Any unsupported functions will be NULL. If there
@@ -68,9 +68,6 @@
   } else if (has_interface<PPB_Flash_12_4>()) {
     memcpy(&flash_12_combined_interface, get_interface<PPB_Flash_12_4>(),
            sizeof(PPB_Flash_12_4));
-  } else if (has_interface<PPB_Flash_12_3>()) {
-    memcpy(&flash_12_combined_interface, get_interface<PPB_Flash_12_3>(),
-           sizeof(PPB_Flash_12_3));
   }
   initialized_combined_interface = true;
 }
@@ -81,17 +78,20 @@
 
 // static
 bool Flash::IsAvailable() {
-  return has_interface<PPB_Flash_12_6>() ||
+  return has_interface<PPB_Flash_13_0>() ||
+         has_interface<PPB_Flash_12_6>() ||
          has_interface<PPB_Flash_12_5>() ||
-         has_interface<PPB_Flash_12_4>() ||
-         has_interface<PPB_Flash_12_3>();
+         has_interface<PPB_Flash_12_4>();
 }
 
 // static
 void Flash::SetInstanceAlwaysOnTop(const InstanceHandle& instance,
                                    bool on_top) {
   InitializeCombinedInterface();
-  if (flash_12_combined_interface.SetInstanceAlwaysOnTop) {
+  if (has_interface<PPB_Flash_13_0>()) {
+    get_interface<PPB_Flash_13_0>()->SetInstanceAlwaysOnTop(
+        instance.pp_instance(), PP_FromBool(on_top));
+  } else if (flash_12_combined_interface.SetInstanceAlwaysOnTop) {
     flash_12_combined_interface.SetInstanceAlwaysOnTop(
         instance.pp_instance(), PP_FromBool(on_top));
   }
@@ -100,7 +100,7 @@
 // static
 bool Flash::DrawGlyphs(const InstanceHandle& instance,
                        ImageData* image,
-                       const FontDescription_Dev& font_desc,
+                       const BrowserFontDescription& font_desc,
                        uint32_t color,
                        const Point& position,
                        const Rect& clip,
@@ -110,6 +110,20 @@
                        const uint16_t glyph_indices[],
                        const PP_Point glyph_advances[]) {
   InitializeCombinedInterface();
+  if (has_interface<PPB_Flash_13_0>()) {
+    return PP_ToBool(get_interface<PPB_Flash_13_0>()->DrawGlyphs(
+        instance.pp_instance(),
+        image->pp_resource(),
+        &font_desc.pp_font_description(),
+        color,
+        &position.pp_point(),
+        &clip.pp_rect(),
+        transformation,
+        PP_FromBool(allow_subpixel_aa),
+        glyph_count,
+        glyph_indices,
+        glyph_advances));
+  }
   if (flash_12_combined_interface.DrawGlyphs) {
     return PP_ToBool(flash_12_combined_interface.DrawGlyphs(
         instance.pp_instance(),
@@ -131,6 +145,10 @@
 Var Flash::GetProxyForURL(const InstanceHandle& instance,
                           const std::string& url) {
   InitializeCombinedInterface();
+  if (has_interface<PPB_Flash_13_0>()) {
+    return Var(PASS_REF, get_interface<PPB_Flash_13_0>()->GetProxyForURL(
+        instance.pp_instance(), url.c_str()));
+  }
   if (flash_12_combined_interface.GetProxyForURL) {
     return Var(PASS_REF, flash_12_combined_interface.GetProxyForURL(
         instance.pp_instance(), url.c_str()));
@@ -143,6 +161,12 @@
                         const std::string& target,
                         bool from_user_action) {
   InitializeCombinedInterface();
+  if (has_interface<PPB_Flash_13_0>()) {
+    return get_interface<PPB_Flash_13_0>()->Navigate(
+        request_info.pp_resource(),
+        target.c_str(),
+        PP_FromBool(from_user_action));
+  }
   if (flash_12_combined_interface.Navigate) {
     return flash_12_combined_interface.Navigate(
         request_info.pp_resource(),
@@ -153,23 +177,13 @@
 }
 
 // static
-void Flash::RunMessageLoop(const InstanceHandle& instance) {
-  InitializeCombinedInterface();
-  if (flash_12_combined_interface.RunMessageLoop)
-    flash_12_combined_interface.RunMessageLoop(instance.pp_instance());
-}
-
-// static
-void Flash::QuitMessageLoop(const InstanceHandle& instance) {
-  InitializeCombinedInterface();
-  if (flash_12_combined_interface.QuitMessageLoop)
-    flash_12_combined_interface.QuitMessageLoop(instance.pp_instance());
-}
-
-// static
 double Flash::GetLocalTimeZoneOffset(const InstanceHandle& instance,
                                      PP_Time t) {
   InitializeCombinedInterface();
+  if (has_interface<PPB_Flash_13_0>()) {
+    return get_interface<PPB_Flash_13_0>()->GetLocalTimeZoneOffset(
+        instance.pp_instance(), t);
+  }
   if (flash_12_combined_interface.GetLocalTimeZoneOffset) {
     return flash_12_combined_interface.GetLocalTimeZoneOffset(
         instance.pp_instance(), t);
@@ -180,6 +194,10 @@
 // static
 Var Flash::GetCommandLineArgs(Module* module) {
   InitializeCombinedInterface();
+  if (has_interface<PPB_Flash_13_0>()) {
+    return Var(PASS_REF, get_interface<PPB_Flash_13_0>()->GetCommandLineArgs(
+        module->pp_module()));
+  }
   if (flash_12_combined_interface.GetCommandLineArgs) {
     return Var(
         PASS_REF,
@@ -191,6 +209,8 @@
 // static
 void Flash::PreloadFontWin(const void* logfontw) {
   InitializeCombinedInterface();
+  if (has_interface<PPB_Flash_13_0>())
+    return get_interface<PPB_Flash_13_0>()->PreloadFontWin(logfontw);
   if (flash_12_combined_interface.PreloadFontWin)
     return flash_12_combined_interface.PreloadFontWin(logfontw);
 }
@@ -198,6 +218,10 @@
 // static
 bool Flash::IsRectTopmost(const InstanceHandle& instance, const Rect& rect) {
   InitializeCombinedInterface();
+  if (has_interface<PPB_Flash_13_0>()) {
+    return PP_ToBool(get_interface<PPB_Flash_13_0>()->IsRectTopmost(
+        instance.pp_instance(), &rect.pp_rect()));
+  }
   if (flash_12_combined_interface.IsRectTopmost) {
     return PP_ToBool(flash_12_combined_interface.IsRectTopmost(
         instance.pp_instance(), &rect.pp_rect()));
@@ -208,36 +232,24 @@
 // static
 void Flash::UpdateActivity(const InstanceHandle& instance) {
   InitializeCombinedInterface();
-  if (flash_12_combined_interface.UpdateActivity)
+  if (has_interface<PPB_Flash_13_0>())
+    get_interface<PPB_Flash_13_0>()->UpdateActivity(instance.pp_instance());
+  else if (flash_12_combined_interface.UpdateActivity)
     flash_12_combined_interface.UpdateActivity(instance.pp_instance());
 }
 
 // static
-Var Flash::GetDeviceID(const InstanceHandle& instance) {
-  InitializeCombinedInterface();
-  if (flash_12_combined_interface.GetDeviceID) {
-    return Var(PASS_REF,
-               flash_12_combined_interface.GetDeviceID(instance.pp_instance()));
-  }
-  return Var();
-}
-
-// static
 Var Flash::GetSetting(const InstanceHandle& instance, PP_FlashSetting setting) {
   InitializeCombinedInterface();
+  if (has_interface<PPB_Flash_13_0>()) {
+    return Var(PASS_REF, get_interface<PPB_Flash_13_0>()->GetSetting(
+        instance.pp_instance(), setting));
+  }
   if (flash_12_combined_interface.GetSetting) {
     return Var(PASS_REF,
                flash_12_combined_interface.GetSetting(instance.pp_instance(),
                                                       setting));
   }
-  if (flash_12_combined_interface.GetSettingInt) {
-    // All the |PP_FlashSetting|s supported by |GetSettingInt()| return
-    // "booleans" (0 for false, 1 for true, -1 for undefined/unsupported/error).
-    int32_t result = flash_12_combined_interface.GetSettingInt(
-        instance.pp_instance(), setting);
-    if (result == 0 || result == 1)
-      return Var(!!result);
-  }
 
   return Var();
 }
@@ -247,6 +259,10 @@
                          PP_FlashCrashKey key,
                          const pp::Var& value) {
   InitializeCombinedInterface();
+  if (has_interface<PPB_Flash_13_0>()) {
+    return PP_ToBool(get_interface<PPB_Flash_13_0>()->SetCrashData(
+        instance.pp_instance(), key, value.pp_var()));
+  }
   if (flash_12_combined_interface.SetCrashData) {
     return PP_ToBool(
         flash_12_combined_interface.SetCrashData(instance.pp_instance(),
@@ -261,6 +277,13 @@
     const VideoCapture_Dev& video_capture,
     std::vector<DeviceRef_Dev>* devices_out) {
   InitializeCombinedInterface();
+  if (has_interface<PPB_Flash_13_0>()) {
+    ResourceArrayOutputAdapter<DeviceRef_Dev> adapter(devices_out);
+    return get_interface<PPB_Flash_13_0>()->EnumerateVideoCaptureDevices(
+        instance.pp_instance(),
+        video_capture.pp_resource(),
+        adapter.pp_array_output());
+  }
   if (flash_12_combined_interface.EnumerateVideoCaptureDevices) {
     ResourceArrayOutputAdapter<DeviceRef_Dev> adapter(devices_out);
     return flash_12_combined_interface.EnumerateVideoCaptureDevices(
diff --git a/ppapi/cpp/private/flash.h b/ppapi/cpp/private/flash.h
index 857c689..6a6b7c3 100644
--- a/ppapi/cpp/private/flash.h
+++ b/ppapi/cpp/private/flash.h
@@ -16,8 +16,8 @@
 
 namespace pp {
 
+class BrowserFontDescription;
 class DeviceRef_Dev;
-class FontDescription_Dev;
 class ImageData;
 class InstanceHandle;
 class Module;
@@ -38,7 +38,7 @@
                                      bool on_top);
   static bool DrawGlyphs(const InstanceHandle& instance,
                          ImageData* image,
-                         const FontDescription_Dev& font_desc,
+                         const BrowserFontDescription& font_desc,
                          uint32_t color,
                          const Point& position,
                          const Rect& clip,
diff --git a/ppapi/cpp/private/flash_file.cc b/ppapi/cpp/private/flash_file.cc
index 2aea2c3..7004b98 100644
--- a/ppapi/cpp/private/flash_file.cc
+++ b/ppapi/cpp/private/flash_file.cc
@@ -20,10 +20,6 @@
   return PPB_FLASH_FILE_MODULELOCAL_INTERFACE_3_0;
 }
 
-template <> const char* interface_name<PPB_Flash_File_ModuleLocal_2_0>() {
-  return PPB_FLASH_FILE_MODULELOCAL_INTERFACE_2_0;
-}
-
 }  // namespace
 
 namespace flash {
@@ -35,34 +31,7 @@
 
 // static
 bool FileModuleLocal::IsAvailable() {
-  return has_interface<PPB_Flash_File_ModuleLocal_3_0>() ||
-      has_interface<PPB_Flash_File_ModuleLocal_2_0>();
-}
-
-// static
-bool FileModuleLocal::CreateThreadAdapterForInstance(
-    const InstanceHandle& instance) {
-  bool rv = false;
-  if (has_interface<PPB_Flash_File_ModuleLocal_3_0>()) {
-    rv = get_interface<PPB_Flash_File_ModuleLocal_3_0>()->
-        CreateThreadAdapterForInstance(instance.pp_instance());
-  } else if (has_interface<PPB_Flash_File_ModuleLocal_2_0>()) {
-    rv = get_interface<PPB_Flash_File_ModuleLocal_2_0>()->
-        CreateThreadAdapterForInstance( instance.pp_instance());
-  }
-  return rv;
-}
-
-// static
-void FileModuleLocal::ClearThreadAdapterForInstance(
-    const InstanceHandle& instance) {
-  if (has_interface<PPB_Flash_File_ModuleLocal_3_0>()) {
-    get_interface<PPB_Flash_File_ModuleLocal_3_0>()->
-        ClearThreadAdapterForInstance(instance.pp_instance());
-  } else if (has_interface<PPB_Flash_File_ModuleLocal_2_0>()) {
-    get_interface<PPB_Flash_File_ModuleLocal_2_0>()->
-        ClearThreadAdapterForInstance(instance.pp_instance());
-  }
+  return has_interface<PPB_Flash_File_ModuleLocal_3_0>();
 }
 
 // static
@@ -74,9 +43,6 @@
   if (has_interface<PPB_Flash_File_ModuleLocal_3_0>()) {
     result = get_interface<PPB_Flash_File_ModuleLocal_3_0>()->
         OpenFile(instance.pp_instance(), path.c_str(), mode, &file_handle);
-  } else if (has_interface<PPB_Flash_File_ModuleLocal_2_0>()) {
-    result = get_interface<PPB_Flash_File_ModuleLocal_2_0>()->
-        OpenFile(instance.pp_instance(), path.c_str(), mode, &file_handle);
   }
   return (result == PP_OK) ? file_handle : PP_kInvalidFileHandle;
 }
@@ -89,9 +55,6 @@
   if (has_interface<PPB_Flash_File_ModuleLocal_3_0>()) {
     result = get_interface<PPB_Flash_File_ModuleLocal_3_0>()->
         RenameFile(instance.pp_instance(), path_from.c_str(), path_to.c_str());
-  } else if (has_interface<PPB_Flash_File_ModuleLocal_2_0>()) {
-    result = get_interface<PPB_Flash_File_ModuleLocal_2_0>()->
-        RenameFile(instance.pp_instance(), path_from.c_str(), path_to.c_str());
   }
   return result == PP_OK;
 }
@@ -105,10 +68,6 @@
     result = get_interface<PPB_Flash_File_ModuleLocal_3_0>()->
         DeleteFileOrDir(instance.pp_instance(), path.c_str(),
                         PP_FromBool(recursive));
-  } else if (has_interface<PPB_Flash_File_ModuleLocal_2_0>()) {
-    result = get_interface<PPB_Flash_File_ModuleLocal_2_0>()->
-        DeleteFileOrDir(instance.pp_instance(), path.c_str(),
-                        PP_FromBool(recursive));
   }
   return result == PP_OK;
 }
@@ -120,9 +79,6 @@
   if (has_interface<PPB_Flash_File_ModuleLocal_3_0>()) {
     result = get_interface<PPB_Flash_File_ModuleLocal_3_0>()->
         CreateDir(instance.pp_instance(), path.c_str());
-  } else if (has_interface<PPB_Flash_File_ModuleLocal_2_0>()) {
-    result = get_interface<PPB_Flash_File_ModuleLocal_2_0>()->
-        CreateDir(instance.pp_instance(), path.c_str());
   }
   return result == PP_OK;
 }
@@ -135,9 +91,6 @@
   if (has_interface<PPB_Flash_File_ModuleLocal_3_0>()) {
     result = get_interface<PPB_Flash_File_ModuleLocal_3_0>()->
         QueryFile(instance.pp_instance(), path.c_str(), info);
-  } else if (has_interface<PPB_Flash_File_ModuleLocal_2_0>()) {
-    result = get_interface<PPB_Flash_File_ModuleLocal_2_0>()->
-        QueryFile(instance.pp_instance(), path.c_str(), info);
   }
   return result == PP_OK;
 }
@@ -162,28 +115,11 @@
         get_interface<PPB_Flash_File_ModuleLocal_3_0>()->
             FreeDirContents(instance.pp_instance(), contents);
     }
-  } else if (has_interface<PPB_Flash_File_ModuleLocal_2_0>()) {
-    PP_DirContents_Dev* contents = NULL;
-    result = get_interface<PPB_Flash_File_ModuleLocal_2_0>()->
-        GetDirContents(instance.pp_instance(), path.c_str(), &contents);
-    if (result == PP_OK && contents) {
-      for (int32_t i = 0; i < contents->count; i++)
-        dir_contents->push_back(ConvertDirEntry(contents->entries[i]));
-    }
-    if (contents) {
-        get_interface<PPB_Flash_File_ModuleLocal_2_0>()->
-            FreeDirContents(instance.pp_instance(), contents);
-    }
   }
   return result == PP_OK;
 }
 
 // static
-bool FileModuleLocal::IsCreateTemporaryFileAvailable() {
-  return has_interface<PPB_Flash_File_ModuleLocal_3_0>();
-}
-
-// static
 PP_FileHandle FileModuleLocal::CreateTemporaryFile(
     const InstanceHandle& instance) {
   PP_FileHandle file_handle = PP_kInvalidFileHandle;
diff --git a/ppapi/cpp/private/flash_file.h b/ppapi/cpp/private/flash_file.h
index a7c655a..04ab195 100644
--- a/ppapi/cpp/private/flash_file.h
+++ b/ppapi/cpp/private/flash_file.h
@@ -24,9 +24,6 @@
   // Returns true if the required interface is available.
   static bool IsAvailable();
 
-  static bool CreateThreadAdapterForInstance(const InstanceHandle& instance);
-  static void ClearThreadAdapterForInstance(const InstanceHandle& instance);
-
   // Returns |PP_kInvalidFileHandle| on error.
   static PP_FileHandle OpenFile(const InstanceHandle& instance,
                                 const std::string& path,
@@ -51,9 +48,6 @@
                              const std::string& path,
                              std::vector<DirEntry>* dir_contents);
 
-  // Returns true if |CreateTemporaryFile()| is supported.
-  // TODO(viettrungluu): Remove this sometime after M21 ships to Stable?
-  static bool IsCreateTemporaryFileAvailable();
   // Returns |PP_kInvalidFileHandle| on error.
   static PP_FileHandle CreateTemporaryFile(const InstanceHandle& instance);
 };
diff --git a/ppapi/cpp/private/flash_font_file.cc b/ppapi/cpp/private/flash_font_file.cc
index 8400d8f..df11f57 100644
--- a/ppapi/cpp/private/flash_font_file.cc
+++ b/ppapi/cpp/private/flash_font_file.cc
@@ -6,7 +6,7 @@
 
 #include "ppapi/c/dev/ppb_font_dev.h"
 #include "ppapi/c/private/ppb_flash_font_file.h"
-#include "ppapi/c/private/ppb_pdf.h"
+#include "ppapi/c/trusted/ppb_browser_font_trusted.h"
 #include "ppapi/cpp/instance_handle.h"
 #include "ppapi/cpp/module_impl.h"
 
@@ -14,12 +14,6 @@
 
 namespace {
 
-// TODO(yzshen): Once PPB_Flash_FontFile gets to the stable channel, we can
-// remove the code of using PPB_PDF in this file.
-template <> const char* interface_name<PPB_PDF>() {
-  return PPB_PDF_INTERFACE;
-}
-
 template <> const char* interface_name<PPB_Flash_FontFile_0_1>() {
   return PPB_FLASH_FONTFILE_INTERFACE_0_1;
 }
@@ -32,14 +26,11 @@
 }
 
 FontFile::FontFile(const InstanceHandle& instance,
-                   const PP_FontDescription_Dev* description,
+                   const PP_BrowserFont_Trusted_Description* description,
                    PP_PrivateFontCharset charset) {
   if (has_interface<PPB_Flash_FontFile_0_1>()) {
     PassRefFromConstructor(get_interface<PPB_Flash_FontFile_0_1>()->Create(
         instance.pp_instance(), description, charset));
-  } else if (has_interface<PPB_PDF>()) {
-    PassRefFromConstructor(get_interface<PPB_PDF>()->GetFontFileWithFallback(
-        instance.pp_instance(), description, charset));
   }
 }
 
@@ -48,7 +39,7 @@
 
 // static
 bool FontFile::IsAvailable() {
-  return has_interface<PPB_Flash_FontFile_0_1>() || has_interface<PPB_PDF>();
+  return has_interface<PPB_Flash_FontFile_0_1>();
 }
 
 bool FontFile::GetFontTable(uint32_t table,
@@ -58,10 +49,6 @@
     return !!get_interface<PPB_Flash_FontFile_0_1>()->
         GetFontTable(pp_resource(), table, output, output_length);
   }
-  if (has_interface<PPB_PDF>()) {
-    return get_interface<PPB_PDF>()->GetFontTableForPrivateFontFile(
-        pp_resource(), table, output, output_length);
-  }
   return false;
 }
 
diff --git a/ppapi/cpp/private/flash_font_file.h b/ppapi/cpp/private/flash_font_file.h
index 8b61986..053fca2 100644
--- a/ppapi/cpp/private/flash_font_file.h
+++ b/ppapi/cpp/private/flash_font_file.h
@@ -8,7 +8,7 @@
 #include "ppapi/c/private/pp_private_font_charset.h"
 #include "ppapi/cpp/resource.h"
 
-struct PP_FontDescription_Dev;
+struct PP_BrowserFont_Trusted_Description;
 
 namespace pp {
 
@@ -21,7 +21,7 @@
   // Default constructor for making an is_null() FontFile resource.
   FontFile();
   FontFile(const InstanceHandle& instance,
-           const PP_FontDescription_Dev* description,
+           const PP_BrowserFont_Trusted_Description* description,
            PP_PrivateFontCharset charset);
   virtual ~FontFile();
 
diff --git a/ppapi/cpp/private/instance_private.cc b/ppapi/cpp/private/instance_private.cc
index 1dfabbf..c55408a 100644
--- a/ppapi/cpp/private/instance_private.cc
+++ b/ppapi/cpp/private/instance_private.cc
@@ -17,10 +17,6 @@
   return PPB_INSTANCE_PRIVATE_INTERFACE;
 }
 
-template <> const char* interface_name<PPB_Console_Dev_0_1>() {
-  return PPB_CONSOLE_DEV_INTERFACE_0_1;
-}
-
 PP_Var GetInstanceObject(PP_Instance pp_instance) {
   Module* module_singleton = Module::Get();
   if (!module_singleton)
@@ -76,20 +72,4 @@
           VarPrivate::OutException(exception).get()));
 }
 
-void InstancePrivate::LogToConsole(PP_LogLevel_Dev level, const Var& value) {
-  if (!has_interface<PPB_Console_Dev_0_1>())
-    return;
-  get_interface<PPB_Console_Dev_0_1>()->Log(
-      pp_instance(), level, value.pp_var());
-}
-
-void InstancePrivate::LogToConsoleWithSource(PP_LogLevel_Dev level,
-                                             const Var& source,
-                                             const Var& value) {
-  if (!has_interface<PPB_Console_Dev_0_1>())
-    return;
-  get_interface<PPB_Console_Dev_0_1>()->LogWithSource(
-      pp_instance(), level, source.pp_var(), value.pp_var());
-}
-
 }  // namespace pp
diff --git a/ppapi/cpp/private/instance_private.h b/ppapi/cpp/private/instance_private.h
index c6c51b7..58254698 100644
--- a/ppapi/cpp/private/instance_private.h
+++ b/ppapi/cpp/private/instance_private.h
@@ -13,7 +13,7 @@
  * @{
  */
 
-#include "ppapi/c/dev/ppb_console_dev.h"
+#include "ppapi/c/ppb_console.h"
 #include "ppapi/cpp/instance.h"
 
 /** The C++ interface to the Pepper API. */
@@ -48,19 +48,6 @@
   VarPrivate ExecuteScript(const Var& script, Var* exception = NULL);
 
   // @}
-
-  // @{
-  /// @name PPB_Console_Dev methods for logging to the console:
-
-  /// See PPB_Console_Dev.Log.
-  void LogToConsole(PP_LogLevel_Dev level, const Var& value);
-
-  /// See PPB_Console_Dev.LogWithSource.
-  void LogToConsoleWithSource(PP_LogLevel_Dev level,
-                              const Var& source,
-                              const Var& value);
-
-  // @}
 };
 
 }  // namespace pp
diff --git a/ppapi/cpp/private/pdf.cc b/ppapi/cpp/private/pdf.cc
new file mode 100644
index 0000000..e61cefc
--- /dev/null
+++ b/ppapi/cpp/private/pdf.cc
@@ -0,0 +1,163 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/cpp/private/pdf.h"
+
+#include "ppapi/cpp/image_data.h"
+#include "ppapi/cpp/instance_handle.h"
+#include "ppapi/cpp/module_impl.h"
+#include "ppapi/cpp/var.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_PDF>() {
+  return PPB_PDF_INTERFACE;
+}
+
+}  // namespace
+
+// static
+bool PDF::IsAvailable() {
+  return has_interface<PPB_PDF>();
+}
+
+// static
+Var PDF::GetLocalizedString(const InstanceHandle& instance,
+                            PP_ResourceString string_id) {
+  if (has_interface<PPB_PDF>()) {
+    return Var(PASS_REF,
+               get_interface<PPB_PDF>()->GetLocalizedString(
+                   instance.pp_instance(), string_id));
+  }
+  return Var();
+}
+
+// static
+ImageData PDF::GetResourceImage(const InstanceHandle& instance,
+                                PP_ResourceImage image_id) {
+  if (has_interface<PPB_PDF>()) {
+    return ImageData(PASS_REF,
+                     get_interface<PPB_PDF>()->GetResourceImage(
+                         instance.pp_instance(), image_id));
+  }
+  return ImageData();
+}
+
+// static
+PP_Resource PDF::GetFontFileWithFallback(
+    const InstanceHandle& instance,
+    const PP_FontDescription_Dev* description,
+    PP_PrivateFontCharset charset) {
+  if (has_interface<PPB_PDF>()) {
+    return get_interface<PPB_PDF>()->GetFontFileWithFallback(
+        instance.pp_instance(), description, charset);
+  }
+  return 0;
+}
+
+// static
+bool PDF::GetFontTableForPrivateFontFile(PP_Resource font_file,
+                                         uint32_t table,
+                                         void* output,
+                                         uint32_t* output_length) {
+  if (has_interface<PPB_PDF>()) {
+    return get_interface<PPB_PDF>()->GetFontTableForPrivateFontFile(font_file,
+        table, output, output_length);
+  }
+  return false;
+}
+
+// static
+void PDF::SearchString(const InstanceHandle& instance,
+                       const unsigned short* string,
+                       const unsigned short* term,
+                       bool case_sensitive,
+                       PP_PrivateFindResult** results,
+                       int* count) {
+  if (has_interface<PPB_PDF>()) {
+    get_interface<PPB_PDF>()->SearchString(instance.pp_instance(), string,
+        term, case_sensitive, results, count);
+  }
+}
+
+// static
+void PDF::DidStartLoading(const InstanceHandle& instance) {
+  if (has_interface<PPB_PDF>())
+    get_interface<PPB_PDF>()->DidStartLoading(instance.pp_instance());
+}
+
+// static
+void PDF::DidStopLoading(const InstanceHandle& instance) {
+  if (has_interface<PPB_PDF>())
+    get_interface<PPB_PDF>()->DidStopLoading(instance.pp_instance());
+}
+
+// static
+void PDF::SetContentRestriction(const InstanceHandle& instance,
+                                int restrictions) {
+  if (has_interface<PPB_PDF>()) {
+    get_interface<PPB_PDF>()->SetContentRestriction(instance.pp_instance(),
+                                                    restrictions);
+  }
+}
+
+// static
+void PDF::HistogramPDFPageCount(const InstanceHandle& instance,
+                                int count) {
+  if (has_interface<PPB_PDF>())
+    get_interface<PPB_PDF>()->HistogramPDFPageCount(instance.pp_instance(),
+                                                    count);
+}
+
+// static
+void PDF::UserMetricsRecordAction(const InstanceHandle& instance,
+                                  const Var& action) {
+  if (has_interface<PPB_PDF>()) {
+    get_interface<PPB_PDF>()->UserMetricsRecordAction(instance.pp_instance(),
+                                                      action.pp_var());
+  }
+}
+
+// static
+void PDF::HasUnsupportedFeature(const InstanceHandle& instance) {
+  if (has_interface<PPB_PDF>())
+    get_interface<PPB_PDF>()->HasUnsupportedFeature(instance.pp_instance());
+}
+
+// static
+void PDF::SaveAs(const InstanceHandle& instance) {
+  if (has_interface<PPB_PDF>())
+    get_interface<PPB_PDF>()->SaveAs(instance.pp_instance());
+}
+
+// static
+void PDF::Print(const InstanceHandle& instance) {
+  if (has_interface<PPB_PDF>())
+    get_interface<PPB_PDF>()->Print(instance.pp_instance());
+}
+
+// static
+bool PDF::IsFeatureEnabled(const InstanceHandle& instance,
+                           PP_PDFFeature feature) {
+  if (has_interface<PPB_PDF>())
+    return PP_ToBool(get_interface<PPB_PDF>()->IsFeatureEnabled(
+        instance.pp_instance(), feature));
+  return false;
+}
+
+// static
+ImageData PDF::GetResourceImageForScale(const InstanceHandle& instance,
+                                        PP_ResourceImage image_id,
+                                        float scale) {
+  if (has_interface<PPB_PDF>()) {
+    return ImageData(PASS_REF,
+                     get_interface<PPB_PDF>()->GetResourceImageForScale(
+                         instance.pp_instance(), image_id, scale));
+  }
+  return ImageData();
+}
+
+}  // namespace pp
diff --git a/ppapi/cpp/private/pdf.h b/ppapi/cpp/private/pdf.h
new file mode 100644
index 0000000..570c0e7
--- /dev/null
+++ b/ppapi/cpp/private/pdf.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_PRIVATE_PDF_H_
+#define PPAPI_CPP_PRIVATE_PDF_H_
+
+#include <string>
+
+#include "ppapi/c/private/ppb_pdf.h"
+
+namespace pp {
+
+class ImageData;
+class InstanceHandle;
+class Var;
+
+class PDF {
+ public:
+  // Returns true if the required interface is available.
+  static bool IsAvailable();
+
+  static Var GetLocalizedString(const InstanceHandle& instance,
+                                PP_ResourceString string_id);
+  static ImageData GetResourceImage(const InstanceHandle& instance,
+                                    PP_ResourceImage image_id);
+  static PP_Resource GetFontFileWithFallback(
+      const InstanceHandle& instance,
+      const PP_FontDescription_Dev* description,
+      PP_PrivateFontCharset charset);
+  static bool GetFontTableForPrivateFontFile(PP_Resource font_file,
+                                             uint32_t table,
+                                             void* output,
+                                             uint32_t* output_length);
+  static void SearchString(const InstanceHandle& instance,
+                           const unsigned short* string,
+                           const unsigned short* term,
+                           bool case_sensitive,
+                           PP_PrivateFindResult** results,
+                           int* count);
+  static void DidStartLoading(const InstanceHandle& instance);
+  static void DidStopLoading(const InstanceHandle& instance);
+  static void SetContentRestriction(const InstanceHandle& instance,
+                                    int restrictions);
+  static void HistogramPDFPageCount(const InstanceHandle& instance,
+                                    int count);
+  static void UserMetricsRecordAction(const InstanceHandle& instance,
+                                      const Var& action);
+  static void HasUnsupportedFeature(const InstanceHandle& instance);
+  static void SaveAs(const InstanceHandle& instance);
+  static void Print(const InstanceHandle& instance);
+  static bool IsFeatureEnabled(const InstanceHandle& instance,
+                               PP_PDFFeature feature);
+  static ImageData GetResourceImageForScale(const InstanceHandle& instance,
+                                            PP_ResourceImage image_id,
+                                            float scale);
+};
+
+}  // namespace pp
+
+#endif  // PPAPI_CPP_PRIVATE_PDF_H_
diff --git a/ppapi/cpp/private/tcp_socket_private.cc b/ppapi/cpp/private/tcp_socket_private.cc
index f60f2ef..996e0a0 100644
--- a/ppapi/cpp/private/tcp_socket_private.cc
+++ b/ppapi/cpp/private/tcp_socket_private.cc
@@ -15,6 +15,10 @@
 
 namespace {
 
+template <> const char* interface_name<PPB_TCPSocket_Private_0_5>() {
+  return PPB_TCPSOCKET_PRIVATE_INTERFACE_0_5;
+}
+
 template <> const char* interface_name<PPB_TCPSocket_Private_0_4>() {
   return PPB_TCPSOCKET_PRIVATE_INTERFACE_0_4;
 }
@@ -26,7 +30,10 @@
 }  // namespace
 
 TCPSocketPrivate::TCPSocketPrivate(const InstanceHandle& instance) {
-  if (has_interface<PPB_TCPSocket_Private_0_4>()) {
+  if (has_interface<PPB_TCPSocket_Private_0_5>()) {
+    PassRefFromConstructor(get_interface<PPB_TCPSocket_Private_0_5>()->Create(
+        instance.pp_instance()));
+  } else if (has_interface<PPB_TCPSocket_Private_0_4>()) {
     PassRefFromConstructor(get_interface<PPB_TCPSocket_Private_0_4>()->Create(
         instance.pp_instance()));
   } else if (has_interface<PPB_TCPSocket_Private_0_3>()) {
@@ -41,13 +48,18 @@
 
 // static
 bool TCPSocketPrivate::IsAvailable() {
-  return has_interface<PPB_TCPSocket_Private_0_4>() ||
+  return has_interface<PPB_TCPSocket_Private_0_5>() ||
+      has_interface<PPB_TCPSocket_Private_0_4>() ||
       has_interface<PPB_TCPSocket_Private_0_3>();
 }
 
 int32_t TCPSocketPrivate::Connect(const char* host,
                                   uint16_t port,
                                   const CompletionCallback& callback) {
+  if (has_interface<PPB_TCPSocket_Private_0_5>()) {
+    return get_interface<PPB_TCPSocket_Private_0_5>()->Connect(
+        pp_resource(), host, port, callback.pp_completion_callback());
+  }
   if (has_interface<PPB_TCPSocket_Private_0_4>()) {
     return get_interface<PPB_TCPSocket_Private_0_4>()->Connect(
         pp_resource(), host, port, callback.pp_completion_callback());
@@ -62,6 +74,10 @@
 int32_t TCPSocketPrivate::ConnectWithNetAddress(
     const PP_NetAddress_Private* addr,
     const CompletionCallback& callback) {
+  if (has_interface<PPB_TCPSocket_Private_0_5>()) {
+    return get_interface<PPB_TCPSocket_Private_0_5>()->ConnectWithNetAddress(
+        pp_resource(), addr, callback.pp_completion_callback());
+  }
   if (has_interface<PPB_TCPSocket_Private_0_4>()) {
     return get_interface<PPB_TCPSocket_Private_0_4>()->ConnectWithNetAddress(
         pp_resource(), addr, callback.pp_completion_callback());
@@ -74,6 +90,11 @@
 }
 
 bool TCPSocketPrivate::GetLocalAddress(PP_NetAddress_Private* local_addr) {
+  if (has_interface<PPB_TCPSocket_Private_0_5>()) {
+    PP_Bool result = get_interface<PPB_TCPSocket_Private_0_5>()->
+        GetLocalAddress(pp_resource(), local_addr);
+    return PP_ToBool(result);
+  }
   if (has_interface<PPB_TCPSocket_Private_0_4>()) {
     PP_Bool result = get_interface<PPB_TCPSocket_Private_0_4>()->
         GetLocalAddress(pp_resource(), local_addr);
@@ -88,6 +109,11 @@
 }
 
 bool TCPSocketPrivate::GetRemoteAddress(PP_NetAddress_Private* remote_addr) {
+  if (has_interface<PPB_TCPSocket_Private_0_5>()) {
+    PP_Bool result = get_interface<PPB_TCPSocket_Private_0_5>()->
+        GetRemoteAddress(pp_resource(), remote_addr);
+    return PP_ToBool(result);
+  }
   if (has_interface<PPB_TCPSocket_Private_0_4>()) {
     PP_Bool result = get_interface<PPB_TCPSocket_Private_0_4>()->
         GetRemoteAddress(pp_resource(), remote_addr);
@@ -104,6 +130,11 @@
 int32_t TCPSocketPrivate::SSLHandshake(const char* server_name,
                                        uint16_t server_port,
                                        const CompletionCallback& callback) {
+  if (has_interface<PPB_TCPSocket_Private_0_5>()) {
+    return get_interface<PPB_TCPSocket_Private_0_5>()->SSLHandshake(
+        pp_resource(), server_name, server_port,
+        callback.pp_completion_callback());
+  }
   if (has_interface<PPB_TCPSocket_Private_0_4>()) {
     return get_interface<PPB_TCPSocket_Private_0_4>()->SSLHandshake(
         pp_resource(), server_name, server_port,
@@ -118,6 +149,11 @@
 }
 
 X509CertificatePrivate TCPSocketPrivate::GetServerCertificate() {
+  if (has_interface<PPB_TCPSocket_Private_0_5>()) {
+    return X509CertificatePrivate(PASS_REF,
+        get_interface<PPB_TCPSocket_Private_0_5>()->GetServerCertificate(
+            pp_resource()));
+  }
   if (has_interface<PPB_TCPSocket_Private_0_4>()) {
     return X509CertificatePrivate(PASS_REF,
         get_interface<PPB_TCPSocket_Private_0_4>()->GetServerCertificate(
@@ -129,6 +165,11 @@
 bool TCPSocketPrivate::AddChainBuildingCertificate(
     const X509CertificatePrivate& cert,
     bool trusted) {
+  if (has_interface<PPB_TCPSocket_Private_0_5>()) {
+    return PP_ToBool(get_interface<PPB_TCPSocket_Private_0_5>()->
+        AddChainBuildingCertificate(pp_resource(), cert.pp_resource(),
+                                    PP_FromBool(trusted)));
+  }
   if (has_interface<PPB_TCPSocket_Private_0_4>()) {
     return PP_ToBool(get_interface<PPB_TCPSocket_Private_0_4>()->
         AddChainBuildingCertificate(pp_resource(), cert.pp_resource(),
@@ -140,6 +181,11 @@
 int32_t TCPSocketPrivate::Read(char* buffer,
                                int32_t bytes_to_read,
                                const CompletionCallback& callback) {
+  if (has_interface<PPB_TCPSocket_Private_0_5>()) {
+    return get_interface<PPB_TCPSocket_Private_0_5>()->Read(
+        pp_resource(), buffer, bytes_to_read,
+        callback.pp_completion_callback());
+  }
   if (has_interface<PPB_TCPSocket_Private_0_4>()) {
     return get_interface<PPB_TCPSocket_Private_0_4>()->Read(
         pp_resource(), buffer, bytes_to_read,
@@ -156,6 +202,11 @@
 int32_t TCPSocketPrivate::Write(const char* buffer,
                                 int32_t bytes_to_write,
                                 const CompletionCallback& callback) {
+  if (has_interface<PPB_TCPSocket_Private_0_5>()) {
+    return get_interface<PPB_TCPSocket_Private_0_5>()->Write(
+        pp_resource(), buffer, bytes_to_write,
+        callback.pp_completion_callback());
+  }
   if (has_interface<PPB_TCPSocket_Private_0_4>()) {
     return get_interface<PPB_TCPSocket_Private_0_4>()->Write(
         pp_resource(), buffer, bytes_to_write,
@@ -170,6 +221,10 @@
 }
 
 void TCPSocketPrivate::Disconnect() {
+  if (has_interface<PPB_TCPSocket_Private_0_5>()) {
+    return get_interface<PPB_TCPSocket_Private_0_5>()->Disconnect(
+        pp_resource());
+  }
   if (has_interface<PPB_TCPSocket_Private_0_4>()) {
     return get_interface<PPB_TCPSocket_Private_0_4>()->Disconnect(
         pp_resource());
@@ -180,4 +235,14 @@
   }
 }
 
+int32_t TCPSocketPrivate::SetOption(PP_TCPSocketOption_Private name,
+                                    const Var& value,
+                                    const CompletionCallback& callback) {
+  if (has_interface<PPB_TCPSocket_Private_0_5>()) {
+    return get_interface<PPB_TCPSocket_Private_0_5>()->SetOption(
+        pp_resource(), name, value.pp_var(), callback.pp_completion_callback());
+  }
+  return callback.MayForce(PP_ERROR_NOINTERFACE);
+}
+
 }  // namespace pp
diff --git a/ppapi/cpp/private/tcp_socket_private.h b/ppapi/cpp/private/tcp_socket_private.h
index 5f2b771..12e435e 100644
--- a/ppapi/cpp/private/tcp_socket_private.h
+++ b/ppapi/cpp/private/tcp_socket_private.h
@@ -46,6 +46,9 @@
                 int32_t bytes_to_write,
                 const CompletionCallback& callback);
   void Disconnect();
+  int32_t SetOption(PP_TCPSocketOption_Private name,
+                    const Var& value,
+                    const CompletionCallback& callback);
 };
 
 }  // namespace pp
diff --git a/ppapi/cpp/trusted/browser_font_trusted.cc b/ppapi/cpp/trusted/browser_font_trusted.cc
index 11f3b2f..5d47469 100644
--- a/ppapi/cpp/trusted/browser_font_trusted.cc
+++ b/ppapi/cpp/trusted/browser_font_trusted.cc
@@ -8,7 +8,7 @@
 
 #include "ppapi/c/dev/ppb_font_dev.h"
 #include "ppapi/cpp/image_data.h"
-#include "ppapi/cpp/instance.h"
+#include "ppapi/cpp/instance_handle.h"
 #include "ppapi/cpp/point.h"
 #include "ppapi/cpp/rect.h"
 #include "ppapi/cpp/module_impl.h"
@@ -131,15 +131,15 @@
 }
 
 BrowserFont_Trusted::BrowserFont_Trusted(
-    Instance* instance,
+    const InstanceHandle& instance,
     const BrowserFontDescription& description) {
   if (has_interface<PPB_BrowserFont_Trusted_1_0>()) {
     PassRefFromConstructor(get_interface<PPB_BrowserFont_Trusted_1_0>()->Create(
-        instance->pp_instance(),
+        instance.pp_instance(),
         &description.pp_font_description()));
   } else if (!has_interface<PPB_Font_Dev_0_6>()) {
     PassRefFromConstructor(get_interface<PPB_Font_Dev_0_6>()->Create(
-        instance->pp_instance(),
+        instance.pp_instance(),
         BrowserFontDescToFontDesc(&description.pp_font_description())));
   }
 }
@@ -155,12 +155,12 @@
 }
 
 // static
-Var BrowserFont_Trusted::GetFontFamilies(Instance* instance) {
+Var BrowserFont_Trusted::GetFontFamilies(const InstanceHandle& instance) {
   if (!has_interface<PPB_Font_Dev_0_6>())
     return Var();
   return Var(PASS_REF,
              get_interface<PPB_Font_Dev_0_6>()->GetFontFamilies(
-                 instance->pp_instance()));
+                 instance.pp_instance()));
 }
 
 bool BrowserFont_Trusted::Describe(
diff --git a/ppapi/cpp/trusted/browser_font_trusted.h b/ppapi/cpp/trusted/browser_font_trusted.h
index fc2d801..7225b26 100644
--- a/ppapi/cpp/trusted/browser_font_trusted.h
+++ b/ppapi/cpp/trusted/browser_font_trusted.h
@@ -14,7 +14,7 @@
 namespace pp {
 
 class ImageData;
-class Instance;
+class InstanceHandle;
 class Point;
 class Rect;
 
@@ -109,14 +109,14 @@
   BrowserFont_Trusted();
 
   explicit BrowserFont_Trusted(PP_Resource resource);
-  BrowserFont_Trusted(Instance* instance,
+  BrowserFont_Trusted(const InstanceHandle& instance,
                       const BrowserFontDescription& description);
   BrowserFont_Trusted(const BrowserFont_Trusted& other);
 
   BrowserFont_Trusted& operator=(const BrowserFont_Trusted& other);
 
   // PPB_Font methods:
-  static Var GetFontFamilies(Instance* instance);
+  static Var GetFontFamilies(const InstanceHandle& instance);
   bool Describe(BrowserFontDescription* description,
                 PP_BrowserFont_Trusted_Metrics* metrics) const;
   bool DrawTextAt(ImageData* dest,
diff --git a/ppapi/cpp/var.cc b/ppapi/cpp/var.cc
index 7fc67f5..1108e05 100644
--- a/ppapi/cpp/var.cc
+++ b/ppapi/cpp/var.cc
@@ -101,6 +101,18 @@
   is_managed_ = true;
 }
 
+
+Var::Var(const PP_Var& var) {
+  var_ = var;
+  is_managed_ = true;
+  if (NeedsRefcounting(var_)) {
+    if (has_interface<PPB_Var_1_0>())
+      get_interface<PPB_Var_1_0>()->AddRef(var_);
+    else
+      var_.type = PP_VARTYPE_NULL;
+  }
+}
+
 Var::Var(const Var& other) {
   var_ = other.var_;
   is_managed_ = true;
@@ -229,10 +241,16 @@
       str.append("...");
     }
     snprintf(buf, sizeof(buf), format, str.c_str());
-  } else if (is_array_buffer()) {
-    snprintf(buf, sizeof(buf), "Var(ARRAY_BUFFER)");
   } else if (is_object()) {
     snprintf(buf, sizeof(buf), "Var(OBJECT)");
+  } else if (is_array()) {
+    snprintf(buf, sizeof(buf), "Var(ARRAY)");
+  } else if (is_dictionary()) {
+    snprintf(buf, sizeof(buf), "Var(DICTIONARY)");
+  } else if (is_array_buffer()) {
+    snprintf(buf, sizeof(buf), "Var(ARRAY_BUFFER)");
+  } else {
+    buf[0] = '\0';
   }
   return buf;
 }
diff --git a/ppapi/cpp/var.h b/ppapi/cpp/var.h
index 437eed9..77bb5d8 100644
--- a/ppapi/cpp/var.h
+++ b/ppapi/cpp/var.h
@@ -55,11 +55,14 @@
   ///
   /// You will not normally need to use this constructor because
   /// the reference count will not normally be incremented for you.
-  Var(PassRef, PP_Var var) {
+  Var(PassRef, const PP_Var& var) {
     var_ = var;
     is_managed_ = true;
   }
 
+  /// A constructor that increments the reference count.
+  explicit Var(const PP_Var& var);
+
   struct DontManage {};
 
   // TODO(brettw): remove DontManage when this bug is fixed
@@ -70,7 +73,7 @@
   /// increased or decreased by this class instance.
   ///
   /// @param[in] var A <code>Var</code>.
-  Var(DontManage, PP_Var var) {
+  Var(DontManage, const PP_Var& var) {
     var_ = var;
     is_managed_ = false;
   }
@@ -119,9 +122,19 @@
 
   /// This function determines if this <code>Var</code> is an object.
   ///
-  /// @return true if this  <code>Var</code> is an object, otherwise false.
+  /// @return true if this <code>Var</code> is an object, otherwise false.
   bool is_object() const { return var_.type == PP_VARTYPE_OBJECT; }
 
+  /// This function determines if this <code>Var</code> is an array.
+  ///
+  /// @return true if this <code>Var</code> is an array, otherwise false.
+  bool is_array() const { return var_.type == PP_VARTYPE_ARRAY; }
+
+  /// This function determines if this <code>Var</code> is a dictionary.
+  ///
+  /// @return true if this <code>Var</code> is a dictinoary, otherwise false.
+  bool is_dictionary() const { return var_.type == PP_VARTYPE_DICTIONARY; }
+
   /// This function determines if this <code>Var</code> is an integer value.
   /// The <code>is_int</code> function returns the internal representation.
   /// The JavaScript runtime may convert between the two as needed, so the
diff --git a/ppapi/cpp/var_array_buffer.h b/ppapi/cpp/var_array_buffer.h
index 0898f5c..74f97aa 100644
--- a/ppapi/cpp/var_array_buffer.h
+++ b/ppapi/cpp/var_array_buffer.h
@@ -65,7 +65,9 @@
 
   /// Map() maps the <code>ArrayBuffer</code> in to the module's address space
   /// and returns a pointer to the beginning of the internal buffer for
-  /// this <code>ArrayBuffer</code>.
+  /// this <code>ArrayBuffer</code>. ArrayBuffers are copied when transmitted,
+  /// so changes to the underlying memory are not automatically available to
+  /// the embedding page.
   ///
   /// Note that calling Map() can be a relatively expensive operation. Use care
   /// when calling it in performance-critical code. For example, you should call
diff --git a/ppapi/examples/audio_input/audio_input.cc b/ppapi/examples/audio_input/audio_input.cc
index 11efa63..e2df2b8 100644
--- a/ppapi/examples/audio_input/audio_input.cc
+++ b/ppapi/examples/audio_input/audio_input.cc
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <stdlib.h>
 #include <string.h>
 
 #include <algorithm>
@@ -32,6 +33,7 @@
 const PP_AudioSampleRate kSampleFrequency = PP_AUDIOSAMPLERATE_44100;
 const uint32_t kSampleCount = 1024;
 const uint32_t kChannelCount = 1;
+const char* const kDelimiter = "#__#";
 
 }  // namespace
 
@@ -48,6 +50,7 @@
         waiting_for_flush_completion_(false) {
   }
   virtual ~MyInstance() {
+    device_detector_.MonitorDeviceChange(NULL, NULL);
     audio_input_.Close();
 
     delete[] samples_;
@@ -62,7 +65,7 @@
     samples_ = new int16_t[sample_count_ * channel_count_];
     memset(samples_, 0, sample_count_ * channel_count_ * sizeof(int16_t));
 
-    audio_input_ = pp::AudioInput_Dev(this);
+    device_detector_ = pp::AudioInput_Dev(this);
 
     // Try to ensure that we pick up a new set of samples between each
     // timer-generated repaint.
@@ -88,10 +91,15 @@
     if (message_data.is_string()) {
       std::string event = message_data.AsString();
       if (event == "PageInitialized") {
+        int32_t result = device_detector_.MonitorDeviceChange(
+            &MyInstance::MonitorDeviceChangeCallback, this);
+        if (result != PP_OK)
+          PostMessage(pp::Var("MonitorDeviceChangeFailed"));
+
         pp::CompletionCallbackWithOutput<std::vector<pp::DeviceRef_Dev> >
             callback = callback_factory_.NewCallbackWithOutput(
                 &MyInstance::EnumerateDevicesFinished);
-        int32_t result = audio_input_.EnumerateDevices(callback);
+        result = device_detector_.EnumerateDevices(callback);
         if (result != PP_OK_COMPLETIONPENDING)
           PostMessage(pp::Var("EnumerationFailed"));
       } else if (event == "UseDefault") {
@@ -100,13 +108,20 @@
         Stop();
       } else if (event == "Start") {
         Start();
-      }
-    } else if (message_data.is_number()) {
-      int index = message_data.AsInt();
-      if (index >= 0 && index < static_cast<int>(devices_.size())) {
-        Open(devices_[index]);
-      } else {
-        PP_NOTREACHED();
+      } else if (event.find("Monitor:") == 0) {
+        std::string index_str = event.substr(strlen("Monitor:"));
+        int index = atoi(index_str.c_str());
+        if (index >= 0 && index < static_cast<int>(monitor_devices_.size()))
+          Open(monitor_devices_[index]);
+        else
+          PP_NOTREACHED();
+      } else if (event.find("Enumerate:") == 0) {
+        std::string index_str = event.substr(strlen("Enumerate:"));
+        int index = atoi(index_str.c_str());
+        if (index >= 0 && index < static_cast<int>(enumerate_devices_.size()))
+          Open(enumerate_devices_[index]);
+        else
+          PP_NOTREACHED();
       }
     }
   }
@@ -184,24 +199,10 @@
     return image;
   }
 
-  // TODO(viettrungluu): Danger! We really should lock, but which thread
-  // primitives to use? In any case, the |StopCapture()| in the destructor
-  // shouldn't return until this callback is done, so at least we should be
-  // writing to a valid region of memory.
-  static void CaptureCallback(const void* samples,
-                              uint32_t num_bytes,
-                              void* ctx) {
-    MyInstance* thiz = static_cast<MyInstance*>(ctx);
-    uint32_t buffer_size =
-        thiz->sample_count_ * thiz->channel_count_ * sizeof(int16_t);
-    PP_DCHECK(num_bytes <= buffer_size);
-    PP_DCHECK(num_bytes % (thiz->channel_count_ * sizeof(int16_t)) == 0);
-    memcpy(thiz->samples_, samples, num_bytes);
-    memset(reinterpret_cast<char*>(thiz->samples_) + num_bytes, 0,
-           buffer_size - num_bytes);
-  }
-
   void Open(const pp::DeviceRef_Dev& device) {
+    audio_input_.Close();
+    audio_input_ = pp::AudioInput_Dev(this);
+
     pp::AudioConfig config = pp::AudioConfig(this,
                                              kSampleFrequency,
                                              sample_count_);
@@ -225,13 +226,11 @@
 
   void EnumerateDevicesFinished(int32_t result,
                                 std::vector<pp::DeviceRef_Dev>& devices) {
-    static const char* const kDelimiter = "#__#";
-
     if (result == PP_OK) {
-      devices_.swap(devices);
-      std::string device_names;
-      for (size_t index = 0; index < devices_.size(); ++index) {
-        pp::Var name = devices_[index].GetName();
+      enumerate_devices_.swap(devices);
+      std::string device_names = "Enumerate:";
+      for (size_t index = 0; index < enumerate_devices_.size(); ++index) {
+        pp::Var name = enumerate_devices_[index].GetName();
         PP_DCHECK(name.is_string());
 
         if (index != 0)
@@ -253,6 +252,43 @@
     }
   }
 
+  // TODO(viettrungluu): Danger! We really should lock, but which thread
+  // primitives to use? In any case, the |StopCapture()| in the destructor
+  // shouldn't return until this callback is done, so at least we should be
+  // writing to a valid region of memory.
+  static void CaptureCallback(const void* samples,
+                              uint32_t num_bytes,
+                              void* ctx) {
+    MyInstance* thiz = static_cast<MyInstance*>(ctx);
+    uint32_t buffer_size =
+        thiz->sample_count_ * thiz->channel_count_ * sizeof(int16_t);
+    PP_DCHECK(num_bytes <= buffer_size);
+    PP_DCHECK(num_bytes % (thiz->channel_count_ * sizeof(int16_t)) == 0);
+    memcpy(thiz->samples_, samples, num_bytes);
+    memset(reinterpret_cast<char*>(thiz->samples_) + num_bytes, 0,
+           buffer_size - num_bytes);
+  }
+
+  static void MonitorDeviceChangeCallback(void* user_data,
+                                          uint32_t device_count,
+                                          const PP_Resource devices[]) {
+    MyInstance* thiz = static_cast<MyInstance*>(user_data);
+
+    std::string device_names = "Monitor:";
+    thiz->monitor_devices_.clear();
+    thiz->monitor_devices_.reserve(device_count);
+    for (size_t index = 0; index < device_count; ++index) {
+      thiz->monitor_devices_.push_back(pp::DeviceRef_Dev(devices[index]));
+      pp::Var name = thiz->monitor_devices_.back().GetName();
+      PP_DCHECK(name.is_string());
+
+      if (index != 0)
+        device_names += kDelimiter;
+      device_names += name.AsString();
+    }
+    thiz->PostMessage(pp::Var(device_names));
+  }
+
   pp::CompletionCallbackFactory<MyInstance> callback_factory_;
 
   uint32_t sample_count_;
@@ -267,9 +303,14 @@
   bool pending_paint_;
   bool waiting_for_flush_completion_;
 
+  // There is no need to have two resources to do capturing and device detecting
+  // separately. However, this makes the code of monitoring device change
+  // easier.
   pp::AudioInput_Dev audio_input_;
+  pp::AudioInput_Dev device_detector_;
 
-  std::vector<pp::DeviceRef_Dev> devices_;
+  std::vector<pp::DeviceRef_Dev> enumerate_devices_;
+  std::vector<pp::DeviceRef_Dev> monitor_devices_;
 };
 
 class MyModule : public pp::Module {
diff --git a/ppapi/examples/audio_input/audio_input.html b/ppapi/examples/audio_input/audio_input.html
index 8fa043c..2c764bb 100644
--- a/ppapi/examples/audio_input/audio_input.html
+++ b/ppapi/examples/audio_input/audio_input.html
@@ -8,13 +8,17 @@
 <head>
   <title>Audio Input Example</title>
   <script type="text/javascript">
-    var device_array = [];
+    var monitor_device_array = [];
+    var enumerate_device_array = [];
+    var monitor_notification_count = 0;
 
     function HandleMessage(message_event) {
       if (message_event.data) {
         var status = document.getElementById('status');
         if (message_event.data == 'EnumerationFailed') {
           status.innerText = 'Device enumeration failed!';
+        } else if (message_event.data == 'MonitorDeviceChangeFailed') {
+          status.innerText = 'Monitor device change failed!';
         } else if (message_event.data == 'OpenFailed') {
           status.innerText = 'Open device failed!';
         } else if (message_event.data == 'StartFailed') {
@@ -22,23 +26,60 @@
         } else if (message_event.data == 'StopFailed') {
           status.innerText = 'Stop capturing failed!';
         } else {
-          device_array = message_event.data.split('#__#');
-
-          var list = document.getElementById('device_list');
-          for (var i = 0; i < device_array.length; ++i) {
-            var list_item = document.createElement('li');
-            var link = document.createElement('a');
-            link.href = 'javascript:UseDesignatedDevice(' + i + ');';
-            link.innerText = device_array[i];
-            list_item.appendChild(link);
-            list.appendChild(list_item);
-          }
+          AddDevices(message_event.data);
         }
       }
     }
 
-    function UseDesignatedDevice(index) {
-      UseDevice(device_array[index], index);
+    function AddDevices(command) {
+      var serialized_names = '';
+      var is_monitor = false;
+      if (command.search('Monitor:') == 0) {
+        serialized_names = command.substr(8);
+        is_monitor = true;
+        monitor_notification_count++;
+        var counter = document.getElementById('notification_counter');
+        counter.innerText = monitor_notification_count;
+      } else if (command.search('Enumerate:') == 0) {
+        serialized_names = command.substr(10);
+      } else {
+        status.innerText = 'Unrecognized command!';
+        return;
+      }
+
+      var storage = serialized_names.length != 0 ?
+                    serialized_names.split('#__#') : [];
+      if (is_monitor)
+        monitor_device_array = storage;
+      else
+        enumerate_device_array = storage;
+
+      var list = document.getElementById(
+          is_monitor ? 'monitor_list' : 'enumerate_list');
+      while (list.firstChild)
+        list.removeChild(list.firstChild);
+
+      for (var i = 0; i < storage.length; ++i) {
+        AppendDevice(
+            list, storage[i],
+            'javascript:UseDesignatedDevice(' + is_monitor + ',' + i + ');');
+      }
+    }
+
+    function AppendDevice(list, text, href) {
+      var list_item = document.createElement('li');
+      var link = document.createElement('a');
+      link.href = href;
+      link.innerText = text;
+      list_item.appendChild(link);
+      list.appendChild(list_item);
+    }
+
+    function UseDesignatedDevice(is_monitor, index) {
+      if (is_monitor)
+        UseDevice(monitor_device_array[index], 'Monitor:' + index);
+      else
+        UseDevice(enumerate_device_array[index], 'Enumerate:' + index);
     }
 
     function UseDefaultDevice() {
@@ -50,12 +91,6 @@
       in_use_device.innerText = display_text;
       var plugin = document.getElementById('plugin');
       plugin.postMessage(command);
-
-      var available_devices = document.getElementById('available_devices');
-      available_devices.parentNode.removeChild(available_devices);
-
-      var control_panel = document.getElementById('control_panel');
-      control_panel.style.display = 'block';
     }
 
     function Stop() {
@@ -70,7 +105,7 @@
 
     function Initialize() {
       var plugin = document.getElementById('plugin');
-      plugin.addEventListener('message', HandleMessage, false);
+      plugin.addEventListener('message', HandleMessage, false)
       plugin.postMessage('PageInitialized');
     }
 
@@ -86,14 +121,26 @@
   </div>
   <div id="available_devices">
     Available device(s), choose one to open:
-    <ul id="device_list">
+    <ul>
       <li><a href="javascript:UseDefaultDevice();">
-          Default - use interface version 0.2 and NULL device ref</a></li>
+          Default - use NULL device ref</a></li>
     </ul>
+    <div>
+      <ul>List retrieved by MonitorDeviceChange(), will change when
+          pluging/unpluging devices: (Notifications received:
+          <span style="font-weight:bold" id="notification_counter">0</span>
+          )</ul>
+      <ul id="monitor_list"/>
+    </div>
+    <div>
+      <ul>List retrieved by EnumerateDevices(), never updated after the page is
+          initialized:</ul>
+      <ul id="enumerate_list"/>
+    </div>
   </div>
-  <div id="control_panel" style="display:none">
+  <div id="control_panel">
     <a href="javascript:Stop();">Stop</a>
-    <a href="javascript:Start();">Start</a>
+    <a href="javascript:Start();">Start</a> (known issue: crbug.com/161058)
   </div>
   <div id="status"></div>
 </body>
diff --git a/ppapi/examples/enumerate_devices/enumerate_devices.html b/ppapi/examples/enumerate_devices/enumerate_devices.html
index d77cadb..6afd94d 100644
--- a/ppapi/examples/enumerate_devices/enumerate_devices.html
+++ b/ppapi/examples/enumerate_devices/enumerate_devices.html
@@ -22,10 +22,10 @@
           if (devices_data.length > 0)
             device_array = devices_data.split('#__#');
           else
-            devices_array = [];
+            device_array = [];
 
           var list = document.getElementById('device_list');
-          if (devices_array.length == 0)
+          if (device_array.length == 0)
             list.innerHTML = 'No devices.';
           for (var i = 0; i < device_array.length; ++i) {
             var list_item = document.createElement('li');
diff --git a/ppapi/examples/gamepad/gamepad.cc b/ppapi/examples/gamepad/gamepad.cc
index 4fedc0b..e4a9f9f 100644
--- a/ppapi/examples/gamepad/gamepad.cc
+++ b/ppapi/examples/gamepad/gamepad.cc
@@ -6,7 +6,6 @@
 #include <stdarg.h>
 #include <stdio.h>
 
-#include "ppapi/c/dev/ppb_console_dev.h"
 #include "ppapi/c/ppb_gamepad.h"
 #include "ppapi/c/ppb_input_event.h"
 #include "ppapi/cpp/completion_callback.h"
diff --git a/ppapi/examples/gles2/gles2.cc b/ppapi/examples/gles2/gles2.cc
index fee9364..9fd6b58 100644
--- a/ppapi/examples/gles2/gles2.cc
+++ b/ppapi/examples/gles2/gles2.cc
@@ -7,12 +7,13 @@
 #include <iostream>
 #include <sstream>
 
-#include "ppapi/c/dev/ppb_console_dev.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/c/ppb_opengles2.h"
 #include "ppapi/cpp/core.h"
+#include "ppapi/cpp/fullscreen.h"
 #include "ppapi/cpp/graphics_3d.h"
 #include "ppapi/cpp/graphics_3d_client.h"
+#include "ppapi/cpp/input_event.h"
 #include "ppapi/cpp/instance.h"
 #include "ppapi/cpp/module.h"
 #include "ppapi/cpp/rect.h"
@@ -55,6 +56,14 @@
     module_->core()->CallOnMainThread(0, cb, 0);
   }
 
+  virtual bool HandleInputEvent(const pp::InputEvent& event) {
+    if (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEUP) {
+      fullscreen_ = !fullscreen_;
+      pp::Fullscreen(this).SetFullscreen(fullscreen_);
+    }
+    return true;
+  }
+
  private:
 
   // GL-related functions.
@@ -70,15 +79,18 @@
 
   // Owned data.
   pp::Graphics3D* context_;
+  bool fullscreen_;
 };
 
 GLES2DemoInstance::GLES2DemoInstance(PP_Instance instance, pp::Module* module)
     : pp::Instance(instance), pp::Graphics3DClient(this),
       callback_factory_(this),
       module_(module),
-      context_(NULL) {
+      context_(NULL),
+      fullscreen_(false) {
   assert((gles2_if_ = static_cast<const PPB_OpenGLES2*>(
       module->GetBrowserInterface(PPB_OPENGLES2_INTERFACE))));
+  RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE);
 }
 
 GLES2DemoInstance::~GLES2DemoInstance() {
@@ -89,10 +101,6 @@
     const pp::Rect& position, const pp::Rect& clip_ignored) {
   if (position.width() == 0 || position.height() == 0)
     return;
-  if (plugin_size_.width()) {
-    assert(position.size() == plugin_size_);
-    return;
-  }
   plugin_size_ = position.size();
 
   // Initialize graphics.
@@ -114,7 +122,10 @@
 void GLES2DemoInstance::InitGL(int32_t result) {
   assert(plugin_size_.width() && plugin_size_.height());
 
-  assert(!context_);
+  if (context_) {
+    context_->ResizeBuffers(plugin_size_.width(), plugin_size_.height());
+    return;
+  }
   int32_t context_attributes[] = {
     PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8,
     PP_GRAPHICS3DATTRIB_BLUE_SIZE, 8,
diff --git a/ppapi/examples/ime/ime.cc b/ppapi/examples/ime/ime.cc
index e217145..f5e2e44 100644
--- a/ppapi/examples/ime/ime.cc
+++ b/ppapi/examples/ime/ime.cc
@@ -6,8 +6,8 @@
 #include <utility>
 #include <vector>
 
-#include "ppapi/c/dev/ppb_console_dev.h"
 #include "ppapi/c/dev/ppb_cursor_control_dev.h"
+#include "ppapi/c/ppb_console.h"
 #include "ppapi/cpp/completion_callback.h"
 #include "ppapi/cpp/dev/font_dev.h"
 #include "ppapi/cpp/dev/ime_input_event_dev.h"
@@ -701,8 +701,8 @@
 
   // Prints a debug message.
   void Log(const pp::Var& value) {
-    const PPB_Console_Dev* console = reinterpret_cast<const PPB_Console_Dev*>(
-        pp::Module::Get()->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE));
+    const PPB_Console* console = reinterpret_cast<const PPB_Console*>(
+        pp::Module::Get()->GetBrowserInterface(PPB_CONSOLE_INTERFACE));
     if (!console)
       return;
     console->Log(pp_instance(), PP_LOGLEVEL_LOG, value.pp_var());
diff --git a/ppapi/examples/mouse_lock/mouse_lock.cc b/ppapi/examples/mouse_lock/mouse_lock.cc
index 4203622..3b1644f 100644
--- a/ppapi/examples/mouse_lock/mouse_lock.cc
+++ b/ppapi/examples/mouse_lock/mouse_lock.cc
@@ -6,7 +6,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 
-#include "ppapi/c/dev/ppb_console_dev.h"
+#include "ppapi/c/ppb_console.h"
 #include "ppapi/c/ppb_input_event.h"
 #include "ppapi/cpp/graphics_2d.h"
 #include "ppapi/cpp/image_data.h"
@@ -37,8 +37,8 @@
   virtual ~MyInstance() {}
 
   virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) {
-    console_ = reinterpret_cast<const PPB_Console_Dev*>(
-        pp::Module::Get()->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE));
+    console_ = reinterpret_cast<const PPB_Console*>(
+        pp::Module::Get()->GetBrowserInterface(PPB_CONSOLE_INTERFACE));
     if (!console_)
       return false;
 
@@ -226,7 +226,7 @@
                 pow(static_cast<double>(point_1_y - point_2_y), 2));
   }
 
-  void Log(PP_LogLevel_Dev level, const char* format, ...) {
+  void Log(PP_LogLevel level, const char* format, ...) {
     va_list args;
     va_start(args, format);
     char buf[512];
@@ -249,7 +249,7 @@
 
   pp::CompletionCallbackFactory<MyInstance> callback_factory_;
 
-  const PPB_Console_Dev* console_;
+  const PPB_Console* console_;
 
   pp::FlashFullscreen flash_fullscreen_;
 
diff --git a/ppapi/examples/url_loader/stream_to_file.cc b/ppapi/examples/url_loader/stream_to_file.cc
new file mode 100644
index 0000000..887a9d7
--- /dev/null
+++ b/ppapi/examples/url_loader/stream_to_file.cc
@@ -0,0 +1,171 @@
+// 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.
+
+// This example shows how to use the URLLoader in "stream to file" mode where
+// the browser writes incoming data to a file, which you can read out via the
+// file I/O APIs.
+//
+// This example uses PostMessage between the plugin and the url_loader.html
+// page in this directory to start the load and to communicate the result.
+
+#include "ppapi/c/ppb_file_io.h"
+#include "ppapi/cpp/file_io.h"
+#include "ppapi/cpp/file_ref.h"
+#include "ppapi/cpp/instance.h"
+#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/url_loader.h"
+#include "ppapi/cpp/url_request_info.h"
+#include "ppapi/cpp/url_response_info.h"
+#include "ppapi/utility/completion_callback_factory.h"
+
+// When compiling natively on Windows, PostMessage can be #define-d to
+// something else.
+#ifdef PostMessage
+#undef PostMessage
+#endif
+
+// Buffer size for reading network data.
+const int kBufSize = 1024;
+
+class MyInstance : public pp::Instance {
+ public:
+  explicit MyInstance(PP_Instance instance)
+      : pp::Instance(instance) {
+    factory_.Initialize(this);
+  }
+  virtual ~MyInstance() {
+    // Make sure to explicitly close the loader. If somebody else is holding a
+    // reference to the URLLoader object when this class goes out of scope (so
+    // the URLLoader outlives "this"), and you have an outstanding read
+    // request, the URLLoader will write into invalid memory.
+    loader_.Close();
+  }
+
+  // Handler for the page sending us messages.
+  virtual void HandleMessage(const pp::Var& message_data);
+
+ private:
+  // Called to initiate the request.
+  void StartRequest(const std::string& url);
+
+  // Callback for the URLLoader to tell us it finished opening the connection.
+  void OnOpenComplete(int32_t result);
+
+  // Callback for when the file is completely filled with the download
+  void OnStreamComplete(int32_t result);
+
+  void OnOpenFileComplete(int32_t result);
+  void OnReadComplete(int32_t result);
+
+  // Forwards the given string to the page.
+  void ReportResponse(const std::string& data);
+
+  // Generates completion callbacks scoped to this class.
+  pp::CompletionCallbackFactory<MyInstance> factory_;
+
+  pp::URLLoader loader_;
+  pp::URLResponseInfo response_;
+  pp::FileRef dest_file_;
+  pp::FileIO file_io_;
+
+  // The buffer used for the current read request. This is filled and then
+  // copied into content_ to build up the entire document.
+  char buf_[kBufSize];
+
+  // All the content loaded so far.
+  std::string content_;
+};
+
+void MyInstance::HandleMessage(const pp::Var& message_data) {
+  if (message_data.is_string() && message_data.AsString() == "go")
+    StartRequest("./fetched_content.html");
+}
+
+void MyInstance::StartRequest(const std::string& url) {
+  content_.clear();
+
+  pp::URLRequestInfo request(this);
+  request.SetURL(url);
+  request.SetMethod("GET");
+  request.SetStreamToFile(true);
+
+  loader_ = pp::URLLoader(this);
+  loader_.Open(request,
+               factory_.NewCallback(&MyInstance::OnOpenComplete));
+}
+
+void MyInstance::OnOpenComplete(int32_t result) {
+  if (result != PP_OK) {
+    ReportResponse("URL could not be requested");
+    return;
+  }
+
+  loader_.FinishStreamingToFile(
+      factory_.NewCallback(&MyInstance::OnStreamComplete));
+  response_ = loader_.GetResponseInfo();
+  dest_file_ = response_.GetBodyAsFileRef();
+}
+
+void MyInstance::OnStreamComplete(int32_t result) {
+  if (result == PP_OK) {
+    file_io_ = pp::FileIO(this);
+    file_io_.Open(dest_file_, PP_FILEOPENFLAG_READ,
+        factory_.NewCallback(&MyInstance::OnOpenFileComplete));
+  } else {
+    ReportResponse("Could not stream to file");
+  }
+}
+
+void MyInstance::OnOpenFileComplete(int32_t result) {
+  if (result == PP_OK) {
+    // Note we only read the first 1024 bytes from the file in this example
+    // to keep things simple. Please see a file I/O example for more details
+    // on reading files.
+    file_io_.Read(0, buf_, kBufSize,
+        factory_.NewCallback(&MyInstance::OnReadComplete));
+  } else {
+    ReportResponse("Could not open file");
+  }
+}
+
+void MyInstance::OnReadComplete(int32_t result) {
+  if (result >= 0) {
+    content_.append(buf_, result);
+    ReportResponse(buf_);
+  } else {
+    ReportResponse("Could not read file");
+  }
+
+  // Release everything.
+  loader_ = pp::URLLoader();
+  response_ = pp::URLResponseInfo();
+  dest_file_ = pp::FileRef();
+  file_io_ = pp::FileIO();
+}
+
+void MyInstance::ReportResponse(const std::string& data) {
+  PostMessage(pp::Var(data));
+}
+
+// This object is the global object representing this plugin library as long
+// as it is loaded.
+class MyModule : public pp::Module {
+ public:
+  MyModule() : pp::Module() {}
+  virtual ~MyModule() {}
+
+  // Override CreateInstance to create your customized Instance object.
+  virtual pp::Instance* CreateInstance(PP_Instance instance) {
+    return new MyInstance(instance);
+  }
+};
+
+namespace pp {
+
+// Factory function for your specialization of the Module object.
+Module* CreateModule() {
+  return new MyModule();
+}
+
+}  // namespace pp
diff --git a/ppapi/examples/url_loader/streaming.cc b/ppapi/examples/url_loader/streaming.cc
index 18efe68..762a00b 100644
--- a/ppapi/examples/url_loader/streaming.cc
+++ b/ppapi/examples/url_loader/streaming.cc
@@ -7,9 +7,7 @@
 // the plugin and the url_loader.html page in this directory to start the load
 // and to communicate the result.
 //
-// The other mode is to stream to a file instead. For that mode, call
-// URLLoader.FinishSthreamingToFile once the "Open" callback is complete, and
-// then call URLResponseInfo.GetBodyAsFileRef once the file stream is complete.
+// The other mode is to stream to a file instead. See stream_to_file.cc
 
 #include "ppapi/cpp/instance.h"
 #include "ppapi/cpp/module.h"
diff --git a/ppapi/examples/video_capture/video_capture.cc b/ppapi/examples/video_capture/video_capture.cc
index 25d2ef0..b95fcac 100644
--- a/ppapi/examples/video_capture/video_capture.cc
+++ b/ppapi/examples/video_capture/video_capture.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 <assert.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include <map>
@@ -33,11 +33,13 @@
 
 // Assert |context_| isn't holding any GL Errors.  Done as a macro instead of a
 // function to preserve line number information in the failure message.
-#define assertNoGLError() \
-  assert(!gles2_if_->GetError(context_->pp_resource()));
+#define AssertNoGLError() \
+  PP_DCHECK(!gles2_if_->GetError(context_->pp_resource()));
 
 namespace {
 
+const char* const kDelimiter = "#__#";
+
 // This object is the global object representing this plugin library as long
 // as it is loaded.
 class VCDemoModule : public pp::Module {
@@ -124,10 +126,16 @@
   void CreateYUVTextures();
 
   void Open(const pp::DeviceRef_Dev& device);
+  void Stop();
+  void Start();
   void EnumerateDevicesFinished(int32_t result,
                                 std::vector<pp::DeviceRef_Dev>& devices);
   void OpenFinished(int32_t result);
 
+  static void MonitorDeviceChangeCallback(void* user_data,
+                                          uint32_t device_count,
+                                          const PP_Resource devices[]);
+
   pp::Size position_size_;
   bool is_painting_;
   bool needs_paint_;
@@ -145,7 +153,8 @@
   // Owned data.
   pp::Graphics3D* context_;
 
-  std::vector<pp::DeviceRef_Dev> devices_;
+  std::vector<pp::DeviceRef_Dev> enumerate_devices_;
+  std::vector<pp::DeviceRef_Dev> monitor_devices_;
 };
 
 VCDemoInstance::VCDemoInstance(PP_Instance instance, pp::Module* module)
@@ -162,7 +171,7 @@
       context_(NULL) {
   gles2_if_ = static_cast<const struct PPB_OpenGLES2*>(
       module->GetBrowserInterface(PPB_OPENGLES2_INTERFACE));
-  assert(gles2_if_);
+  PP_DCHECK(gles2_if_);
 
   capture_info_.width = 320;
   capture_info_.height = 240;
@@ -170,6 +179,7 @@
 }
 
 VCDemoInstance::~VCDemoInstance() {
+  video_capture_.MonitorDeviceChange(NULL, NULL);
   delete context_;
 }
 
@@ -192,34 +202,43 @@
   if (message_data.is_string()) {
     std::string event = message_data.AsString();
     if (event == "PageInitialized") {
+      int32_t result = video_capture_.MonitorDeviceChange(
+          &VCDemoInstance::MonitorDeviceChangeCallback, this);
+      if (result != PP_OK)
+        PostMessage(pp::Var("MonitorDeviceChangeFailed"));
+
       pp::CompletionCallbackWithOutput<std::vector<pp::DeviceRef_Dev> >
           callback = callback_factory_.NewCallbackWithOutput(
               &VCDemoInstance::EnumerateDevicesFinished);
-      video_capture_.EnumerateDevices(callback);
+      result = video_capture_.EnumerateDevices(callback);
+      if (result != PP_OK_COMPLETIONPENDING)
+        PostMessage(pp::Var("EnumerationFailed"));
     } else if (event == "UseDefault") {
       Open(pp::DeviceRef_Dev());
-    } else if (event == "UseDefault(v0.1)") {
-      const PPB_VideoCapture_Dev_0_1* video_capture_0_1 =
-          static_cast<const PPB_VideoCapture_Dev_0_1*>(
-              pp::Module::Get()->GetBrowserInterface(
-                  PPB_VIDEOCAPTURE_DEV_INTERFACE_0_1));
-      video_capture_0_1->StartCapture(video_capture_.pp_resource(),
-                                      &capture_info_, 4);
     } else if (event == "Stop") {
-      video_capture_.StopCapture();
-    }
-  } else if (message_data.is_number()) {
-    int index = message_data.AsInt();
-    if (index >= 0 && index < static_cast<int>(devices_.size())) {
-      Open(devices_[index]);
-    } else {
-      assert(false);
+      Stop();
+    } else if (event == "Start") {
+      Start();
+    } else if (event.find("Monitor:") == 0) {
+      std::string index_str = event.substr(strlen("Monitor:"));
+      int index = atoi(index_str.c_str());
+      if (index >= 0 && index < static_cast<int>(monitor_devices_.size()))
+        Open(monitor_devices_[index]);
+      else
+        PP_NOTREACHED();
+    } else if (event.find("Enumerate:") == 0) {
+      std::string index_str = event.substr(strlen("Enumerate:"));
+      int index = atoi(index_str.c_str());
+      if (index >= 0 && index < static_cast<int>(enumerate_devices_.size()))
+        Open(enumerate_devices_[index]);
+      else
+        PP_NOTREACHED();
     }
   }
 }
 
 void VCDemoInstance::InitGL() {
-  assert(position_size_.width() && position_size_.height());
+  PP_DCHECK(position_size_.width() && position_size_.height());
   is_painting_ = false;
 
   delete context_;
@@ -237,7 +256,7 @@
     PP_GRAPHICS3DATTRIB_NONE,
   };
   context_ = new pp::Graphics3D(this, attributes);
-  assert(!context_->is_null());
+  PP_DCHECK(!context_->is_null());
 
   // Set viewport window size and clear color bit.
   gles2_if_->ClearColor(context_->pp_resource(), 1, 0, 0, 1);
@@ -246,13 +265,13 @@
                       position_size_.width(), position_size_.height());
 
   BindGraphics(*context_);
-  assertNoGLError();
+  AssertNoGLError();
 
   CreateGLObjects();
 }
 
 void VCDemoInstance::Render() {
-  assert(!is_painting_);
+  PP_DCHECK(!is_painting_);
   is_painting_ = true;
   needs_paint_ = false;
   if (texture_y_) {
@@ -274,7 +293,7 @@
 GLuint VCDemoInstance::CreateTexture(int32_t width, int32_t height, int unit) {
   GLuint texture_id;
   gles2_if_->GenTextures(context_->pp_resource(), 1, &texture_id);
-  assertNoGLError();
+  AssertNoGLError();
   // Assign parameters.
   gles2_if_->ActiveTexture(context_->pp_resource(), GL_TEXTURE0 + unit);
   gles2_if_->BindTexture(context_->pp_resource(), GL_TEXTURE_2D, texture_id);
@@ -295,7 +314,7 @@
   gles2_if_->TexImage2D(
       context_->pp_resource(), GL_TEXTURE_2D, 0, GL_LUMINANCE, width, height, 0,
       GL_LUMINANCE, GL_UNSIGNED_BYTE, NULL);
-  assertNoGLError();
+  AssertNoGLError();
   return texture_id;
 }
 
@@ -354,7 +373,7 @@
       context,
       gles2_if_->GetUniformLocation(context, program, "color_matrix"),
       1, GL_FALSE, kColorMatrix);
-  assertNoGLError();
+  AssertNoGLError();
 
   // Assign vertex positions and texture coordinates to buffers for use in
   // shader program.
@@ -368,12 +387,12 @@
   gles2_if_->BindBuffer(context, GL_ARRAY_BUFFER, buffer);
   gles2_if_->BufferData(context, GL_ARRAY_BUFFER,
                         sizeof(kVertices), kVertices, GL_STATIC_DRAW);
-  assertNoGLError();
+  AssertNoGLError();
   GLint pos_location = gles2_if_->GetAttribLocation(
       context, program, "a_position");
   GLint tc_location = gles2_if_->GetAttribLocation(
       context, program, "a_texCoord");
-  assertNoGLError();
+  AssertNoGLError();
   gles2_if_->EnableVertexAttribArray(context, pos_location);
   gles2_if_->VertexAttribPointer(context, pos_location, 2,
                                  GL_FLOAT, GL_FALSE, 0, 0);
@@ -381,7 +400,7 @@
   gles2_if_->VertexAttribPointer(
       context, tc_location, 2, GL_FLOAT, GL_FALSE, 0,
       static_cast<float*>(0) + 8);  // Skip position coordinates.
-  assertNoGLError();
+  AssertNoGLError();
 }
 
 void VCDemoInstance::CreateShader(
@@ -408,20 +427,30 @@
 void VCDemoInstance::Open(const pp::DeviceRef_Dev& device) {
   pp::CompletionCallback callback = callback_factory_.NewCallback(
       &VCDemoInstance::OpenFinished);
-  video_capture_.Open(device, capture_info_, 4, callback);
+  int32_t result = video_capture_.Open(device, capture_info_, 4, callback);
+  if (result != PP_OK_COMPLETIONPENDING)
+    PostMessage(pp::Var("OpenFailed"));
+}
+
+void VCDemoInstance::Stop() {
+  if (video_capture_.StopCapture() != PP_OK)
+    PostMessage(pp::Var("StopFailed"));
+}
+
+void VCDemoInstance::Start() {
+  if (video_capture_.StartCapture() != PP_OK)
+    PostMessage(pp::Var("StartFailed"));
 }
 
 void VCDemoInstance::EnumerateDevicesFinished(
     int32_t result,
-    std::vector<pp::DeviceRef_Dev>& devices) {
-  static const char* const kDelimiter = "#__#";
-
+  std::vector<pp::DeviceRef_Dev>& devices) {
   if (result == PP_OK) {
-    devices_.swap(devices);
-    std::string device_names;
-    for (size_t index = 0; index < devices_.size(); ++index) {
-      pp::Var name = devices_[index].GetName();
-      assert(name.is_string());
+    enumerate_devices_.swap(devices);
+    std::string device_names = "Enumerate:";
+    for (size_t index = 0; index < enumerate_devices_.size(); ++index) {
+      pp::Var name = enumerate_devices_[index].GetName();
+      PP_DCHECK(name.is_string());
 
       if (index != 0)
         device_names += kDelimiter;
@@ -434,11 +463,31 @@
 }
 
 void VCDemoInstance::OpenFinished(int32_t result) {
-  if (result == PP_OK) {
-    video_capture_.StartCapture();
-  } else {
+  if (result == PP_OK)
+    Start();
+  else
     PostMessage(pp::Var("OpenFailed"));
+}
+
+// static
+void VCDemoInstance::MonitorDeviceChangeCallback(void* user_data,
+                                                 uint32_t device_count,
+                                                 const PP_Resource devices[]) {
+  VCDemoInstance* thiz = static_cast<VCDemoInstance*>(user_data);
+
+  std::string device_names = "Monitor:";
+  thiz->monitor_devices_.clear();
+  thiz->monitor_devices_.reserve(device_count);
+  for (size_t index = 0; index < device_count; ++index) {
+    thiz->monitor_devices_.push_back(pp::DeviceRef_Dev(devices[index]));
+    pp::Var name = thiz->monitor_devices_.back().GetName();
+    PP_DCHECK(name.is_string());
+
+    if (index != 0)
+      device_names += kDelimiter;
+    device_names += name.AsString();
   }
+  thiz->PostMessage(pp::Var(device_names));
 }
 
 pp::Instance* VCDemoModule::CreateInstance(PP_Instance instance) {
diff --git a/ppapi/examples/video_capture/video_capture.html b/ppapi/examples/video_capture/video_capture.html
index 4aa888e..1c85577 100644
--- a/ppapi/examples/video_capture/video_capture.html
+++ b/ppapi/examples/video_capture/video_capture.html
@@ -8,40 +8,84 @@
 <head>
   <title>Video Capture Example</title>
   <script type="text/javascript">
-    var device_array = [];
+    var monitor_device_array = [];
+    var enumerate_device_array = [];
+    var monitor_notification_count = 0;
 
     function HandleMessage(message_event) {
       if (message_event.data) {
+        var status = document.getElementById('status');
         if (message_event.data == 'EnumerationFailed') {
-          var status = document.getElementById('status');
           status.innerText = 'Device enumeration failed!';
+        } else if (message_event.data == 'MonitorDeviceChangeFailed') {
+          status.innerText = 'Monitor device change failed!';
         } else if (message_event.data == 'OpenFailed') {
-          var status = document.getElementById('status');
           status.innerText = 'Open device failed!';
+        } else if (message_event.data == 'StartFailed') {
+          status.innerText = 'Start capturing failed!';
+        } else if (message_event.data == 'StopFailed') {
+          status.innerText = 'Stop capturing failed!';
         } else {
-          device_array = message_event.data.split('#__#');
-
-          var list = document.getElementById('device_list');
-          for (var i = 0; i < device_array.length; ++i) {
-            var list_item = document.createElement('li');
-            var link = document.createElement('a');
-            link.href = 'javascript:UseDesignatedDevice(' + i + ');';
-            link.innerText = device_array[i];
-            list_item.appendChild(link);
-            list.appendChild(list_item);
-          }
+          AddDevices(message_event.data);
         }
       }
     }
 
-    function UseDesignatedDevice(index) {
-      UseDevice(device_array[index], index);
+    function AddDevices(command) {
+      var serialized_names = '';
+      var is_monitor = false;
+      if (command.search('Monitor:') == 0) {
+        serialized_names = command.substr(8);
+        is_monitor = true;
+        monitor_notification_count++;
+        var counter = document.getElementById('notification_counter');
+        counter.innerText = monitor_notification_count;
+      } else if (command.search('Enumerate:') == 0) {
+        serialized_names = command.substr(10);
+      } else {
+        status.innerText = 'Unrecognized command!';
+        return;
+      }
+
+      var storage = serialized_names.length != 0 ?
+                    serialized_names.split('#__#') : [];
+      if (is_monitor)
+        monitor_device_array = storage;
+      else
+        enumerate_device_array = storage;
+
+      var list = document.getElementById(
+          is_monitor ? 'monitor_list' : 'enumerate_list');
+      if (list) {
+        while (list.firstChild)
+          list.removeChild(list.firstChild);
+
+        for (var i = 0; i < storage.length; ++i) {
+          AppendDevice(
+              list, storage[i],
+              'javascript:UseDesignatedDevice(' + is_monitor + ',' + i + ');');
+        }
+      }
     }
 
-    function UseDefaultDevice(use_0_1_interface) {
-      var display_text = use_0_1_interface ? 'Default(v0.1)' : 'Default';
-      var command = use_0_1_interface ? 'UseDefault(v0.1)' : 'UseDefault';
-      UseDevice(display_text, command);
+    function AppendDevice(list, text, href) {
+      var list_item = document.createElement('li');
+      var link = document.createElement('a');
+      link.href = href;
+      link.innerText = text;
+      list_item.appendChild(link);
+      list.appendChild(list_item);
+    }
+
+    function UseDesignatedDevice(is_monitor, index) {
+      if (is_monitor)
+        UseDevice(monitor_device_array[index], 'Monitor:' + index);
+      else
+        UseDevice(enumerate_device_array[index], 'Enumerate:' + index);
+    }
+
+    function UseDefaultDevice() {
+      UseDevice('Default', 'UseDefault');
     }
 
     function UseDevice(display_text, command) {
@@ -54,10 +98,7 @@
       available_devices.parentNode.removeChild(available_devices);
 
       var control_panel = document.getElementById('control_panel');
-      var link = document.createElement('a');
-      link.href = 'javascript:Stop();';
-      link.innerText = 'Stop';
-      control_panel.appendChild(link);
+      control_panel.style.display = '';
     }
 
     function Stop() {
@@ -65,6 +106,11 @@
       plugin.postMessage('Stop');
     }
 
+    function Start() {
+      var plugin = document.getElementById('plugin');
+      plugin.postMessage('Start');
+    }
+
     function Initialize() {
       var plugin = document.getElementById('plugin');
       plugin.addEventListener('message', HandleMessage, false);
@@ -83,13 +129,27 @@
   </div>
   <div id="available_devices">
     Available device(s), choose one to open:
-    <ul id="device_list">
-      <li><a href="javascript:UseDefaultDevice(true);">
-          Default - use interface version 0.1</a></li>
-      <li><a href="javascript:UseDefaultDevice(false);">Default</a></li>
+    <ul>
+      <li><a href="javascript:UseDefaultDevice();">
+          Default - use NULL device ref</a></li>
     </ul>
+    <div>
+      <ul>List retrieved by MonitorDeviceChange(), will change when
+          pluging/unpluging devices: (Notifications received:
+          <span style="font-weight:bold" id="notification_counter">0</span>
+          )</ul>
+      <ul id="monitor_list"/>
+    </div>
+    <div>
+      <ul>List retrieved by EnumerateDevices(), never updated after the page is
+          initialized:</ul>
+      <ul id="enumerate_list"/>
+    </div>
   </div>
-  <div id="control_panel"></div>
+  <div id="control_panel" style="display:none">
+    <a href="javascript:Stop();">Stop</a>
+    <a href="javascript:Start();">Start</a>
+  <div/>
   <div id="status"></div>
 </body>
 </html>
diff --git a/ppapi/examples/video_decode/video_decode.cc b/ppapi/examples/video_decode/video_decode.cc
index 18c671c..9758f21 100644
--- a/ppapi/examples/video_decode/video_decode.cc
+++ b/ppapi/examples/video_decode/video_decode.cc
@@ -11,8 +11,8 @@
 #include <set>
 #include <vector>
 
-#include "ppapi/c/dev/ppb_console_dev.h"
 #include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_console.h"
 #include "ppapi/c/ppb_opengles2.h"
 #include "ppapi/cpp/dev/video_decoder_client_dev.h"
 #include "ppapi/cpp/dev/video_decoder_dev.h"
@@ -70,7 +70,7 @@
     // particular need to delete context_ and re-create textures.
     // Probably have to recreate the decoder from scratch, because old textures
     // can still be outstanding in the decoder!
-    assert(!"Unexpectedly lost graphics context");
+    assert(false && "Unexpectedly lost graphics context");
   }
 
   // pp::VideoDecoderClient_Dev implementation.
@@ -178,7 +178,7 @@
   pp::CompletionCallbackFactory<VideoDecodeDemoInstance> callback_factory_;
 
   // Unowned pointers.
-  const PPB_Console_Dev* console_if_;
+  const PPB_Console* console_if_;
   const PPB_Core* core_if_;
   const PPB_OpenGLES2* gles2_if_;
 
@@ -226,8 +226,8 @@
       swap_ticks_(0),
       callback_factory_(this),
       context_(NULL) {
-  assert((console_if_ = static_cast<const PPB_Console_Dev*>(
-      module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE))));
+  assert((console_if_ = static_cast<const PPB_Console*>(
+      module->GetBrowserInterface(PPB_CONSOLE_INTERFACE))));
   assert((core_if_ = static_cast<const PPB_Core*>(
       module->GetBrowserInterface(PPB_CORE_INTERFACE))));
   assert((gles2_if_ = static_cast<const PPB_OpenGLES2*>(
@@ -461,7 +461,7 @@
 void VideoDecodeDemoInstance::NotifyError(PP_Resource decoder,
                                           PP_VideoDecodeError_Dev error) {
   LogError(this).s() << "Received error: " << error;
-  assert(!"Unexpected error; see stderr for details");
+  assert(false && "Unexpected error; see stderr for details");
 }
 
 // This object is the global object representing this plugin library as long
diff --git a/ppapi/generators/OWNERS b/ppapi/generators/OWNERS
index d07f3b5..e5369e8 100644
--- a/ppapi/generators/OWNERS
+++ b/ppapi/generators/OWNERS
@@ -1,2 +1,4 @@
 [email protected]
[email protected]
 [email protected]
[email protected]
diff --git a/ppapi/generators/generator.py b/ppapi/generators/generator.py
index 4511cd9..a71893c 100755
--- a/ppapi/generators/generator.py
+++ b/ppapi/generators/generator.py
@@ -13,6 +13,7 @@
 from idl_outfile import IDLOutFile
 from idl_parser import ParseFiles
 from idl_c_header import HGen
+from idl_thunk import TGen
 from idl_gen_pnacl import PnaclGen
 
 
@@ -25,6 +26,7 @@
           '--wnone', '--cgen', '--range=start,end',
           '--pnacl', '--pnaclshim',
           '../native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c',
+          '--tgen',
       ]
       current_dir = os.path.abspath(os.getcwd())
       script_dir = os.path.abspath(os.path.dirname(__file__))
@@ -53,4 +55,3 @@
 
 if __name__ == '__main__':
     sys.exit(Main(sys.argv[1:]))
-
diff --git a/ppapi/generators/idl_c_header.py b/ppapi/generators/idl_c_header.py
index c1e6071..2c3cf2c 100755
--- a/ppapi/generators/idl_c_header.py
+++ b/ppapi/generators/idl_c_header.py
@@ -18,21 +18,56 @@
 from idl_parser import ParseFiles
 from idl_c_proto import CGen, GetNodeComments, CommentLines, Comment
 from idl_generator import Generator, GeneratorByFile
+from idl_visitor import IDLVisitor
 
 Option('dstroot', 'Base directory of output', default=os.path.join('..', 'c'))
 Option('guard', 'Include guard prefix', default=os.path.join('ppapi', 'c'))
-Option('out', 'List of output files', default='')
 
 
-def GetOutFileName(filenode, relpath=None, prefix=None):
+#
+# PrototypeResolver
+#
+# A specialized visitor which traverses the AST, building a mapping of
+# Release names to Versions numbers and calculating a min version.
+# The mapping is applied to the File nodes within the AST.
+#
+class ProtoResolver(IDLVisitor):
+  def __init__(self):
+    IDLVisitor.__init__(self)
+    self.struct_map = {}
+    self.interface_map = {}
+
+  def Arrive(self, node, ignore):
+    if node.IsA('Member') and node.GetProperty('ref'):
+      typeref = node.typelist.GetReleases()[0]
+      if typeref.IsA('Struct'):
+        nodelist = self.struct_map.get(typeref.GetName(), [])
+        nodelist.append(node)
+        self.struct_map[typeref.GetName()] = nodelist
+
+    if node.IsA('Param'):
+      typeref = node.typelist.GetReleases()[0]
+      if typeref.IsA('Interface'):
+        nodelist = self.struct_map.get(typeref.GetName(), [])
+        nodelist.append(node)
+        self.interface_map[typeref.GetName()] = nodelist
+
+    return None
+
+
+def GetPathFromNode(filenode, relpath=None, ext=None):
   path, name = os.path.split(filenode.GetProperty('NAME'))
-  name = os.path.splitext(name)[0] + '.h'
-  if prefix: name = '%s%s' % (prefix, name)
+  if ext: name = os.path.splitext(name)[0] + ext
   if path: name = os.path.join(path, name)
   if relpath: name = os.path.join(relpath, name)
+  name = os.path.normpath(name)
   return name
 
 
+def GetHeaderFromNode(filenode, relpath=None):
+  return GetPathFromNode(filenode, relpath, ext='.h')
+
+
 def WriteGroupMarker(out, node, last_group):
   # If we are part of a group comment marker...
   if last_group and last_group != node.cls:
@@ -109,7 +144,7 @@
     Generator.__init__(self, 'C Header', 'cgen', 'Generate the C headers.')
 
   def GenerateFile(self, filenode, releases, options):
-    savename = GetOutFileName(filenode, GetOption('dstroot'))
+    savename = GetHeaderFromNode(filenode, GetOption('dstroot'))
     my_min, my_max = filenode.GetMinMax(releases)
     if my_min > releases[-1] or my_max < releases[0]:
       if os.path.isfile(savename):
@@ -125,9 +160,13 @@
 
   def GenerateHead(self, out, filenode, releases, options):
     __pychecker__ = 'unusednames=options'
+
+    proto = ProtoResolver()
+    proto.Visit(filenode, None)
+
     cgen = CGen()
     gpath = GetOption('guard')
-    def_guard = GetOutFileName(filenode, relpath=gpath)
+    def_guard = GetHeaderFromNode(filenode, relpath=gpath)
     def_guard = def_guard.replace(os.sep,'_').replace('.','_').upper() + '_'
 
     cright_node = filenode.GetChildren()[0]
@@ -138,8 +177,7 @@
     out.Write('%s\n' % cgen.Copyright(cright_node))
 
     # Wrap the From ... modified ... comment if it would be >80 characters.
-    from_text = 'From %s' % (
-        filenode.GetProperty('NAME').replace(os.sep,'/'))
+    from_text = 'From %s' % GetPathFromNode(filenode).replace(os.sep, '/')
     modified_text = 'modified %s.' % (
         filenode.GetProperty('DATETIME'))
     if len(from_text) + len(modified_text) < 74:
@@ -159,7 +197,7 @@
       depfile = dep.GetProperty('FILE')
       if depfile:
         includes.add(depfile)
-    includes = [GetOutFileName(
+    includes = [GetHeaderFromNode(
         include, relpath=gpath).replace(os.sep, '/') for include in includes]
     includes.append('ppapi/c/pp_macros.h')
 
@@ -168,19 +206,26 @@
       includes.append('ppapi/c/pp_stdint.h')
 
     includes = sorted(set(includes))
-    cur_include = GetOutFileName(filenode, relpath=gpath).replace(os.sep, '/')
+    cur_include = GetHeaderFromNode(filenode,
+                                    relpath=gpath).replace(os.sep, '/')
     for include in includes:
       if include == cur_include: continue
       out.Write('#include "%s"\n' % include)
 
-    # If we are generating a single release, then create a macro for the highest
-    # available release number.
+    # Generate Prototypes
+    if proto.struct_map:
+      out.Write('\n/* Struct prototypes */\n')
+      for struct in proto.struct_map:
+        out.Write('struct %s;\n' % struct)
+
+    # Create a macro for the highest available release number.
     if filenode.GetProperty('NAME').endswith('pp_macros.idl'):
-      releasestr = GetOption('release')
+      releasestr = ' '.join(releases)
       if releasestr:
-        release_numbers = re.findall('\d+', releasestr)
-        if release_numbers:
-          out.Write('\n#define PPAPI_RELEASE %s\n' % release_numbers[0])
+        release_numbers = re.findall('[\d\_]+', releasestr)
+        release = re.findall('\d+', release_numbers[-1])[0]
+        if release:
+          out.Write('\n#define PPAPI_RELEASE %s\n' % release)
 
     # Generate all interface defines
     out.Write('\n')
@@ -210,14 +255,14 @@
   def GenerateTail(self, out, filenode, releases, options):
     __pychecker__ = 'unusednames=options,releases'
     gpath = GetOption('guard')
-    def_guard = GetOutFileName(filenode, relpath=gpath)
+    def_guard = GetPathFromNode(filenode, relpath=gpath, ext='.h')
     def_guard = def_guard.replace(os.sep,'_').replace('.','_').upper() + '_'
     out.Write('#endif  /* %s */\n\n' % def_guard)
 
 
 hgen = HGen()
 
-def Main(args):
+def main(args):
   # Default invocation will verify the golden files are unchanged.
   failed = 0
   if not args:
@@ -250,5 +295,5 @@
   return failed
 
 if __name__ == '__main__':
-  sys.exit(Main(sys.argv[1:]))
+  sys.exit(main(sys.argv[1:]))
 
diff --git a/ppapi/generators/idl_c_proto.py b/ppapi/generators/idl_c_proto.py
index c522bab..7965630 100755
--- a/ppapi/generators/idl_c_proto.py
+++ b/ppapi/generators/idl_c_proto.py
@@ -79,7 +79,8 @@
       'inout': '%s',
       'out': '%s*',
       'store': '%s',
-      'return': '%s'
+      'return': '%s',
+      'ref': '%s*'
     },
     'Callspec': {
       'in': '%s',
@@ -107,7 +108,8 @@
       'inout': '%s*',
       'out': '%s*',
       'return': ' %s*',
-      'store': '%s'
+      'store': '%s',
+      'ref': '%s*'
     },
     'blob_t': {
       'in': 'const %s',
@@ -396,9 +398,15 @@
 
 
   def Compose(self, rtype, name, arrayspec, callspec, prefix, func_as_ptr,
-              ptr_prefix, include_name):
+              ptr_prefix, include_name, unsized_as_ptr):
     self.LogEnter('Compose: %s %s' % (rtype, name))
     arrayspec = ''.join(arrayspec)
+
+    # Switch unsized array to a ptr. NOTE: Only last element can be unsized.
+    if unsized_as_ptr and arrayspec[-2:] == '[]':
+      prefix +=  '*'
+      arrayspec=arrayspec[:-2]
+
     if not include_name:
       name = prefix + arrayspec
     else:
@@ -409,9 +417,12 @@
       params = []
       for ptype, pname, parray, pspec in callspec:
         params.append(self.Compose(ptype, pname, parray, pspec, '', True,
-                                   ptr_prefix='', include_name=True))
+                                   ptr_prefix='', include_name=True,
+                                   unsized_as_ptr=unsized_as_ptr))
       if func_as_ptr:
         name = '(%s*%s)' % (ptr_prefix, name)
+      if not params:
+        params = ['void']
       out = '%s %s(%s)' % (rtype, name, ', '.join(params))
     self.LogExit('Exit Compose: %s' % out)
     return out
@@ -426,14 +437,22 @@
   #  include_name - If true, include member name in the signature.
   #                 If false, leave it out. In any case, prefix and ptr_prefix
   #                 are always included.
+  #  include_version - if True, include version in the member name
   #
   def GetSignature(self, node, release, mode, prefix='', func_as_ptr=True,
-                   ptr_prefix='', include_name=True):
+                   ptr_prefix='', include_name=True, include_version=False):
     self.LogEnter('GetSignature %s %s as func=%s' %
                   (node, mode, func_as_ptr))
     rtype, name, arrayspec, callspec = self.GetComponents(node, release, mode)
+    if include_version:
+      name = self.GetStructName(node, release, True)
+
+    # If not a callspec (such as a struct) use a ptr instead of []
+    unsized_as_ptr = not callspec
+
     out = self.Compose(rtype, name, arrayspec, callspec, prefix,
-                       func_as_ptr, ptr_prefix, include_name)
+                       func_as_ptr, ptr_prefix, include_name, unsized_as_ptr)
+
     self.LogExit('Exit GetSignature: %s' % out)
     return out
 
@@ -444,7 +463,7 @@
 
     # TODO(noelallen) : Bug 157017 finish multiversion support
     if len(build_list) != 1:
-      node.Error('Can not support multiple versions of node.')
+      node.Error('Can not support multiple versions of node: %s' % build_list)
     assert len(build_list) == 1
 
     out = 'typedef %s;\n' % self.GetSignature(node, build_list[0], 'return',
@@ -487,7 +506,10 @@
     __pychecker__ = 'unusednames=prefix,comment'
     release = releases[0]
     self.LogEnter('DefineMember %s' % node)
-    out = '%s;' % self.GetSignature(node, release, 'store', '', True)
+    if node.GetProperty('ref'):
+      out = '%s;' % self.GetSignature(node, release, 'ref', '', True)
+    else:
+      out = '%s;' % self.GetSignature(node, release, 'store', '', True)
     self.LogExit('Exit DefineMember')
     return out
 
@@ -562,9 +584,49 @@
   #
   # Generate a comment or copyright block
   #
-  def Copyright(self, node, tabs=0):
+  def Copyright(self, node, cpp_style=False):
     lines = node.GetName().split('\n')
-    return CommentLines(lines, tabs)
+    if cpp_style:
+      return '//' + '\n//'.join(filter(lambda f: f != '', lines)) + '\n'
+    return CommentLines(lines)
+
+
+  def Indent(self, data, tabs=0):
+    """Handles indentation and 80-column line wrapping."""
+    tab = '  ' * tabs
+    lines = []
+    for line in data.split('\n'):
+      # Add indentation
+      line = tab + line
+      if len(line) <= 80:
+        lines.append(line.rstrip())
+      else:
+        left = line.rfind('(') + 1
+        args = line[left:].split(',')
+        orig_args = args
+        orig_left = left
+        # Try to split on '(arg1)' or '(arg1, arg2)', not '()'
+        while args[0][0] == ')':
+          left = line.rfind('(', 0, left - 1) + 1
+          if left == 0:  # No more parens, take the original option
+            args = orig_args
+            left = orig_left
+            break
+          args = line[left:].split(',')
+
+        line_max = 0
+        for arg in args:
+          if len(arg) > line_max: line_max = len(arg)
+
+        if left + line_max >= 80:
+          indent = '%s    ' % tab
+          args =  (',\n%s' % indent).join([arg.strip() for arg in args])
+          lines.append('%s\n%s%s' % (line[:left], indent, args))
+        else:
+          indent = ' ' * (left - 1)
+          args =  (',\n%s' % indent).join(args)
+          lines.append('%s%s' % (line[:left], args))
+    return '\n'.join(lines)
 
 
   # Define a top level object.
@@ -596,30 +658,10 @@
       out += comment_txt
     out += define_txt
 
-    tab = '  ' * tabs
-    lines = []
-    for line in out.split('\n'):
-      # Add indentation
-      line = tab + line
-      if len(line) > 80:
-        left = line.rfind('(') + 1
-        args = line[left:].split(',')
-        line_max = 0
-        for arg in args:
-          if len(arg) > line_max: line_max = len(arg)
-
-        if left + line_max >= 80:
-          space = '%s    ' % tab
-          args =  (',\n%s' % space).join([arg.strip() for arg in args])
-          lines.append('%s\n%s%s' % (line[:left], space, args))
-        else:
-          space = ' ' * (left - 1)
-          args =  (',\n%s' % space).join(args)
-          lines.append('%s%s' % (line[:left], args))
-      else:
-        lines.append(line.rstrip())
+    indented_out = self.Indent(out, tabs)
     self.LogExit('Exit Define')
-    return '\n'.join(lines)
+    return indented_out
+
 
 # Clean a string representing an object definition and return then string
 # as a single space delimited set of tokens.
@@ -646,7 +688,8 @@
     outstr = CleanString(outstr)
 
     if instr != outstr:
-      ErrOut.Log('Failed match of\n>>%s<<\n>>%s<<\nto:' % (instr, outstr))
+      ErrOut.Log('Failed match of\n>>%s<<\nto:\n>>%s<<\nFor:\n' %
+                 (instr, outstr))
       node.Dump(1, comments=True)
       errors += 1
   return errors
@@ -676,7 +719,7 @@
     InfoOut.Log('Passed generator test.')
   return total_errs
 
-def Main(args):
+def main(args):
   filenames = ParseOptions(args)
   if GetOption('test'):
     return TestFiles(filenames)
@@ -691,5 +734,5 @@
 
 
 if __name__ == '__main__':
-  sys.exit(Main(sys.argv[1:]))
+  sys.exit(main(sys.argv[1:]))
 
diff --git a/ppapi/generators/idl_gen_wrapper.py b/ppapi/generators/idl_gen_wrapper.py
index ca5587d..5dcafbf 100644
--- a/ppapi/generators/idl_gen_wrapper.py
+++ b/ppapi/generators/idl_gen_wrapper.py
@@ -86,15 +86,15 @@
     return 'ppapi/c/' + name
 
 
-  def WriteCopyrightGeneratedTime(self, out):
+  def WriteCopyright(self, out):
     now = datetime.now()
     c = """/* Copyright (c) %s 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.
  */
 
-/* Last generated from IDL: %s. */
-""" % (now.year, datetime.ctime(now))
+/* NOTE: this is auto-generated from IDL */
+""" % now.year
     out.Write(c)
 
   def GetWrapperMetadataName(self):
@@ -106,8 +106,14 @@
     """
     out.Write("""/* Use local strcmp to avoid dependency on libc. */
 static int mystrcmp(const char* s1, const char *s2) {
-  while((*s1 && *s2) && (*s1++ == *s2++));
-  return *(--s1) - *(--s2);
+  while (1) {
+    if (*s1 == 0) break;
+    if (*s2 == 0) break;
+    if (*s1 != *s2) break;
+    ++s1;
+    ++s2;
+  }
+  return (int)(*s1) - (int)(*s2);
 }\n
 """)
 
@@ -247,7 +253,7 @@
   def GenerateIncludes(self, iface_releases, out):
     """Generate the list of #include that define the original interfaces.
     """
-    self.WriteCopyrightGeneratedTime(out)
+    self.WriteCopyright(out)
     # First include own header.
     out.Write('#include "%s"\n\n' % self.OwnHeaderFile())
 
@@ -459,4 +465,3 @@
     out.Write(self.GetGuardEnd())
     out.Close()
     return 0
-
diff --git a/ppapi/generators/idl_generator.py b/ppapi/generators/idl_generator.py
index 218b6b4..028a233 100755
--- a/ppapi/generators/idl_generator.py
+++ b/ppapi/generators/idl_generator.py
@@ -11,6 +11,7 @@
 
 GeneratorList = []
 
+Option('out', 'List of output files', default='')
 Option('release', 'Which release to generate.', default='')
 Option('range', 'Which ranges in the form of MIN,MAX.', default='start,end')
 
@@ -106,7 +107,7 @@
       if releasestr == 'end':
         releasestr = ast.releases[-1]
 
-      if releasestr > ast.releases[0]:
+      if releasestr > ast.releases[-1]:
         InfoOut.Log('There is no unique release for %s, using last release.' %
                     releasestr)
         releasestr = ast.releases[-1]
diff --git a/ppapi/generators/idl_lexer.py b/ppapi/generators/idl_lexer.py
index d45a4b8..4120ac7 100755
--- a/ppapi/generators/idl_lexer.py
+++ b/ppapi/generators/idl_lexer.py
@@ -64,7 +64,6 @@
     # Invented for apps use
       'NAMESPACE',
 
-
     # Data types
       'FLOAT',
       'OCT',
@@ -144,10 +143,15 @@
 
   # A symbol or keyword.
   def t_KEYWORD_SYMBOL(self, t):
-    r'[A-Za-z][A-Za-z_0-9]*'
+    r'_?[A-Za-z][A-Za-z_0-9]*'
 
-    #All non-keywords are assumed to be symbols
+    # All non-keywords are assumed to be symbols
     t.type = self.keywords.get(t.value, 'SYMBOL')
+
+    # We strip leading underscores so that you can specify symbols with the same
+    # value as a keywords (E.g. a dictionary named 'interface').
+    if t.value[0] == '_':
+      t.value = t.value[1:]
     return t
 
   def t_ANY_error(self, t):
diff --git a/ppapi/generators/idl_log.py b/ppapi/generators/idl_log.py
index 679c7d8..b7f2151 100644
--- a/ppapi/generators/idl_log.py
+++ b/ppapi/generators/idl_log.py
@@ -12,6 +12,7 @@
 #
 import sys
 
+
 class IDLLog(object):
   def __init__(self, name, out):
     if name:
diff --git a/ppapi/generators/idl_node.py b/ppapi/generators/idl_node.py
index 88d9445..ec40ffe 100755
--- a/ppapi/generators/idl_node.py
+++ b/ppapi/generators/idl_node.py
@@ -322,7 +322,8 @@
     return self.releases
 
 
-  def _GetReleaseList(self, releases, visited=set()):
+  def _GetReleaseList(self, releases, visited=None):
+    visited = visited or set()
     if not self.releases:
       # If we are unversionable, then return first available release
       if self.IsA('Comment', 'Copyright', 'Label'):
@@ -344,14 +345,18 @@
 
       visited |= set([self])
 
-      # Files inherit all thier releases from items in the file
+      # Files inherit all their releases from items in the file
       if self.IsA('AST', 'File'):
         my_releases = set()
 
       # Visit all children
       child_releases = set()
+
+      # Exclude sibling results from parent visited set
+      cur_visits = visited
+
       for child in self.children:
-        child_releases |= set(child._GetReleaseList(releases, visited))
+        child_releases |= set(child._GetReleaseList(releases, cur_visits))
         visited |= set(child_releases)
 
       # Visit my type
@@ -359,8 +364,7 @@
       if self.typelist:
         type_list = self.typelist.GetReleases()
         for typenode in type_list:
-          type_releases |= set(typenode._GetReleaseList(releases, visited))
-          visited |= set(type_releases)
+          type_releases |= set(typenode._GetReleaseList(releases, cur_visits))
 
         type_release_list = sorted(type_releases)
         if my_min < type_release_list[0]:
@@ -368,12 +372,11 @@
           self.Error('requires %s in %s which is undefined at %s.' % (
               type_node, type_node.filename, my_min))
 
-      for rel in child_releases:
+      for rel in child_releases | type_releases:
         if rel >= my_min and rel <= my_max:
           my_releases |= set([rel])
 
       self.releases = sorted(my_releases)
-
     return self.releases
 
   def GetReleaseList(self):
diff --git a/ppapi/generators/idl_outfile.py b/ppapi/generators/idl_outfile.py
index aa0b5aa..bb9b849 100755
--- a/ppapi/generators/idl_outfile.py
+++ b/ppapi/generators/idl_outfile.py
@@ -16,7 +16,7 @@
 
 Option('diff', 'Generate a DIFF when saving the file.')
 
-def IsEquivelent(intext, outtext):
+def IsEquivalent(intext, outtext):
   if not intext: return False
   inlines = intext.split('\n')
   outlines = outtext.split('\n')
@@ -35,7 +35,8 @@
     outwords = outline.split()
 
     if not inwords or not outwords: return False
-    if inwords[0] != outwords[0] or inwords[0] not in ('/*', '*'): return False
+    if inwords[0] != outwords[0] or inwords[0] not in ('/*', '*', '//'):
+      return False
 
     # Neither the year, nor the modified date need an exact match
     if inwords[1] == 'Copyright':
@@ -85,7 +86,7 @@
       else:
         intext = ''
 
-      if IsEquivelent(intext, outtext):
+      if IsEquivalent(intext, outtext):
         if GetOption('verbose'):
           InfoOut.Log('Output %s unchanged.' % self.filename)
         return False
diff --git a/ppapi/generators/idl_parser.py b/ppapi/generators/idl_parser.py
index 161845d..95b0ddb 100755
--- a/ppapi/generators/idl_parser.py
+++ b/ppapi/generators/idl_parser.py
@@ -1130,22 +1130,15 @@
   if node.IsA('Interface', 'Struct'):
     comment_list = []
     comment = node.GetOneOf('Comment')
-    if comment:
-      print comment.GetName()
     if comment and comment.GetName()[:4] == 'REL:':
       comment_list = comment.GetName()[5:].strip().split(' ')
-      print comment_list
 
-    if len(comment_list) != len(releases):
-      node.Error("Mismatch size of releases: %s vs %s." % (
-          comment_list, releases))
+    first_list = [node.first_release[rel] for rel in releases]
+    first_list = sorted(set(first_list))
+    if first_list != comment_list:
+      node.Error("Mismatch in releases: %s vs %s." % (
+          comment_list, first_list))
       err_cnt += 1
-    else:
-      first_list = [node.first_release[rel] for rel in releases]
-      if first_list != comment_list:
-        node.Error("Mismatch in releases: %s vs %s." % (
-            comment_list, first_list))
-        err_cnt += 1
 
   for child in node.GetChildren():
     err_cnt += FindVersionError(releases, child)
@@ -1177,7 +1170,8 @@
   return errs
 
 
-default_dirs = ['.', 'trusted', 'dev', 'private']
+default_dirs = ['.', 'trusted', 'dev', 'private', 'extensions',
+                'extensions/dev']
 def ParseFiles(filenames):
   parser = IDLParser()
   filenodes = []
diff --git a/ppapi/generators/idl_tests.py b/ppapi/generators/idl_tests.py
new file mode 100755
index 0000000..cfc9fe8
--- /dev/null
+++ b/ppapi/generators/idl_tests.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+# 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.
+
+""" Test runner for IDL Generator changes """
+
+import subprocess
+import sys
+
+def TestIDL(testname, args):
+  print '\nRunning unit tests for %s.' % testname
+  try:
+    args = [sys.executable, testname] + args
+    subprocess.check_call(args)
+    return 0
+  except subprocess.CalledProcessError as err:
+    print 'Failed with %s.' % str(err)
+    return 1
+
+def main(args):
+  errors = 0
+  errors += TestIDL('idl_lexer.py', ['--test'])
+  assert errors == 0
+  errors += TestIDL('idl_parser.py', ['--test'])
+  assert errors == 0
+  errors += TestIDL('idl_c_header.py', [])
+  assert errors == 0
+  errors += TestIDL('idl_c_proto.py', ['--wnone', '--test'])
+  assert errors == 0
+  errors += TestIDL('idl_gen_pnacl.py', ['--wnone', '--test'])
+  assert errors == 0
+
+  if errors:
+    print '\nFailed tests.'
+  return errors
+
+
+if __name__ == '__main__':
+  sys.exit(main(sys.argv[1:]))
+
diff --git a/ppapi/generators/idl_thunk.py b/ppapi/generators/idl_thunk.py
new file mode 100755
index 0000000..3358f18
--- /dev/null
+++ b/ppapi/generators/idl_thunk.py
@@ -0,0 +1,492 @@
+#!/usr/bin/env python
+# 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.
+
+""" Generator for C++ style thunks """
+
+import glob
+import os
+import re
+import sys
+
+from idl_log import ErrOut, InfoOut, WarnOut
+from idl_node import IDLAttribute, IDLNode
+from idl_ast import IDLAst
+from idl_option import GetOption, Option, ParseOptions
+from idl_outfile import IDLOutFile
+from idl_parser import ParseFiles
+from idl_c_proto import CGen, GetNodeComments, CommentLines, Comment
+from idl_generator import Generator, GeneratorByFile
+
+Option('thunkroot', 'Base directory of output',
+       default=os.path.join('..', 'thunk'))
+
+
+class TGenError(Exception):
+  def __init__(self, msg):
+    self.value = msg
+
+  def __str__(self):
+    return repr(self.value)
+
+
+class ThunkBodyMetadata(object):
+  """Metadata about thunk body. Used for selecting which headers to emit."""
+  def __init__(self):
+    self._apis = set()
+    self._includes = set()
+
+  def AddApi(self, api):
+    self._apis.add(api)
+
+  def Apis(self):
+    return self._apis
+
+  def AddInclude(self, include):
+    self._includes.add(include)
+
+  def Includes(self):
+    return self._includes
+
+
+def _GetBaseFileName(filenode):
+  """Returns the base name for output files, given the filenode.
+
+  Examples:
+    'dev/ppb_find_dev.h' -> 'ppb_find_dev'
+    'trusted/ppb_buffer_trusted.h' -> 'ppb_buffer_trusted'
+  """
+  path, name = os.path.split(filenode.GetProperty('NAME'))
+  name = os.path.splitext(name)[0]
+  return name
+
+
+def _GetHeaderFileName(filenode):
+  """Returns the name for the header for this file."""
+  path, name = os.path.split(filenode.GetProperty('NAME'))
+  name = os.path.splitext(name)[0]
+  if path:
+    header = "ppapi/c/%s/%s.h" % (path, name)
+  else:
+    header = "ppapi/c/%s.h" % name
+  return header
+
+
+def _GetThunkFileName(filenode, relpath):
+  """Returns the thunk file name."""
+  path = os.path.split(filenode.GetProperty('NAME'))[0]
+  name = _GetBaseFileName(filenode)
+  # We don't reattach the path for thunk.
+  if relpath: name = os.path.join(relpath, name)
+  name = '%s%s' % (name, '_thunk.cc')
+  return name
+
+
+def _MakeEnterLine(filenode, interface, arg, handle_errors, callback, meta):
+  """Returns an EnterInstance/EnterResource string for a function."""
+  if arg[0] == 'PP_Instance':
+    if callback is None:
+      return 'EnterInstance enter(%s);' % arg[1]
+    else:
+      return 'EnterInstance enter(%s, %s);' % (arg[1], callback)
+  elif arg[0] == 'PP_Resource':
+    api_name = interface.GetName()
+    if api_name.endswith('Trusted'):
+      api_name = api_name[:-len('Trusted')]
+    if api_name.endswith('_Dev'):
+      api_name = api_name[:-len('_Dev')]
+    api_name += '_API'
+
+    enter_type = 'EnterResource<%s>' % api_name
+    # The API header matches the file name, not the interface name.
+    api_basename = _GetBaseFileName(filenode)
+    if api_basename.endswith('_dev'):
+      # Clip off _dev suffix.
+      api_basename = api_basename[:-len('_dev')]
+    if api_basename.endswith('_trusted'):
+      # Clip off _trusted suffix.
+      api_basename = api_basename[:-len('_trusted')]
+    meta.AddApi(api_basename + '_api')
+
+    if callback is None:
+      return '%s enter(%s, %s);' % (enter_type, arg[1],
+                                    str(handle_errors).lower())
+    else:
+      return '%s enter(%s, %s, %s);' % (enter_type, arg[1],
+                                        callback,
+                                        str(handle_errors).lower())
+  else:
+    raise TGenError("Unknown type for _MakeEnterLine: %s" % arg[0])
+
+
+def _GetShortName(interface, filter_suffixes):
+  """Return a shorter interface name that matches Is* and Create* functions."""
+  parts = interface.GetName().split('_')[1:]
+  tail = parts[len(parts) - 1]
+  if tail in filter_suffixes:
+    parts = parts[:-1]
+  return ''.join(parts)
+
+
+def _IsTypeCheck(interface, node):
+  """Returns true if node represents a type-checking function."""
+  return node.GetName() == 'Is%s' % _GetShortName(interface, ['Dev', 'Private'])
+
+
+def _GetCreateFuncName(interface):
+  """Returns the creation function name for an interface."""
+  return 'Create%s' % _GetShortName(interface, ['Dev'])
+
+
+def _GetDefaultFailureValue(t):
+  """Returns the default failure value for a given type.
+
+  Returns None if no default failure value exists for the type.
+  """
+  values = {
+      'PP_Bool': 'PP_FALSE',
+      'PP_Resource': '0',
+      'struct PP_Var': 'PP_MakeUndefined()',
+      'float': '0.0f',
+      'int32_t': 'enter.retval()',
+      'uint16_t': '0',
+      'uint32_t': '0',
+      'uint64_t': '0',
+  }
+  if t in values:
+    return values[t]
+  return None
+
+
+def _MakeCreateMemberBody(interface, member, args):
+  """Returns the body of a Create() function.
+
+  Args:
+    interface - IDLNode for the interface
+    member - IDLNode for member function
+    args - List of arguments for the Create() function
+  """
+  if args[0][0] == 'PP_Resource':
+    body = 'Resource* object =\n'
+    body += '    PpapiGlobals::Get()->GetResourceTracker()->'
+    body += 'GetResource(%s);\n' % args[0][1]
+    body += 'if (!object)\n'
+    body += '  return 0;\n'
+    body += 'EnterResourceCreation enter(object->pp_instance());\n'
+  elif args[0][0] == 'PP_Instance':
+    body = 'EnterResourceCreation enter(%s);\n' % args[0][1]
+  else:
+    raise TGenError('Unknown arg type for Create(): %s' % args[0][0])
+
+  body += 'if (enter.failed())\n'
+  body += '  return 0;\n'
+  arg_list = ', '.join([a[1] for a in args])
+  if member.GetProperty('create_func'):
+    create_func = member.GetProperty('create_func')
+  else:
+    create_func = _GetCreateFuncName(interface)
+  body += 'return enter.functions()->%s(%s);' % (create_func,
+                                                 arg_list)
+  return body
+
+
+def _MakeNormalMemberBody(filenode, release, node, member, rtype, args,
+                          include_version, meta):
+  """Returns the body of a typical function.
+
+  Args:
+    filenode - IDLNode for the file
+    release - release to generate body for
+    node - IDLNode for the interface
+    member - IDLNode for the member function
+    rtype - Return type for the member function
+    args - List of 4-tuple arguments for the member function
+    include_version - whether to include the version in the invocation
+    meta - ThunkBodyMetadata for header hints
+  """
+  is_callback_func = args[len(args) - 1][0] == 'struct PP_CompletionCallback'
+
+  if is_callback_func:
+    call_args = args[:-1] + [('', 'enter.callback()', '', '')]
+    meta.AddInclude('ppapi/c/pp_completion_callback.h')
+  else:
+    call_args = args
+
+  if args[0][0] == 'PP_Instance':
+    call_arglist = ', '.join(a[1] for a in call_args)
+    function_container = 'functions'
+  else:
+    call_arglist = ', '.join(a[1] for a in call_args[1:])
+    function_container = 'object'
+
+  function_name = member.GetName()
+  if include_version:
+    version = node.GetVersion(release).replace('.', '_')
+    function_name += version
+
+  invocation = 'enter.%s()->%s(%s)' % (function_container,
+                                       function_name,
+                                       call_arglist)
+
+  handle_errors = not (member.GetProperty('report_errors') == 'False')
+  if is_callback_func:
+    body = '%s\n' % _MakeEnterLine(filenode, node, args[0], handle_errors,
+                                   args[len(args) - 1][1], meta)
+    body += 'if (enter.failed())\n'
+    value = member.GetProperty('on_failure')
+    if value is None:
+      value = 'enter.retval()'
+    body += '  return %s;\n' % value
+    body += 'return enter.SetResult(%s);' % invocation
+  elif rtype == 'void':
+    body = '%s\n' % _MakeEnterLine(filenode, node, args[0], handle_errors,
+                                   None, meta)
+    body += 'if (enter.succeeded())\n'
+    body += '  %s;' % invocation
+  else:
+    value = member.GetProperty('on_failure')
+    if value is None:
+      value = _GetDefaultFailureValue(rtype)
+    if value is None:
+      raise TGenError('No default value for rtype %s' % rtype)
+
+    body = '%s\n' % _MakeEnterLine(filenode, node, args[0], handle_errors,
+                                   None, meta)
+    body += 'if (enter.failed())\n'
+    body += '  return %s;\n' % value
+    body += 'return %s;' % invocation
+  return body
+
+
+def DefineMember(filenode, node, member, release, include_version, meta):
+  """Returns a definition for a member function of an interface.
+
+  Args:
+    filenode - IDLNode for the file
+    node - IDLNode for the interface
+    member - IDLNode for the member function
+    release - release to generate
+    include_version - include the version in emitted function name.
+    meta - ThunkMetadata for header hints
+  Returns:
+    A string with the member definition.
+  """
+  cgen = CGen()
+  rtype, name, arrays, args = cgen.GetComponents(member, release, 'return')
+
+  if _IsTypeCheck(node, member):
+    body = '%s\n' % _MakeEnterLine(filenode, node, args[0], False, None, meta)
+    body += 'return PP_FromBool(enter.succeeded());'
+  elif member.GetName() == 'Create':
+    body = _MakeCreateMemberBody(node, member, args)
+  else:
+    body = _MakeNormalMemberBody(filenode, release, node, member, rtype, args,
+                                 include_version, meta)
+
+  signature = cgen.GetSignature(member, release, 'return', func_as_ptr=False,
+                                include_version=include_version)
+  return '%s\n%s\n}' % (cgen.Indent('%s {' % signature, tabs=0),
+                        cgen.Indent(body, tabs=1))
+
+
+def _IsNewestMember(member, members, releases):
+  """Returns true if member is the newest node with its name in members.
+
+  Currently, every node in the AST only has one version. This means that we
+  will have two sibling nodes with the same name to represent different
+  versions.
+  See http://crbug.com/157017 .
+
+  Special handling is required for nodes which share their name with others,
+  but aren't the newest version in the IDL.
+
+  Args:
+    member - The member which is checked if it's newest
+    members - The list of members to inspect
+    releases - The set of releases to check for versions in.
+  """
+  build_list = member.GetUniqueReleases(releases)
+  release = build_list[0]  # Pick the oldest release.
+  same_name_siblings = filter(
+      lambda n: str(n) == str(member) and n != member, members)
+
+  for s in same_name_siblings:
+    sibling_build_list = s.GetUniqueReleases(releases)
+    sibling_release = sibling_build_list[0]
+    if sibling_release > release:
+      return False
+  return True
+
+
+class TGen(GeneratorByFile):
+  def __init__(self):
+    Generator.__init__(self, 'Thunk', 'tgen', 'Generate the C++ thunk.')
+
+  def GenerateFile(self, filenode, releases, options):
+    savename = _GetThunkFileName(filenode, GetOption('thunkroot'))
+    my_min, my_max = filenode.GetMinMax(releases)
+    if my_min > releases[-1] or my_max < releases[0]:
+      if os.path.isfile(savename):
+        print "Removing stale %s for this range." % filenode.GetName()
+        os.remove(os.path.realpath(savename))
+      return False
+    do_generate = filenode.GetProperty('generate_thunk')
+    if not do_generate:
+      return False
+
+    thunk_out = IDLOutFile(savename)
+    body, meta = self.GenerateBody(thunk_out, filenode, releases, options)
+    self.WriteHead(thunk_out, filenode, releases, options, meta)
+    thunk_out.Write('\n\n'.join(body))
+    self.WriteTail(thunk_out, filenode, releases, options)
+    return thunk_out.Close()
+
+  def WriteHead(self, out, filenode, releases, options, meta):
+    __pychecker__ = 'unusednames=options'
+    cgen = CGen()
+
+    cright_node = filenode.GetChildren()[0]
+    assert(cright_node.IsA('Copyright'))
+    out.Write('%s\n' % cgen.Copyright(cright_node, cpp_style=True))
+
+    # Wrap the From ... modified ... comment if it would be >80 characters.
+    from_text = 'From %s' % (
+        filenode.GetProperty('NAME').replace(os.sep,'/'))
+    modified_text = 'modified %s.' % (
+        filenode.GetProperty('DATETIME'))
+    if len(from_text) + len(modified_text) < 74:
+      out.Write('// %s %s\n\n' % (from_text, modified_text))
+    else:
+      out.Write('// %s,\n//   %s\n\n' % (from_text, modified_text))
+
+
+    # TODO(teravest): Don't emit includes we don't need.
+    includes = ['ppapi/c/pp_errors.h',
+                'ppapi/shared_impl/tracked_callback.h',
+                'ppapi/thunk/enter.h',
+                'ppapi/thunk/ppb_instance_api.h',
+                'ppapi/thunk/resource_creation_api.h',
+                'ppapi/thunk/thunk.h']
+    includes.append(_GetHeaderFileName(filenode))
+    for api in meta.Apis():
+      includes.append('ppapi/thunk/%s.h' % api.lower())
+    for i in meta.Includes():
+      includes.append(i)
+    for include in sorted(includes):
+      out.Write('#include "%s"\n' % include)
+    out.Write('\n')
+    out.Write('namespace ppapi {\n')
+    out.Write('namespace thunk {\n')
+    out.Write('\n')
+    out.Write('namespace {\n')
+    out.Write('\n')
+
+  def GenerateBody(self, out, filenode, releases, options):
+    """Generates a member function lines to be written and metadata.
+
+    Returns a tuple of (body, meta) where:
+      body - a list of lines with member function bodies
+      meta - a ThunkMetadata instance for hinting which headers are needed.
+    """
+    __pychecker__ = 'unusednames=options'
+    out_members = []
+    meta = ThunkBodyMetadata()
+    for node in filenode.GetListOf('Interface'):
+      # Skip if this node is not in this release
+      if not node.InReleases(releases):
+        print "Skipping %s" % node
+        continue
+
+      # Generate Member functions
+      if node.IsA('Interface'):
+        members = node.GetListOf('Member')
+        for child in members:
+          build_list = child.GetUniqueReleases(releases)
+          # We have to filter out releases this node isn't in.
+          build_list = filter(lambda r: child.InReleases([r]), build_list)
+          if len(build_list) == 0:
+            continue
+          assert(len(build_list) == 1)
+          release = build_list[-1]
+          include_version = not _IsNewestMember(child, members, releases)
+          member = DefineMember(filenode, node, child, release, include_version,
+                                meta)
+          if not member:
+            continue
+          out_members.append(member)
+    return (out_members, meta)
+
+  def WriteTail(self, out, filenode, releases, options):
+    __pychecker__ = 'unusednames=options'
+    cgen = CGen()
+
+    version_list = []
+    out.Write('\n\n')
+    for node in filenode.GetListOf('Interface'):
+      build_list = node.GetUniqueReleases(releases)
+      for build in build_list:
+        version = node.GetVersion(build).replace('.', '_')
+        thunk_name = 'g_' + node.GetName().lower() + '_thunk_' + \
+                      version
+        thunk_type = '_'.join((node.GetName(), version))
+        version_list.append((thunk_type, thunk_name))
+
+        declare_line = 'const %s %s = {' % (thunk_type, thunk_name)
+        if len(declare_line) > 80:
+          declare_line = 'const %s\n    %s = {' % (thunk_type, thunk_name)
+        out.Write('%s\n' % declare_line)
+        generated_functions = []
+        members = node.GetListOf('Member')
+        for child in members:
+          rtype, name, arrays, args = cgen.GetComponents(
+              child, build, 'return')
+          if not _IsNewestMember(child, members, releases):
+            version = node.GetVersion(build).replace('.', '_')
+            name += '_' + version
+          if child.InReleases([build]):
+            generated_functions.append(name)
+        out.Write(',\n'.join(['  &%s' % f for f in generated_functions]))
+        out.Write('\n};\n\n')
+
+    out.Write('}  // namespace\n')
+    out.Write('\n')
+    for thunk_type, thunk_name in version_list:
+      thunk_decl = 'const %s* Get%s_Thunk() {\n' % (thunk_type, thunk_type)
+      if len(thunk_decl) > 80:
+        thunk_decl = 'const %s*\n    Get%s_Thunk() {\n' % (thunk_type,
+                                                           thunk_type)
+      out.Write(thunk_decl)
+      out.Write('  return &%s;\n' % thunk_name)
+      out.Write('}\n')
+      out.Write('\n')
+    out.Write('}  // namespace thunk\n')
+    out.Write('}  // namespace ppapi\n')
+
+
+tgen = TGen()
+
+
+def Main(args):
+  # Default invocation will verify the golden files are unchanged.
+  failed = 0
+  if not args:
+    args = ['--wnone', '--diff', '--test', '--thunkroot=.']
+
+  ParseOptions(args)
+
+  idldir = os.path.split(sys.argv[0])[0]
+  idldir = os.path.join(idldir, 'test_thunk', '*.idl')
+  filenames = glob.glob(idldir)
+  ast = ParseFiles(filenames)
+  if tgen.GenerateRange(ast, ['M13', 'M14'], {}):
+    print "Golden file for M13-M14 failed."
+    failed = 1
+  else:
+    print "Golden file for M13-M14 passed."
+
+  return failed
+
+
+if __name__ == '__main__':
+  sys.exit(Main(sys.argv[1:]))
diff --git a/ppapi/generators/test_cgen/enum_typedef.h b/ppapi/generators/test_cgen/enum_typedef.h
index b7ef0c1..6eb1a0c 100644
--- a/ppapi/generators/test_cgen/enum_typedef.h
+++ b/ppapi/generators/test_cgen/enum_typedef.h
@@ -4,7 +4,7 @@
  * found in the LICENSE file.
  */
 
-/* From test_cgen/enum_typedef.idl modified Mon Aug 22 15:15:49 2011. */
+/* From test_cgen/enum_typedef.idl modified Wed Dec  5 13:08:05 2012. */
 
 #ifndef PPAPI_C_TEST_CGEN_ENUM_TYPEDEF_H_
 #define PPAPI_C_TEST_CGEN_ENUM_TYPEDEF_H_
@@ -41,11 +41,11 @@
 /* typedef int32_t i; */
 typedef int32_t i;
 
-/* typedef int32_t i2[2]; */
-typedef int32_t i2[2];
+/* typedef int32_t i2[3]; */
+typedef int32_t i2[3];
 
-/* typedef int32_t (*i_func)(); */
-typedef int32_t (*i_func)();
+/* typedef int32_t (*i_func)(void); */
+typedef int32_t (*i_func)(void);
 
 /* typedef int32_t (*i_func_i)(int32_t i); */
 typedef int32_t (*i_func_i)(int32_t i);
diff --git a/ppapi/generators/test_cgen/enum_typedef.idl b/ppapi/generators/test_cgen/enum_typedef.idl
index 2454104..60d0a67 100644
--- a/ppapi/generators/test_cgen/enum_typedef.idl
+++ b/ppapi/generators/test_cgen/enum_typedef.idl
@@ -14,10 +14,10 @@
 /* typedef int32_t i; */
 typedef int32_t i;
 
-/* typedef int32_t i2[2]; */
-typedef int32_t[2] i2;
+/* typedef int32_t i2[3]; */
+typedef int32_t[3] i2;
 
-/* typedef int32_t (*i_func)(); */
+/* typedef int32_t (*i_func)(void); */
 typedef int32_t i_func();
 
 /* typedef int32_t (*i_func_i)(int32_t i); */
diff --git a/ppapi/generators/test_cgen/interface.h b/ppapi/generators/test_cgen/interface.h
index 6a187e4..fccafcb 100644
--- a/ppapi/generators/test_cgen/interface.h
+++ b/ppapi/generators/test_cgen/interface.h
@@ -4,7 +4,7 @@
  * found in the LICENSE file.
  */
 
-/* From test_cgen/interface.idl modified Mon Aug 22 15:15:43 2011. */
+/* From test_cgen/interface.idl modified Wed Nov 21 14:22:50 2012. */
 
 #ifndef PPAPI_C_TEST_CGEN_INTERFACE_H_
 #define PPAPI_C_TEST_CGEN_INTERFACE_H_
@@ -12,6 +12,11 @@
 #include "ppapi/c/pp_macros.h"
 #include "ppapi/c/test_cgen/stdint.h"
 
+#define IFACEFOO_INTERFACE_1_0 "ifaceFoo;1.0"
+#define IFACEFOO_INTERFACE IFACEFOO_INTERFACE_1_0
+
+#define IFACEBAR_INTERFACE_1_0 "ifaceBar;1.0"
+#define IFACEBAR_INTERFACE IFACEBAR_INTERFACE_1_0
 
 /**
  * @file
@@ -36,16 +41,41 @@
  * @{
  */
 /*
- * struct iface1 {
+ * struct ifaceFoo_1_0 {
  * int8_t (*mem1)(int16_t x, int32_t y);
  * int32_t (*mem2)(const struct ist* a);
  * int32_t (*mem3)(struct ist* b);
+ * int32_t (*mem4)(const void** ptr);
+ * int32_t (*mem5)(void** ptr);
  * };
+ * typedef struct ifaceFoo_1_0 ifaceFoo;
  */
-struct iface1 {
+struct ifaceFoo_1_0 {
   int8_t (*mem1)(int16_t x, int32_t y);
   int32_t (*mem2)(const struct ist* a);
   int32_t (*mem3)(struct ist* b);
+  int32_t (*mem4)(const void** ptr);
+  int32_t (*mem5)(void** ptr);
+};
+
+typedef struct ifaceFoo_1_0 ifaceFoo;
+
+struct ifaceBar_1_0 {
+  int8_t (*testIface)(const struct ifaceFoo_1_0* foo, int32_t y);
+  struct ifaceFoo_1_0* (*createIface)(const char* name);
+};
+
+typedef struct ifaceBar_1_0 ifaceBar;
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Structs
+ * @{
+ */
+struct struct2 {
+  struct ifaceBar_1_0* bar;
 };
 /**
  * @}
diff --git a/ppapi/generators/test_cgen/interface.idl b/ppapi/generators/test_cgen/interface.idl
index 22a4a03..d7ca86e 100644
--- a/ppapi/generators/test_cgen/interface.idl
+++ b/ppapi/generators/test_cgen/interface.idl
@@ -18,14 +18,14 @@
 };
 
 /*
- * struct iface1 {
+ * struct ifaceFoo_1_0 {
  * int8_t (*mem1)(int16_t x, int32_t y);
  * int32_t (*mem2)(const struct ist* a);
  * int32_t (*mem3)(struct ist* b);
  * int32_t (*mem4)(const void** ptr);
  * int32_t (*mem5)(void** ptr);
- * int32_t (*mem6)(void** ptr);
  * };
+ * typedef struct ifaceFoo_1_0 ifaceFoo;
  */
 interface ifaceFoo {
   int8_t mem1([in] int16_t x, [in] int32_t y);
diff --git a/ppapi/generators/test_cgen/structs.h b/ppapi/generators/test_cgen/structs.h
index bcc6b44..352e08e 100644
--- a/ppapi/generators/test_cgen/structs.h
+++ b/ppapi/generators/test_cgen/structs.h
@@ -4,7 +4,7 @@
  * found in the LICENSE file.
  */
 
-/* From test_cgen/structs.idl modified Mon Aug 22 15:15:38 2011. */
+/* From test_cgen/structs.idl modified Wed Nov 21 11:02:50 2012. */
 
 #ifndef PPAPI_C_TEST_CGEN_STRUCTS_H_
 #define PPAPI_C_TEST_CGEN_STRUCTS_H_
diff --git a/ppapi/generators/test_cgen/structs.idl b/ppapi/generators/test_cgen/structs.idl
index ecf7163..b91949c 100644
--- a/ppapi/generators/test_cgen/structs.idl
+++ b/ppapi/generators/test_cgen/structs.idl
@@ -8,6 +8,10 @@
  * This file will test that the IDL snippet matches the comment.
  */
 
+label Chrome {
+  M14=1.0
+};
+
 /* typedef uint8_t s_array[3]; */
 typedef uint8_t[3] s_array;
 
diff --git a/ppapi/generators/test_cgen_range/versions.h b/ppapi/generators/test_cgen_range/versions.h
index 92b5324..bb0f2b1 100644
--- a/ppapi/generators/test_cgen_range/versions.h
+++ b/ppapi/generators/test_cgen_range/versions.h
@@ -3,17 +3,17 @@
  * found in the LICENSE file.
  */
 
-/* From test_cgen_range/versions.idl modified Wed Aug 24 19:49:19 2011. */
+/* From test_cgen_range/versions.idl modified Wed Nov 21 15:18:23 2012. */
 
 #ifndef PPAPI_C_TEST_CGEN_RANGE_VERSIONS_H_
 #define PPAPI_C_TEST_CGEN_RANGE_VERSIONS_H_
 
 #include "ppapi/c/pp_macros.h"
 
-#define BAR_INTERFACE_0_0 "Bar;0.0"
-#define BAR_INTERFACE_1_0 "Bar;1.0"
-#define BAR_INTERFACE_2_0 "Bar;2.0"
-#define BAR_INTERFACE BAR_INTERFACE_2_0
+#define FOO_INTERFACE_0_0 "Foo;0.0"
+#define FOO_INTERFACE_1_0 "Foo;1.0"
+#define FOO_INTERFACE_2_0 "Foo;2.0"
+#define FOO_INTERFACE FOO_INTERFACE_2_0
 
 /**
  * @file
@@ -21,42 +21,25 @@
 
 
 /**
- * @addtogroup Structs
- * @{
- */
-/* Bogus Struct Foo */
-struct Foo {
-  /**
-   * Comment for function x,y,z
-   */
-  int32_t (*Foo)(int32_t x, int32_t y, int32_t z);
-};
-struct Foo_0_0 {
-  int32_t (*Foo)(int32_t x);
-};
-struct Foo_1_0 {
-  int32_t (*Foo)(int32_t x, int32_t y);
-};
-/**
- * @}
- */
-
-/**
  * @addtogroup Interfaces
  * @{
  */
-/* Inherit revisions thanks to Foo */
-struct Bar {
+/* Bogus Interface Foo */
+struct Foo_2_0 {
   /**
-   * Comment for function
+   * Comment for function x,y,z
    */
-  int32_t (*UseFoo)( struct Foo* val);
+  int32_t (*Bar)(int32_t x, int32_t y, int32_t z);
 };
-struct Bar_0_0 {
-  int32_t (*UseFoo)( struct Foo* val);
+
+typedef struct Foo_2_0 Foo;
+
+struct Foo_0_0 {
+  int32_t (*Bar)(int32_t x);
 };
-struct Bar_1_0 {
-  int32_t (*UseFoo)( struct Foo* val);
+
+struct Foo_1_0 {
+  int32_t (*Bar)(int32_t x, int32_t y);
 };
 /**
  * @}
diff --git a/ppapi/generators/test_cgen_range/versions.idl b/ppapi/generators/test_cgen_range/versions.idl
index 11b4de0..3dcc87e 100644
--- a/ppapi/generators/test_cgen_range/versions.idl
+++ b/ppapi/generators/test_cgen_range/versions.idl
@@ -15,30 +15,20 @@
   int32_t;
 };
 
-
-/* Bogus Struct Foo */
+/* Bogus Interface Foo */
 [version=0.0]
-struct Foo {
+interface Foo {
   /**
    * Comment for function x
    */
-  [version=0.0] int32_t Foo(int32_t x);
+  [version=0.0] int32_t Bar(int32_t x);
   /**
    * Comment for function x,y
    */
-  [version=1.0] int32_t Foo(int32_t x, int32_t y);
+  [version=1.0] int32_t Bar(int32_t x, int32_t y);
   /**
    * Comment for function x,y,z
    */
-  [version=2.0] int32_t Foo(int32_t x, int32_t y, int32_t z);
+  [version=2.0] int32_t Bar(int32_t x, int32_t y, int32_t z);
 };
 
-
-/* Inherit revisions thanks to Foo */
-[version=0.0]
-interface Bar {
-  /**
-   * Comment for function
-   */
-  int32_t UseFoo(Foo val);
-};
diff --git a/ppapi/generators/test_namespace/foo.idl b/ppapi/generators/test_namespace/foo.idl
index 3b04c79..a027b93 100644
--- a/ppapi/generators/test_namespace/foo.idl
+++ b/ppapi/generators/test_namespace/foo.idl
@@ -5,6 +5,10 @@
 
 /* File Comment */
 
+describe {
+  int32_t;
+};
+
 /* PPAPI Structure */
 struct PP_Size {
   /* This value represents the width of the rectangle. */
diff --git a/ppapi/generators/test_thunk/basic_test_types.idl b/ppapi/generators/test_thunk/basic_test_types.idl
new file mode 100644
index 0000000..0f42466
--- /dev/null
+++ b/ppapi/generators/test_thunk/basic_test_types.idl
@@ -0,0 +1,58 @@
+/* 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.
+ */
+
+/**
+ * This file defines some basic types for use in testing.
+ */
+
+label Chrome {
+  M13 = 0.0,
+  M14 = 1.0,
+  M15 = 2.0
+};
+
+[version=0.0]
+describe {
+  /** Standard Ints. */
+  int8_t;
+  int16_t;
+  int32_t;
+  int64_t;
+  uint8_t;
+  uint16_t;
+  uint32_t;
+  uint64_t;
+  /** Small and large floats. */
+  double_t;
+  float_t;
+
+  /** Native file handle (int). */
+  handle_t;
+
+  /** Interface object (void *). */
+  interface_t;
+
+  /** Used for padding, should be (u)int8_t */
+  char;
+
+  /** Pointer to memory (void *). */
+  mem_t;
+
+  /** Pointer to null terminated string (char *). */
+  str_t;
+
+  /** No return value. */
+  void;
+
+  /** Pointer to pointer to memory (void **). */
+  blob_t;
+
+  /** Pepper types */
+  PP_Bool;
+  PP_Instance;
+  PP_Resource;
+  PP_Var;
+};
+
diff --git a/ppapi/generators/test_thunk/simple.idl b/ppapi/generators/test_thunk/simple.idl
new file mode 100644
index 0000000..30beace
--- /dev/null
+++ b/ppapi/generators/test_thunk/simple.idl
@@ -0,0 +1,34 @@
+/* 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.
+ */
+
+[generate_thunk]
+
+/**
+ * This file defines the <code>PPB_Simple</code> interface.
+ */
+
+label Chrome {
+  M13 = 0.5,
+  M14 = 1.0
+};
+
+interface PPB_Simple {
+  PP_Resource Create([in] PP_Instance instance);
+
+  PP_Bool IsSimple([in] PP_Resource resource);
+
+  [deprecate=1.0]
+  void PostMessage([in] PP_Instance instance, [in] PP_Var message);
+
+  uint32_t DoUint32Instance([in] PP_Instance instance);
+
+  uint32_t DoUint32Resource([in] PP_Resource instance);
+
+  [report_errors=False]
+  uint32_t DoUint32ResourceNoErrors([in] PP_Resource instance);
+
+  [version=1.0, on_failure="12"]
+  int32_t OnFailure12([in] PP_Instance instance);
+};
diff --git a/ppapi/generators/test_thunk/simple_thunk.cc b/ppapi/generators/test_thunk/simple_thunk.cc
new file mode 100644
index 0000000..e6418f0
--- /dev/null
+++ b/ppapi/generators/test_thunk/simple_thunk.cc
@@ -0,0 +1,96 @@
+// 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.
+
+// From ../test_thunk/simple.idl modified Fri Nov 16 11:26:06 2012.
+
+#include "ppapi/c/../test_thunk/simple.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/simple_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+  EnterResourceCreation enter(instance);
+  if (enter.failed())
+    return 0;
+  return enter.functions()->CreateSimple(instance);
+}
+
+PP_Bool IsSimple(PP_Resource resource) {
+  EnterResource<PPB_Simple_API> enter(resource, false);
+  return PP_FromBool(enter.succeeded());
+}
+
+void PostMessage(PP_Instance instance, PP_Var message) {
+  EnterInstance enter(instance);
+  if (enter.succeeded())
+    enter.functions()->PostMessage(instance, message);
+}
+
+uint32_t DoUint32Instance(PP_Instance instance) {
+  EnterInstance enter(instance);
+  if (enter.failed())
+    return 0;
+  return enter.functions()->DoUint32Instance(instance);
+}
+
+uint32_t DoUint32Resource(PP_Resource instance) {
+  EnterResource<PPB_Simple_API> enter(instance, true);
+  if (enter.failed())
+    return 0;
+  return enter.object()->DoUint32Resource();
+}
+
+uint32_t DoUint32ResourceNoErrors(PP_Resource instance) {
+  EnterResource<PPB_Simple_API> enter(instance, false);
+  if (enter.failed())
+    return 0;
+  return enter.object()->DoUint32ResourceNoErrors();
+}
+
+int32_t OnFailure12(PP_Instance instance) {
+  EnterInstance enter(instance);
+  if (enter.failed())
+    return 12;
+  return enter.functions()->OnFailure12(instance);
+}
+
+const PPB_Simple_0_5 g_ppb_simple_thunk_0_5 = {
+  &Create,
+  &IsSimple,
+  &PostMessage,
+  &DoUint32Instance,
+  &DoUint32Resource,
+  &DoUint32ResourceNoErrors,
+};
+
+const PPB_Simple_1_0 g_ppb_simple_thunk_1_0 = {
+  &Create,
+  &IsSimple,
+  &DoUint32Instance,
+  &DoUint32Resource,
+  &DoUint32ResourceNoErrors,
+  &OnFailure12,
+};
+
+}  // namespace
+
+const PPB_Simple_0_5* GetPPB_Simple_0_5_Thunk() {
+  return &g_ppb_simple_thunk_0_5;
+}
+
+const PPB_Simple_1_0* GetPPB_Simple_1_0_Thunk() {
+  return &g_ppb_simple_thunk_1_0;
+}
+
+}  // namespace thunk
+}  // namespace ppapi
diff --git a/ppapi/generators/test_version/versions.idl b/ppapi/generators/test_version/versions.idl
new file mode 100644
index 0000000..ce39f2a
--- /dev/null
+++ b/ppapi/generators/test_version/versions.idl
@@ -0,0 +1,53 @@
+/* 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.
+ */
+
+/* File Comment. */
+
+label Chrome {
+  M13 = 0.0,
+  M14 = 1.0,
+  M15 = 2.0
+};
+
+describe {
+  int32_t;
+};
+
+/*REL: M13 M15 */
+[version=0.0]
+interface iFoo {
+  /**
+   * Comment for function x
+   */
+  [version=0.0] int32_t Bar([in] int32_t x);
+  /**
+   * Comment for function x,y,z
+   */
+  [version=2.0] int32_t Bar([in] int32_t x, [in] int32_t y, [in] int32_t z);
+};
+
+
+/*REL: M13 M15 */
+[version=0.0]
+struct iBar {
+  /**
+   * Comment for function x
+   */
+  [version=0.0] iFoo x;
+};
+
+/*REL: M13 M14 M15 */
+[version=0.0]
+struct iX {
+  /**
+   * Comment for function x
+   */
+  [version=0.0] iFoo x;
+  /**
+   * Comment for member y
+   */
+  [version=1.0] int32_t y;
+};
+
diff --git a/ppapi/host/host_message_context.h b/ppapi/host/host_message_context.h
index c9b3b3c..5a5486e 100644
--- a/ppapi/host/host_message_context.h
+++ b/ppapi/host/host_message_context.h
@@ -45,8 +45,9 @@
   // Returns a reply message context struct which includes the reply params.
   ReplyMessageContext MakeReplyMessageContext() const;
 
-  // The original call parameters passed to the resource message call.
-  const ppapi::proxy::ResourceMessageCallParams& params;
+  // The original call parameters passed to the resource message call. This
+  // cannot be a reference because this object may be passed to another thread.
+  ppapi::proxy::ResourceMessageCallParams params;
 
   // The reply message. If the params has the callback flag set, this message
   // will be sent in reply. It is initialized to the empty message. If the
diff --git a/ppapi/host/message_filter_host.cc b/ppapi/host/message_filter_host.cc
new file mode 100644
index 0000000..78ebd23
--- /dev/null
+++ b/ppapi/host/message_filter_host.cc
@@ -0,0 +1,26 @@
+// 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 "ppapi/host/message_filter_host.h"
+
+#include "ppapi/host/ppapi_host.h"
+#include "ppapi/host/resource_message_filter.h"
+
+namespace ppapi {
+namespace host {
+
+MessageFilterHost::MessageFilterHost(
+    PpapiHost* host,
+    PP_Instance instance,
+    PP_Resource resource,
+    const scoped_refptr<ResourceMessageFilter>& message_filter)
+    : ResourceHost(host, instance, resource) {
+  AddFilter(message_filter);
+}
+
+MessageFilterHost::~MessageFilterHost() {
+}
+
+}  // namespace host
+}  // namespace ppapi
\ No newline at end of file
diff --git a/ppapi/host/message_filter_host.h b/ppapi/host/message_filter_host.h
new file mode 100644
index 0000000..9aa1c5b
--- /dev/null
+++ b/ppapi/host/message_filter_host.h
@@ -0,0 +1,38 @@
+// 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 PPAPI_HOST_MESSAGE_FILTER_HOST_H_
+#define PPAPI_HOST_MESSAGE_FILTER_HOST_H_
+
+#include "base/compiler_specific.h"
+#include "base/memory/ref_counted.h"
+#include "ppapi/host/ppapi_host_export.h"
+#include "ppapi/host/resource_host.h"
+
+namespace ppapi {
+namespace host {
+
+class PpapiHost;
+class ResourceMessageFilter;
+
+// This class is a generic ResourceHost that is composed of a single
+// ResourceMessageFilter. There are cases where ResourceHosts only serve the
+// purpose of passing messages onto a message filter to be handled on another
+// thread. This class can be used as the host in those cases.
+class PPAPI_HOST_EXPORT MessageFilterHost : public ResourceHost {
+ public:
+  MessageFilterHost(PpapiHost* host,
+                    PP_Instance instance,
+                    PP_Resource resource,
+                    const scoped_refptr<ResourceMessageFilter>& message_filter);
+  virtual ~MessageFilterHost();
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(MessageFilterHost);
+};
+
+}  // namespace host
+}  // namespace ppapi
+
+#endif  // PPAPI_HOST_MESSAGE_FILTER_HOST_H_
diff --git a/ppapi/host/ppapi_host.cc b/ppapi/host/ppapi_host.cc
index 44d3ee5..87dfb11 100644
--- a/ppapi/host/ppapi_host.cc
+++ b/ppapi/host/ppapi_host.cc
@@ -28,7 +28,8 @@
 PpapiHost::PpapiHost(IPC::Sender* sender,
                      const PpapiPermissions& perms)
     : sender_(sender),
-      permissions_(perms) {
+      permissions_(perms),
+      next_pending_resource_host_id_(1) {
 }
 
 PpapiHost::~PpapiHost() {
@@ -36,6 +37,10 @@
   // technically alive in case one of the filters accesses us from the
   // destructor.
   instance_message_filters_.clear();
+
+  // The resources may also want to use us in their destructors.
+  resources_.clear();
+  pending_resource_hosts_.clear();
 }
 
 bool PpapiHost::Send(IPC::Message* msg) {
@@ -51,6 +56,8 @@
                                     OnHostMsgResourceSyncCall)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_ResourceCreated,
                         OnHostMsgResourceCreated)
+    IPC_MESSAGE_HANDLER(PpapiHostMsg_AttachToPendingHost,
+                        OnHostMsgAttachToPendingHost)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_ResourceDestroyed,
                         OnHostMsgResourceDestroyed)
     IPC_MESSAGE_UNHANDLED(handled = false)
@@ -81,10 +88,21 @@
 
 void PpapiHost::SendUnsolicitedReply(PP_Resource resource,
                                      const IPC::Message& msg) {
+  DCHECK(resource);  // If this fails, host is probably pending.
   proxy::ResourceMessageReplyParams params(resource, 0);
   Send(new PpapiPluginMsg_ResourceReply(params, msg));
 }
 
+int PpapiHost::AddPendingResourceHost(scoped_ptr<ResourceHost> resource_host) {
+  // The resource ID should not be assigned.
+  DCHECK(resource_host->pp_resource() == 0);
+
+  int pending_id = next_pending_resource_host_id_++;
+  pending_resource_hosts_[pending_id] =
+      linked_ptr<ResourceHost>(resource_host.release());
+  return pending_id;
+}
+
 void PpapiHost::AddHostFactoryFilter(scoped_ptr<HostFactory> filter) {
   host_factory_filters_.push_back(filter.release());
 }
@@ -118,40 +136,17 @@
     const proxy::ResourceMessageCallParams& params,
     const IPC::Message& nested_msg,
     HostMessageContext* context) {
-  ReplyMessageContext reply_context = context->MakeReplyMessageContext();
-
   ResourceHost* resource_host = GetResourceHost(params.pp_resource());
   if (resource_host) {
-    reply_context.params.set_result(
-        resource_host->OnResourceMessageReceived(nested_msg, context));
-
-    // Sanity check the resource handler. Note if the result was
-    // "completion pending" the resource host may have already sent the reply.
-    if (reply_context.params.result() == PP_OK_COMPLETIONPENDING) {
-      // Message handler should have only returned a pending result if a
-      // response will be sent to the plugin.
-      DCHECK(params.has_callback());
-
-      // Message handler should not have written a message to be returned if
-      // completion is pending.
-      DCHECK(context->reply_msg.type() == 0);
-    } else if (!params.has_callback()) {
-      // When no response is required, the message handler should not have
-      // written a message to be returned.
-      DCHECK(context->reply_msg.type() == 0);
-
-      // If there is no callback and the result of running the message handler
-      // was not PP_OK the client won't find out.
-      DLOG_IF(WARNING, reply_context.params.result() != PP_OK)
-          << "'Post' message handler failed to complete successfully.";
-    }
+    // CAUTION: Handling the message may cause the destruction of this object.
+    resource_host->HandleMessage(nested_msg, context);
   } else {
-    reply_context.params.set_result(PP_ERROR_BADRESOURCE);
+    if (context->params.has_callback()) {
+      ReplyMessageContext reply_context = context->MakeReplyMessageContext();
+      reply_context.params.set_result(PP_ERROR_BADRESOURCE);
+      SendReply(reply_context, context->reply_msg);
+    }
   }
-
-  if (params.has_callback() &&
-      reply_context.params.result() != PP_OK_COMPLETIONPENDING)
-    SendReply(reply_context, context->reply_msg);
 }
 
 void PpapiHost::OnHostMsgResourceCreated(
@@ -175,10 +170,27 @@
     return;
   }
 
+  // Resource should have been assigned a nonzero PP_Resource.
+  DCHECK(resource_host->pp_resource());
+
   resources_[params.pp_resource()] =
       linked_ptr<ResourceHost>(resource_host.release());
 }
 
+void PpapiHost::OnHostMsgAttachToPendingHost(PP_Resource pp_resource,
+                                             int pending_host_id) {
+  PendingHostResourceMap::iterator found =
+      pending_resource_hosts_.find(pending_host_id);
+  if (found == pending_resource_hosts_.end()) {
+    // Plugin sent a bad ID.
+    NOTREACHED();
+    return;
+  }
+  found->second->SetPPResourceForPendingHost(pp_resource);
+  resources_[pp_resource] = found->second;
+  pending_resource_hosts_.erase(found);
+}
+
 void PpapiHost::OnHostMsgResourceDestroyed(PP_Resource resource) {
   ResourceMap::iterator found = resources_.find(resource);
   if (found == resources_.end()) {
@@ -188,8 +200,8 @@
   resources_.erase(found);
 }
 
-ResourceHost* PpapiHost::GetResourceHost(PP_Resource resource) {
-  ResourceMap::iterator found = resources_.find(resource);
+ResourceHost* PpapiHost::GetResourceHost(PP_Resource resource) const {
+  ResourceMap::const_iterator found = resources_.find(resource);
   return found == resources_.end() ? NULL : found->second.get();
 }
 
diff --git a/ppapi/host/ppapi_host.h b/ppapi/host/ppapi_host.h
index 3597093..c661a9b 100644
--- a/ppapi/host/ppapi_host.h
+++ b/ppapi/host/ppapi_host.h
@@ -61,6 +61,11 @@
   // Sends the given unsolicited reply message to the plugin.
   void SendUnsolicitedReply(PP_Resource resource, const IPC::Message& msg);
 
+  // Adds the given host resource as a pending one (with no corresponding
+  // PluginResource object and no PP_Resource ID yet). The pending resource ID
+  // is returned. See PpapiHostMsg_AttachToPendingHost.
+  int AddPendingResourceHost(scoped_ptr<ResourceHost> resource_host);
+
   // Adds the given host factory filter to the host. The PpapiHost will take
   // ownership of the pointer.
   void AddHostFactoryFilter(scoped_ptr<HostFactory> filter);
@@ -69,6 +74,9 @@
   // ownership of the pointer.
   void AddInstanceMessageFilter(scoped_ptr<InstanceMessageFilter> filter);
 
+  // Returns null if the resource doesn't exist.
+  host::ResourceHost* GetResourceHost(PP_Resource resource) const;
+
  private:
   friend class InstanceMessageFilter;
 
@@ -87,11 +95,9 @@
   void OnHostMsgResourceCreated(const proxy::ResourceMessageCallParams& param,
                                 PP_Instance instance,
                                 const IPC::Message& nested_msg);
+  void OnHostMsgAttachToPendingHost(PP_Resource resource, int pending_host_id);
   void OnHostMsgResourceDestroyed(PP_Resource resource);
 
-  // Returns null if the resource doesn't exist.
-  host::ResourceHost* GetResourceHost(PP_Resource resource);
-
   // Non-owning pointer.
   IPC::Sender* sender_;
 
@@ -112,6 +118,13 @@
   typedef std::map<PP_Resource, linked_ptr<ResourceHost> > ResourceMap;
   ResourceMap resources_;
 
+  // Resources that have been created in the host and have not yet had the
+  // corresponding PluginResource associated with them.
+  // See PpapiHostMsg_AttachToPendingHost.
+  typedef std::map<int, linked_ptr<ResourceHost> > PendingHostResourceMap;
+  PendingHostResourceMap pending_resource_hosts_;
+  int next_pending_resource_host_id_;
+
   DISALLOW_COPY_AND_ASSIGN(PpapiHost);
 };
 
diff --git a/ppapi/host/resource_host.cc b/ppapi/host/resource_host.cc
index b67be08..a199a97 100644
--- a/ppapi/host/resource_host.cc
+++ b/ppapi/host/resource_host.cc
@@ -4,7 +4,10 @@
 
 #include "ppapi/host/resource_host.h"
 
+#include "base/logging.h"
 #include "ppapi/c/pp_errors.h"
+#include "ppapi/host/ppapi_host.h"
+#include "ppapi/host/resource_message_filter.h"
 
 namespace ppapi {
 namespace host {
@@ -18,11 +21,36 @@
 }
 
 ResourceHost::~ResourceHost() {
+  for (size_t i = 0; i < message_filters_.size(); ++i)
+    message_filters_[i]->OnFilterDestroyed();
 }
 
-int32_t ResourceHost::OnResourceMessageReceived(const IPC::Message& msg,
-                                                HostMessageContext* context) {
-  return PP_ERROR_NOTSUPPORTED;
+bool ResourceHost::HandleMessage(const IPC::Message& msg,
+                                 HostMessageContext* context) {
+  // First see if the message is handled off-thread by message filters.
+  for (size_t i = 0; i < message_filters_.size(); ++i) {
+    if (message_filters_[i]->HandleMessage(msg, context))
+      return true;
+  }
+  // Run this ResourceHosts message handler.
+  RunMessageHandlerAndReply(msg, context);
+  return true;
+}
+
+void ResourceHost::SetPPResourceForPendingHost(PP_Resource pp_resource) {
+  DCHECK(!pp_resource_);
+  pp_resource_ = pp_resource;
+  DidConnectPendingHostToResource();
+}
+
+void ResourceHost::SendReply(const ReplyMessageContext& context,
+                             const IPC::Message& msg) {
+  host_->SendReply(context, msg);
+}
+
+void ResourceHost::AddFilter(scoped_refptr<ResourceMessageFilter> filter) {
+  message_filters_.push_back(filter);
+  filter->OnFilterAdded(this);
 }
 
 }  // namespace host
diff --git a/ppapi/host/resource_host.h b/ppapi/host/resource_host.h
index 27d87b3..0976118 100644
--- a/ppapi/host/resource_host.h
+++ b/ppapi/host/resource_host.h
@@ -5,9 +5,13 @@
 #ifndef PPAPI_HOST_RESOURCE_HOST_H_
 #define PPAPI_HOST_RESOURCE_HOST_H_
 
+#include <vector>
+
 #include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/host/ppapi_host_export.h"
+#include "ppapi/host/resource_message_handler.h"
 #include "ppapi/shared_impl/host_resource.h"
 
 namespace IPC {
@@ -19,11 +23,12 @@
 
 struct HostMessageContext;
 class PpapiHost;
+class ResourceMessageFilter;
 
 // Some (but not all) resources have a corresponding object in the host side
 // that is kept alive as long as the resource in the plugin is alive. This is
 // the base class for such objects.
-class PPAPI_HOST_EXPORT ResourceHost {
+class PPAPI_HOST_EXPORT ResourceHost : public ResourceMessageHandler {
  public:
   ResourceHost(PpapiHost* host, PP_Instance instance, PP_Resource resource);
   virtual ~ResourceHost();
@@ -32,25 +37,38 @@
   PP_Instance pp_instance() const { return pp_instance_; }
   PP_Resource pp_resource() const { return pp_resource_; }
 
-  // Handles messages associated with a given resource object. If the flags
-  // indicate that a response is required, the return value of this function
-  // will be sent as a resource message "response" along with the message
-  // specified in the reply of the context.
+  // This runs any message filters in |message_filters_|. If the message is not
+  // handled by these filters then the host's own message handler is run. True
+  // is always returned (the message will always be handled in some way).
+  virtual bool HandleMessage(const IPC::Message& msg,
+                             HostMessageContext* context) OVERRIDE;
+
+  // Sets the PP_Resource ID when the plugin attaches to a pending resource
+  // host. This will notify subclasses by calling
+  // DidConnectPendingHostToResource.
   //
-  // You can do a response asynchronously by returning PP_OK_COMPLETIONPENDING.
-  // This will cause the reply to be skipped, and the class implementing this
-  // function will take responsibility for issuing the callback. The callback
-  // can be issued inside OnResourceMessageReceived before it returns, or at
-  // a future time.
+  // The current PP_Resource for all pending hosts should be 0.  See
+  // PpapiHostMsg_AttachToPendingHost.
+  void SetPPResourceForPendingHost(PP_Resource pp_resource);
+
+  virtual void SendReply(const ReplyMessageContext& context,
+                         const IPC::Message& msg) OVERRIDE;
+
+  virtual bool IsGraphics2DHost() const { return false; }
+
+ protected:
+  // Adds a ResourceMessageFilter to handle resource messages. Incoming
+  // messages will be passed to the handlers of these filters before being
+  // handled by the resource host's own message handler. This allows
+  // ResourceHosts to easily handle messages on other threads.
+  void AddFilter(scoped_refptr<ResourceMessageFilter> filter);
+
+  // Called when this resource host is pending and the corresponding plugin has
+  // just connected to it. The host resource subclass can implement this
+  // function if it wants to do processing (typically sending queued data).
   //
-  // If you don't have a particular reply message, you can just ignore
-  // the reply in the message context. However, if you have a reply more than
-  // just the int32_t result code, set the reply to be the message of your
-  // choosing.
-  //
-  // The default implementation just returns PP_ERROR_NOTSUPPORTED.
-  virtual int32_t OnResourceMessageReceived(const IPC::Message& msg,
-                                            HostMessageContext* context);
+  // The PP_Resource will be valid for this call but not before.
+  virtual void DidConnectPendingHostToResource() {}
 
  private:
   // The host that owns this object.
@@ -59,6 +77,10 @@
   PP_Instance pp_instance_;
   PP_Resource pp_resource_;
 
+  // A vector of message filters which the host will forward incoming resource
+  // messages to.
+  std::vector<scoped_refptr<ResourceMessageFilter> > message_filters_;
+
   DISALLOW_COPY_AND_ASSIGN(ResourceHost);
 };
 
diff --git a/ppapi/host/resource_message_filter.cc b/ppapi/host/resource_message_filter.cc
new file mode 100644
index 0000000..887c184
--- /dev/null
+++ b/ppapi/host/resource_message_filter.cc
@@ -0,0 +1,78 @@
+// 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 "ppapi/host/resource_message_filter.h"
+
+#include "base/message_loop.h"
+#include "base/message_loop_proxy.h"
+#include "base/task_runner.h"
+#include "ipc/ipc_message.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/host/ppapi_host.h"
+#include "ppapi/host/resource_host.h"
+
+namespace ppapi {
+namespace host {
+
+ResourceMessageFilter::ResourceMessageFilter()
+    : reply_thread_message_loop_proxy_(
+           MessageLoop::current()->message_loop_proxy()),
+      resource_host_(NULL) {
+}
+
+ResourceMessageFilter::ResourceMessageFilter(
+    scoped_refptr<base::MessageLoopProxy> reply_thread_message_loop_proxy)
+    : reply_thread_message_loop_proxy_(reply_thread_message_loop_proxy),
+      resource_host_(NULL) {
+}
+
+ResourceMessageFilter::~ResourceMessageFilter() {
+}
+
+void ResourceMessageFilter::OnFilterAdded(ResourceHost* resource_host) {
+  resource_host_ = resource_host;
+}
+
+void ResourceMessageFilter::OnFilterDestroyed() {
+  resource_host_ = NULL;
+}
+
+bool ResourceMessageFilter::HandleMessage(const IPC::Message& msg,
+                                          HostMessageContext* context) {
+  scoped_refptr<base::TaskRunner> runner = OverrideTaskRunnerForMessage(msg);
+  if (runner) {
+    // TODO(raymes): We need to make a copy so the context can be used on other
+    // threads. It would be better to have a thread-safe refcounted context.
+    HostMessageContext context_copy = *context;
+    runner->PostTask(FROM_HERE, base::Bind(
+        &ResourceMessageFilter::DispatchMessage, this, msg, context_copy));
+    return true;
+  }
+
+  return false;
+}
+
+void ResourceMessageFilter::SendReply(const ReplyMessageContext& context,
+                                      const IPC::Message& msg) {
+  if (!reply_thread_message_loop_proxy_->BelongsToCurrentThread()) {
+    reply_thread_message_loop_proxy_->PostTask(FROM_HERE,
+        base::Bind(&ResourceMessageFilter::SendReply, this, context, msg));
+    return;
+  }
+  if (resource_host_)
+    resource_host_->SendReply(context, msg);
+}
+
+scoped_refptr<base::TaskRunner>
+ResourceMessageFilter::OverrideTaskRunnerForMessage(const IPC::Message& msg) {
+  return NULL;
+}
+
+void ResourceMessageFilter::DispatchMessage(const IPC::Message& msg,
+                                            HostMessageContext context) {
+  RunMessageHandlerAndReply(msg, &context);
+}
+
+}  // namespace host
+}  // namespace ppapi
diff --git a/ppapi/host/resource_message_filter.h b/ppapi/host/resource_message_filter.h
new file mode 100644
index 0000000..ef00cf7
--- /dev/null
+++ b/ppapi/host/resource_message_filter.h
@@ -0,0 +1,128 @@
+// 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 PPAPI_HOST_RESOURCE_MESSAGE_FILTER_H_
+#define PPAPI_HOST_RESOURCE_MESSAGE_FILTER_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/host/host_message_context.h"
+#include "ppapi/host/ppapi_host_export.h"
+#include "ppapi/host/resource_message_handler.h"
+
+namespace base {
+class MessageLoopProxy;
+class TaskRunner;
+}
+
+namespace IPC {
+class Message;
+}
+
+namespace ppapi {
+namespace host {
+
+class ResourceHost;
+
+// This is the base class of resource message filters that can handle resource
+// messages on another thread. ResourceHosts can handle most messages
+// directly, but if they need to handle something on a different thread it is
+// inconvenient. This class makes handling that case easier. This class is
+// similar to a BrowserMessageFilter but for resource messages. Note that the
+// liftetime of a ResourceHost is managed by a PpapiHost and may be destroyed
+// before or while your message is being processed on another thread.
+// If this is the case, the message handler will always be called but a reply
+// may not be sent back to the host.
+//
+// To handle a resource message on another thread you should implement a
+// subclass as follows:
+// class MyMessageFilter : public ResourceMessageFilter {
+//  protected:
+//   virtual scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage(
+//       const IPC::Message& message) OVERRIDE {
+//     if (message.type() == MyMessage::ID)
+//       return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI);
+//     return NULL;
+//   }
+//
+//   virtual int32_t OnResourceMessageReceived(
+//       const IPC::Message& msg,
+//       HostMessageContext* context) OVERRIDE {
+//     IPC_BEGIN_MESSAGE_MAP(MyMessageFilter, msg)
+//       PPAPI_DISPATCH_HOST_RESOURCE_CALL(MyMessage, OnMyMessage)
+//     IPC_END_MESSAGE_MAP()
+//     return PP_ERROR_FAILED;
+//   }
+//
+//  private:
+//   int32_t OnMyMessage(ppapi::host::HostMessageContext* context, ...) {
+//     // Will be run on the UI thread.
+//   }
+// }
+//
+// The filter should then be added in the resource host using:
+// AddFilter(make_scoped_refptr(new MyMessageFilter));
+class PPAPI_HOST_EXPORT ResourceMessageFilter
+    : public ResourceMessageHandler,
+      public base::RefCountedThreadSafe<ResourceMessageFilter> {
+ public:
+  // This object must be constructed on the same thread that a reply message
+  // should be sent, i.e. the IO thread when constructed in the browser process
+  // or the main thread when constructed in the renderer process. Since
+  // ResourceMessageFilters are usually constructed in the constructor of the
+  // owning ResourceHost, this will almost always be the case anyway.
+  ResourceMessageFilter();
+  // Test constructor. Allows you to specify the message loop which will be used
+  // to dispatch replies on.
+  ResourceMessageFilter(
+      scoped_refptr<base::MessageLoopProxy> reply_thread_message_loop_proxy);
+
+  // Called when a filter is added to a ResourceHost.
+  void OnFilterAdded(ResourceHost* resource_host);
+  // Called when a filter is removed from a ResourceHost.
+  void OnFilterDestroyed();
+
+  // This will dispatch the message handler on the target thread. It returns
+  // true if the message was handled by this filter and false otherwise.
+  virtual bool HandleMessage(const IPC::Message& msg,
+                             HostMessageContext* context) OVERRIDE;
+
+  // This can be called from any thread.
+  virtual void SendReply(const ReplyMessageContext& context,
+      const IPC::Message& msg) OVERRIDE;
+
+ protected:
+  friend class base::RefCountedThreadSafe<ResourceMessageFilter>;
+  virtual ~ResourceMessageFilter();
+
+  // If you want the message to be handled on another thread, return a non-null
+  // task runner which will target tasks accordingly.
+  virtual scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage(
+      const IPC::Message& message);
+
+ private:
+  // This method is posted to the target thread and runs the message handler.
+  void DispatchMessage(const IPC::Message& msg,
+                       HostMessageContext context);
+
+  // Message loop to send resource message replies on. This will be the message
+  // loop proxy of the IO thread for the browser process or the main thread for
+  // the renderer process.
+  scoped_refptr<base::MessageLoopProxy> reply_thread_message_loop_proxy_;
+
+  // Non-owning pointer to the resource host owning this filter. Should only be
+  // accessed from the thread which sends messages to the plugin resource (i.e.
+  // the IO thread for the browser process or the main thread for the renderer).
+  // This will be NULL upon creation of the filter and is set to the owning
+  // ResourceHost when |OnFilterAdded| is called. When the owning ResourceHost
+  // is destroyed, |OnFilterDestroyed| is called and this will be set to NULL.
+  ResourceHost* resource_host_;
+
+  DISALLOW_COPY_AND_ASSIGN(ResourceMessageFilter);
+};
+
+}  // namespace host
+}  // namespace ppapi
+
+#endif  // PPAPI_HOST_RESOURCE_MESSAGE_FILTER_H_
diff --git a/ppapi/host/resource_message_filter_unittest.cc b/ppapi/host/resource_message_filter_unittest.cc
new file mode 100644
index 0000000..3e4c0e0
--- /dev/null
+++ b/ppapi/host/resource_message_filter_unittest.cc
@@ -0,0 +1,202 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/message_loop.h"
+#include "base/message_loop_proxy.h"
+#include "base/synchronization/waitable_event.h"
+#include "base/threading/thread.h"
+#include "ipc/ipc_message.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/host/host_message_context.h"
+#include "ppapi/host/resource_host.h"
+#include "ppapi/host/resource_message_filter.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace ppapi {
+namespace host {
+
+typedef testing::Test ResourceMessageFilterTest;
+
+namespace {
+
+base::WaitableEvent g_handler_completion(true, false);
+
+enum TestMessageTypes {
+  MSG1_TYPE = 1,
+  MSG2_TYPE,
+  MSG3_TYPE,
+  REPLY_MSG1_TYPE,
+  REPLY_MSG2_TYPE,
+  REPLY_MSG3_TYPE,
+};
+
+// Dummy resource host which simply stores a copy of messages it handles.
+// |SendReply| is overridden to store a copy of the outgoing message and the
+// message loop on which it was sent.
+class MyResourceHost : public ResourceHost {
+ public:
+  // Messages of type |msg_type| will be handled (simply by replying with a
+  // message of type |reply_msg_type|).
+  MyResourceHost(PpapiHost* host,
+                 PP_Instance instance,
+                 PP_Resource resource,
+                 uint32 msg_type,
+                 uint32 reply_msg_type)
+      : ResourceHost(host, instance, resource),
+        msg_type_(msg_type),
+        reply_msg_type_(reply_msg_type),
+        last_reply_message_loop_(NULL) {
+  }
+
+  const IPC::Message& last_handled_msg() const { return last_handled_msg_; }
+  const IPC::Message& last_reply_msg() const { return last_reply_msg_; }
+  MessageLoop* last_reply_message_loop() const {
+    return last_reply_message_loop_;
+  }
+
+  void AddMessageFilter(scoped_refptr<ResourceMessageFilter> filter) {
+    AddFilter(filter);
+  }
+
+  virtual int32_t OnResourceMessageReceived(
+      const IPC::Message& msg,
+      HostMessageContext* context) OVERRIDE {
+    last_handled_msg_ = msg;
+    if (msg.type() == msg_type_) {
+      context->reply_msg = IPC::Message(0, reply_msg_type_,
+                                        IPC::Message::PRIORITY_NORMAL);
+      return PP_OK;
+    }
+    return PP_ERROR_FAILED;
+  }
+
+  virtual void SendReply(const ReplyMessageContext& context,
+                         const IPC::Message& msg) OVERRIDE {
+    last_reply_msg_ = msg;
+    last_reply_message_loop_ = MessageLoop::current();
+    g_handler_completion.Signal();
+  }
+
+ private:
+  uint32 msg_type_;
+  uint32 reply_msg_type_;
+
+  IPC::Message last_handled_msg_;
+  IPC::Message last_reply_msg_;
+  MessageLoop* last_reply_message_loop_;
+};
+
+// Dummy message filter which simply stores a copy of messages it handles.
+// The message loop on which the message is handled is also stored for checking
+// later.
+class MyResourceFilter : public ResourceMessageFilter {
+ public:
+  // Messages of type |msg_type| will be handled (simply by replying with a
+  // message of type |reply_msg_type|). |io_thread| is the thread on which
+  // replies should be sent. |bg_thread| is the thread on which the message
+  // should be handled.
+  MyResourceFilter(const base::Thread& io_thread,
+                   const base::Thread& bg_thread,
+                   uint32 msg_type,
+                   uint32 reply_msg_type)
+      : ResourceMessageFilter(io_thread.message_loop_proxy()),
+        message_loop_proxy_(bg_thread.message_loop_proxy()),
+        msg_type_(msg_type),
+        reply_msg_type_(reply_msg_type),
+        last_message_loop_(NULL) {
+  }
+
+  const IPC::Message& last_handled_msg() const { return last_handled_msg_; }
+  MessageLoop* last_message_loop() const { return last_message_loop_; }
+
+  virtual scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage(
+      const IPC::Message& msg) OVERRIDE {
+    if (msg.type() == msg_type_)
+      return message_loop_proxy_;
+    return NULL;
+  }
+
+  virtual int32_t OnResourceMessageReceived(
+      const IPC::Message& msg,
+      HostMessageContext* context) OVERRIDE {
+    last_handled_msg_ = msg;
+    last_message_loop_ = MessageLoop::current();
+    if (msg.type() == msg_type_) {
+      context->reply_msg = IPC::Message(0, reply_msg_type_,
+                                        IPC::Message::PRIORITY_NORMAL);
+      return PP_OK;
+    }
+    return PP_ERROR_FAILED;
+  }
+
+ private:
+  scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
+  uint32 msg_type_;
+  uint32 reply_msg_type_;
+
+  IPC::Message last_handled_msg_;
+  MessageLoop* last_message_loop_;
+};
+
+}  // namespace
+
+// Test that messages are filtered correctly and handlers are run on the correct
+// threads.
+TEST_F(ResourceMessageFilterTest, TestHandleMessage) {
+  base::Thread io_thread("test_io_thread");
+  ASSERT_TRUE(io_thread.Start());
+
+  base::Thread bg_thread1("test_background_thread1");
+  ASSERT_TRUE(bg_thread1.Start());
+  scoped_refptr<MyResourceFilter> filter1 =
+      new MyResourceFilter(io_thread, bg_thread1, MSG1_TYPE, REPLY_MSG1_TYPE);
+
+  base::Thread bg_thread2("test_background_thread2");
+  ASSERT_TRUE(bg_thread2.Start());
+  scoped_refptr<MyResourceFilter> filter2 =
+      new MyResourceFilter(io_thread, bg_thread2, MSG2_TYPE, REPLY_MSG2_TYPE);
+
+  PP_Instance instance = 12345;
+  PP_Resource resource = 67890;
+  MyResourceHost host(NULL, instance, resource, MSG3_TYPE, REPLY_MSG3_TYPE);
+  host.AddMessageFilter(filter1);
+  host.AddMessageFilter(filter2);
+
+  proxy::ResourceMessageCallParams params(resource, 1);
+  params.set_has_callback();
+  HostMessageContext context(params);
+  IPC::Message message1(0, MSG1_TYPE, IPC::Message::PRIORITY_NORMAL);
+  IPC::Message message2(0, MSG2_TYPE, IPC::Message::PRIORITY_NORMAL);
+  IPC::Message message3(0, MSG3_TYPE, IPC::Message::PRIORITY_NORMAL);
+
+  // Message 1 handled by the first filter.
+  host.HandleMessage(message1, &context);
+  g_handler_completion.Wait();
+  EXPECT_EQ(filter1->last_handled_msg().type(), message1.type());
+  EXPECT_EQ(filter1->last_message_loop(), bg_thread1.message_loop());
+  EXPECT_EQ(host.last_reply_msg().type(), static_cast<uint32>(REPLY_MSG1_TYPE));
+  EXPECT_EQ(host.last_reply_message_loop(), io_thread.message_loop());
+  g_handler_completion.Reset();
+
+  // Message 2 handled by the second filter.
+  host.HandleMessage(message2, &context);
+  g_handler_completion.Wait();
+  EXPECT_EQ(filter2->last_handled_msg().type(), message2.type());
+  EXPECT_EQ(filter2->last_message_loop(), bg_thread2.message_loop());
+  EXPECT_EQ(host.last_reply_msg().type(), static_cast<uint32>(REPLY_MSG2_TYPE));
+  EXPECT_EQ(host.last_reply_message_loop(), io_thread.message_loop());
+  g_handler_completion.Reset();
+
+  // Message 3 handled by the resource host.
+  host.HandleMessage(message3, &context);
+  EXPECT_EQ(host.last_handled_msg().type(), message3.type());
+  EXPECT_EQ(host.last_reply_msg().type(), static_cast<uint32>(REPLY_MSG3_TYPE));
+
+  io_thread.Stop();
+  bg_thread1.Stop();
+  bg_thread2.Stop();
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/host/resource_message_handler.cc b/ppapi/host/resource_message_handler.cc
new file mode 100644
index 0000000..603d5e2
--- /dev/null
+++ b/ppapi/host/resource_message_handler.cc
@@ -0,0 +1,65 @@
+// 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 "ppapi/host/resource_message_handler.h"
+
+#include "base/logging.h"
+#include "ipc/ipc_message.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/host/host_message_context.h"
+
+namespace ppapi {
+namespace host {
+
+ResourceMessageHandler::ResourceMessageHandler() {
+}
+
+ResourceMessageHandler::~ResourceMessageHandler() {
+}
+
+void ResourceMessageHandler::RunMessageHandlerAndReply(
+    const IPC::Message& msg,
+    HostMessageContext* context) {
+  ReplyMessageContext reply_context = context->MakeReplyMessageContext();
+  // CAUTION: Handling the message may cause the destruction of this object.
+  // The message handler should ensure that if there is a chance that the
+  // object will be destroyed, PP_OK_COMPLETIONPENDING is returned as the
+  // result of the message handler. Otherwise the code below will attempt to
+  // send a reply message on a destroyed object.
+  reply_context.params.set_result(OnResourceMessageReceived(msg, context));
+
+  // Sanity check the resource handler. Note if the result was
+  // "completion pending" the resource host may have already sent the reply.
+  if (reply_context.params.result() == PP_OK_COMPLETIONPENDING) {
+    // Message handler should have only returned a pending result if a
+    // response will be sent to the plugin.
+    DCHECK(context->params.has_callback());
+
+    // Message handler should not have written a message to be returned if
+    // completion is pending.
+    DCHECK(context->reply_msg.type() == 0);
+  } else if (!context->params.has_callback()) {
+    // When no response is required, the message handler should not have
+    // written a message to be returned.
+    DCHECK(context->reply_msg.type() == 0);
+
+    // If there is no callback and the result of running the message handler
+    // was not PP_OK the client won't find out.
+    DLOG_IF(WARNING, reply_context.params.result() != PP_OK)
+        << "'Post' message handler failed to complete successfully.";
+  }
+
+  if (context->params.has_callback() &&
+      reply_context.params.result() != PP_OK_COMPLETIONPENDING)
+    SendReply(reply_context, context->reply_msg);
+}
+
+int32_t ResourceMessageHandler::OnResourceMessageReceived(
+    const IPC::Message& msg,
+    HostMessageContext* context) {
+  return PP_ERROR_NOTSUPPORTED;
+}
+
+}  // namespace host
+}  // namespace ppapi
diff --git a/ppapi/host/resource_message_handler.h b/ppapi/host/resource_message_handler.h
new file mode 100644
index 0000000..73f7f84
--- /dev/null
+++ b/ppapi/host/resource_message_handler.h
@@ -0,0 +1,74 @@
+// 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 PPAPI_HOST_RESOURCE_MESSAGE_HANDLER_H_
+#define PPAPI_HOST_RESOURCE_MESSAGE_HANDLER_H_
+
+#include "base/basictypes.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/host/ppapi_host_export.h"
+
+namespace IPC {
+class Message;
+}
+
+namespace ppapi {
+namespace host {
+
+struct HostMessageContext;
+struct ReplyMessageContext;
+
+// This is the base class of classes that can handle resource messages. It
+// mainly exists at present to share code for checking replies to resource
+// messages are valid.
+class PPAPI_HOST_EXPORT ResourceMessageHandler {
+ public:
+  ResourceMessageHandler();
+  virtual ~ResourceMessageHandler();
+
+  // Called when this handler should handle a particular message. This should
+  // call into the the message handler implemented by subclasses (i.e.
+  // |OnResourceMessageReceived|) and perform any additional work necessary to
+  // handle the message (e.g. checking resource replies are valid). True is
+  // returned if the message is handled and false otherwise.
+  virtual bool HandleMessage(const IPC::Message& msg,
+                             HostMessageContext* context) = 0;
+
+  // Send a resource reply message.
+  virtual void SendReply(const ReplyMessageContext& context,
+                         const IPC::Message& msg) = 0;
+
+ protected:
+  // Runs the message handler and checks that a reply was sent if necessary.
+  void RunMessageHandlerAndReply(const IPC::Message& msg,
+                                 HostMessageContext* context);
+
+  // Handles messages associated with a given resource object. If the flags
+  // indicate that a response is required, the return value of this function
+  // will be sent as a resource message "response" along with the message
+  // specified in the reply of the context.
+  //
+  // You can do a response asynchronously by returning PP_OK_COMPLETIONPENDING.
+  // This will cause the reply to be skipped, and the class implementing this
+  // function will take responsibility for issuing the callback. The callback
+  // can be issued inside OnResourceMessageReceived before it returns, or at
+  // a future time.
+  //
+  // If you don't have a particular reply message, you can just ignore
+  // the reply in the message context. However, if you have a reply more than
+  // just the int32_t result code, set the reply to be the message of your
+  // choosing.
+  //
+  // The default implementation just returns PP_ERROR_NOTSUPPORTED.
+  virtual int32_t OnResourceMessageReceived(const IPC::Message& msg,
+                                            HostMessageContext* context);
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(ResourceMessageHandler);
+};
+
+}  // namespace host
+}  // namespace ppapi
+
+#endif  // PPAPI_HOST_RESOURCE_MESSAGE_HANDLER_H_
diff --git a/ppapi/lib/gl/gles2/gl2ext_ppapi.c b/ppapi/lib/gl/gles2/gl2ext_ppapi.c
index dc96a16..a310114 100644
--- a/ppapi/lib/gl/gles2/gl2ext_ppapi.c
+++ b/ppapi/lib/gl/gles2/gl2ext_ppapi.c
@@ -76,7 +76,7 @@
   return g_gles2_interface ? GL_TRUE : GL_FALSE;
 }
 
-GLboolean GL_APIENTRY glTerminatePPAPI() {
+GLboolean GL_APIENTRY glTerminatePPAPI(void) {
   g_gles2_interface = NULL;
   return GL_TRUE;
 }
@@ -85,40 +85,40 @@
   g_current_context = context;
 }
 
-PP_Resource GL_APIENTRY glGetCurrentContextPPAPI() {
+PP_Resource GL_APIENTRY glGetCurrentContextPPAPI(void) {
   return g_current_context;
 }
 
-const struct PPB_OpenGLES2* GL_APIENTRY glGetInterfacePPAPI() {
+const struct PPB_OpenGLES2* GL_APIENTRY glGetInterfacePPAPI(void) {
   return g_gles2_interface;
 }
 
 const struct PPB_OpenGLES2InstancedArrays* GL_APIENTRY
-    glGetInstancedArraysInterfacePPAPI() {
+    glGetInstancedArraysInterfacePPAPI(void) {
   return g_gles2_instanced_arrays_interface;
 }
 
 const struct PPB_OpenGLES2FramebufferBlit* GL_APIENTRY
-    glGetFramebufferBlitInterfacePPAPI() {
+    glGetFramebufferBlitInterfacePPAPI(void) {
   return g_gles2_framebuffer_blit_interface;
 }
 
 const struct PPB_OpenGLES2FramebufferMultisample* GL_APIENTRY
-    glGetFramebufferMultisampleInterfacePPAPI() {
+    glGetFramebufferMultisampleInterfacePPAPI(void) {
   return g_gles2_framebuffer_multisample_interface;
 }
 
 const struct PPB_OpenGLES2ChromiumEnableFeature* GL_APIENTRY
-    glGetChromiumEnableFeatureInterfacePPAPI() {
+    glGetChromiumEnableFeatureInterfacePPAPI(void) {
   return g_gles2_chromium_enable_feature_interface;
 }
 
 const struct PPB_OpenGLES2ChromiumMapSub* GL_APIENTRY
-    glGetChromiumMapSubInterfacePPAPI() {
+    glGetChromiumMapSubInterfacePPAPI(void) {
   return g_gles2_chromium_map_sub_interface;
 }
 
 const struct PPB_OpenGLES2Query* GL_APIENTRY
-    glGetQueryInterfacePPAPI() {
+    glGetQueryInterfacePPAPI(void) {
   return g_gles2_query_interface;
 }
diff --git a/ppapi/lib/gl/gles2/gl2ext_ppapi.h b/ppapi/lib/gl/gles2/gl2ext_ppapi.h
index 9b99c7e..146d914 100644
--- a/ppapi/lib/gl/gles2/gl2ext_ppapi.h
+++ b/ppapi/lib/gl/gles2/gl2ext_ppapi.h
@@ -26,29 +26,29 @@
 
 // Terminates OpenGL ES 2.0 library.
 // GL_FALSE is returned on failure, GL_TRUE otherwise.
-GL_APICALL GLboolean GL_APIENTRY glTerminatePPAPI();
+GL_APICALL GLboolean GL_APIENTRY glTerminatePPAPI(void);
 
 // Sets context to be used for rendering in the current thread.
 GL_APICALL void GL_APIENTRY glSetCurrentContextPPAPI(PP_Resource context);
 
 // Gets context being used for rendering in the current thread.
 // Returns NULL if a context has not been set yet.
-GL_APICALL PP_Resource GL_APIENTRY glGetCurrentContextPPAPI();
+GL_APICALL PP_Resource GL_APIENTRY glGetCurrentContextPPAPI(void);
 
 // Returns OpenGL ES 2.0 interface.
-GL_APICALL const struct PPB_OpenGLES2* GL_APIENTRY glGetInterfacePPAPI();
+GL_APICALL const struct PPB_OpenGLES2* GL_APIENTRY glGetInterfacePPAPI(void);
 GL_APICALL const struct PPB_OpenGLES2InstancedArrays* GL_APIENTRY
-    glGetInstancedArraysInterfacePPAPI();
+    glGetInstancedArraysInterfacePPAPI(void);
 GL_APICALL const struct PPB_OpenGLES2FramebufferBlit* GL_APIENTRY
-    glGetFramebufferBlitInterfacePPAPI();
+    glGetFramebufferBlitInterfacePPAPI(void);
 GL_APICALL const struct PPB_OpenGLES2FramebufferMultisample* GL_APIENTRY
-    glGetFramebufferMultisampleInterfacePPAPI();
+    glGetFramebufferMultisampleInterfacePPAPI(void);
 GL_APICALL const struct PPB_OpenGLES2ChromiumEnableFeature* GL_APIENTRY
-    glGetChromiumEnableFeatureInterfacePPAPI();
+    glGetChromiumEnableFeatureInterfacePPAPI(void);
 GL_APICALL const struct PPB_OpenGLES2ChromiumMapSub* GL_APIENTRY
-    glGetChromiumMapSubInterfacePPAPI();
+    glGetChromiumMapSubInterfacePPAPI(void);
 GL_APICALL const struct PPB_OpenGLES2Query* GL_APIENTRY
-    glGetQueryInterfacePPAPI();
+    glGetQueryInterfacePPAPI(void);
 
 #ifdef __cplusplus
 }
diff --git a/ppapi/native_client/chrome_main.scons b/ppapi/native_client/chrome_main.scons
index c98381c..3cf97ae 100644
--- a/ppapi/native_client/chrome_main.scons
+++ b/ppapi/native_client/chrome_main.scons
@@ -37,7 +37,6 @@
 ppapi_scons_files['nonvariant_test_scons_files'] = [
     'tests/breakpad_crash_test/nacl.scons',
     'tests/nacl_browser/browser_dynamic_library/nacl.scons',
-    'tests/nacl_browser/inbrowser_test_runner/nacl.scons',
     'tests/nacl_browser/manifest_file/nacl.scons',
     'tests/nacl_browser/nameservice/nacl.scons',
     'tests/nacl_browser/postmessage_redir/nacl.scons',
@@ -51,6 +50,9 @@
 ]
 
 ppapi_scons_files['irt_variant_test_scons_files'] = [
+    # 'inbrowser_test_runner' must be in the irt_variant list
+    # otherwise it will run no tests.
+    'tests/nacl_browser/inbrowser_test_runner/nacl.scons',
     # Disabled by Brad Chen 4 Sep to try to green Chromium
     # nacl_integration tests
     #'tests/nacl_browser/fault_injection/nacl.scons',
@@ -488,9 +490,6 @@
   if env.Bit('pnacl_generate_pexe'):
     # We likely prefer to choose the 'portable' field in nmfs in this mode.
     args = args + ['--prefer_portable_in_manifest']
-    # Pass through env var controlling streaming translation
-    if 'NACL_STREAMING_TRANSLATION' in os.environ:
-      env['ENV']['NACL_STREAMING_TRANSLATION'] = 'true'
 
   # Lint the extra arguments that are being passed to the tester.
   special_args = ['--ppapi_plugin', '--sel_ldr', '--irt_library', '--file',
@@ -522,13 +521,9 @@
   for extension in extensions:
     command.extend(['--extension', extension])
   if env.Bit('bitcode'):
-    # TODO(jvoung): remove this --extension once we have --pnacl-dir working.
-    command.extend(['--extension', env.GetPnaclExtensionNode().abspath])
     # Enable the installed version of pnacl, and point to a custom install
     # directory for testing purposes.
     browser_flags.append('--enable-pnacl')
-    browser_flags.append('--pnacl-dir=%s' %
-                         env.GetPnaclExtensionRootNode().abspath)
   for dest_path, dep_file in map_files:
     command.extend(['--map_file', dest_path, dep_file])
   for file_ext, mime_type in mime_types:
diff --git a/ppapi/native_client/native_client.gyp b/ppapi/native_client/native_client.gyp
index be2e727..825d120 100644
--- a/ppapi/native_client/native_client.gyp
+++ b/ppapi/native_client/native_client.gyp
@@ -68,6 +68,12 @@
                 'src/untrusted/irt_stub/libppapi.a',
               ],
             },
+            {
+              'destination': '<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_newlib/lib',
+              'files': [
+                'src/untrusted/irt_stub/libppapi.a',
+              ],
+            },
           ],
         },
         {
@@ -89,155 +95,6 @@
             'link_flags': [
               '-Wl,--start-group',
               '-lirt_browser',
-              '-lppruntime',
-              '-lsrpc',
-              '-limc_syscalls',
-              '-lplatform',
-              '-lbase_untrusted',
-              '-lshared_memory_support_untrusted',
-              '-lgio',
-              '-Wl,--end-group',
-              '-lm',
-            ],
-            # See http://code.google.com/p/nativeclient/issues/detail?id=2691.
-            # The PNaCl linker (gold) does not implement the "-Ttext-segment"
-            # option.  However, with the linker for x86, the "-Ttext" option
-            # does not affect the executable's base address.
-            # TODO(olonho): simplify flags handling and avoid duplication
-            # with NaCl logic.
-            'conditions': [
-              ['target_arch!="arm"',
-               {
-                 'sources': [
-                 ],
-                 'link_flags': [
-                   '-Wl,--section-start,.rodata=<(NACL_IRT_DATA_START)',
-                   '-Wl,-Ttext-segment=<(NACL_IRT_TEXT_START)',
-                 ]
-               }, { # target_arch == "arm"
-                 # TODO(mcgrathr): This knowledge really belongs in
-                 # native_client/src/untrusted/irt/irt.gyp instead of here.
-                 # But that builds libirt_browser.a as bitcode, so a native
-                 # object does not fit happily there.
-                 'sources': [
-                   '../../native_client/src/untrusted/irt/aeabi_read_tp.S',
-                 ],
-                 'link_flags': [
-                   '-Wl,--section-start,.rodata=<(NACL_IRT_DATA_START)',
-                   '-Wl,-Ttext=<(NACL_IRT_TEXT_START)',
-                   '--pnacl-allow-native',
-                   '-arch', 'arm',
-                   '-Wt,-mtls-use-call',
-                 ],
-               },
-             ],
-            ],
-            'extra_args': [
-              '--strip-debug',
-            ],
-            # TODO(bradchen): get rid of extra_deps64 and extra_deps32
-            # once native_client/build/untrusted.gypi no longer needs them.
-            'extra_deps64': [
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppruntime.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libbase_untrusted.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libirt_browser.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libshared_memory_support_untrusted.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libsrpc.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libgio.a',
-            ],
-            'extra_deps32': [
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libppruntime.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libbase_untrusted.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libirt_browser.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libshared_memory_support_untrusted.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libsrpc.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libgio.a',
-            ],
-            'extra_deps_newlib64': [
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppruntime.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libbase_untrusted.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libirt_browser.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libshared_memory_support_untrusted.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libsrpc.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libgio.a',
-            ],
-            'extra_deps_newlib32': [
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libppruntime.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libbase_untrusted.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libirt_browser.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libshared_memory_support_untrusted.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libsrpc.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libgio.a',
-            ],
-            'extra_deps_glibc64': [
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libppruntime.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libbase_untrusted.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libirt_browser.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libshared_memory_support_untrusted.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libsrpc.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libplatform.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libimc_syscalls.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libgio.a',
-            ],
-            'extra_deps_glibc32': [
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libppruntime.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libbase_untrusted.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libirt_browser.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libshared_memory_support_untrusted.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libsrpc.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libplatform.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libimc_syscalls.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libgio.a',
-            ],
-            'extra_deps_arm': [
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libppruntime.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libbase_untrusted.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libirt_browser.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libshared_memory_support_untrusted.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libsrpc.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libplatform.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libimc_syscalls.a',
-              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libgio.a',
-            ],
-          },
-          'dependencies': [
-            'src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp:ppruntime_lib',
-            '../../base/base_untrusted.gyp:base_untrusted',
-            '../../media/media_untrusted.gyp:shared_memory_support_untrusted',
-            '../../native_client/src/untrusted/irt/irt.gyp:irt_browser_lib',
-            '../../native_client/src/shared/srpc/srpc.gyp:srpc_lib',
-            '../../native_client/src/shared/platform/platform.gyp:platform_lib',
-            '../../native_client/src/untrusted/nacl/nacl.gyp:imc_syscalls_lib',
-            '../../native_client/src/shared/gio/gio.gyp:gio_lib',
-          ],
-        },
-        {
-          'target_name': 'nacl_ipc_irt',
-          'type': 'none',
-          'variables': {
-            'nexe_target': 'nacl_ipc_irt',
-            # These out_* fields override the default filenames, which
-            # include a "_newlib" suffix.
-            'out_newlib64': '<(PRODUCT_DIR)/nacl_ipc_irt_x86_64.nexe',
-            'out_newlib32': '<(PRODUCT_DIR)/nacl_ipc_irt_x86_32.nexe',
-            'out_newlib_arm': '<(PRODUCT_DIR)/nacl_ipc_irt_arm.nexe',
-            'build_glibc': 0,
-            'build_newlib': 1,
-            'include_dirs': [
-              'lib/gl/include',
-              '..',
-            ],
-            'link_flags': [
-              '-Wl,--start-group',
-              '-lirt_browser',
               '-lppapi_proxy_untrusted',
               '-lppapi_ipc_untrusted',
               '-lppapi_shared_untrusted',
@@ -246,6 +103,7 @@
               '-lgles2_utils_untrusted',
               '-lcommand_buffer_client_untrusted',
               '-lcommand_buffer_common_untrusted',
+              '-ltracing_untrusted',
               '-lgpu_ipc_untrusted',
               '-lipc_untrusted',
               '-lbase_untrusted',
@@ -271,15 +129,37 @@
                    '-Wl,-Ttext-segment=<(NACL_IRT_TEXT_START)',
                  ]
                }, { # target_arch == "arm"
+                 # TODO(mcgrathr): This knowledge really belongs in
+                 # native_client/src/untrusted/irt/irt.gyp instead of here.
+                 # But that builds libirt_browser.a as bitcode, so a native
+                 # object does not fit happily there.
+                 'sources': [
+                   '../../native_client/src/untrusted/irt/aeabi_read_tp.S',
+                 ],
                  'link_flags': [
                    '-Wl,--section-start,.rodata=<(NACL_IRT_DATA_START)',
                    '-Wl,-Ttext=<(NACL_IRT_TEXT_START)',
                    '--pnacl-allow-native',
                    '-arch', 'arm',
                    '-Wt,-mtls-use-call',
+                   '-Wl,--pnacl-irt-link',
                  ],
                },
              ],
+             # untrusted.gypi and build_nexe.py currently build
+             # both x86-32 and x86-64 whenever target_arch is some
+             # flavor of x86.  However, on non-windows platforms
+             # we only need one architecture.
+             ['OS!="win" and target_arch=="ia32"',
+               {
+                 'enable_x86_64': 0
+               }
+             ],
+             ['OS!="win" and target_arch=="x64"',
+               {
+                 'enable_x86_32': 0
+               }
+             ]
             ],
             'sources': [
             ],
@@ -296,6 +176,7 @@
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libcommand_buffer_client_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libcommand_buffer_common_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libgpu_ipc_untrusted.a',
+              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libtracing_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libgles2_cmd_helper_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libgles2_utils_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libipc_untrusted.a',
@@ -315,6 +196,7 @@
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libcommand_buffer_client_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libcommand_buffer_common_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libgpu_ipc_untrusted.a',
+              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libtracing_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libgles2_cmd_helper_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libgles2_utils_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libipc_untrusted.a',
@@ -334,6 +216,7 @@
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libcommand_buffer_client_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libcommand_buffer_common_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libgpu_ipc_untrusted.a',
+              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libtracing_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libgles2_cmd_helper_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libgles2_utils_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libipc_untrusted.a',
@@ -353,6 +236,7 @@
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libcommand_buffer_client_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libcommand_buffer_common_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libgpu_ipc_untrusted.a',
+              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libtracing_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libgles2_cmd_helper_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libgles2_utils_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libipc_untrusted.a',
@@ -372,6 +256,7 @@
               '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libcommand_buffer_client_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libcommand_buffer_common_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libgpu_ipc_untrusted.a',
+              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libtracing_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libgles2_cmd_helper_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libgles2_utils_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libipc_untrusted.a',
@@ -391,6 +276,7 @@
               '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libcommand_buffer_client_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libcommand_buffer_common_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libgpu_ipc_untrusted.a',
+              '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libtracing_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libgles2_cmd_helper_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libgles2_utils_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libipc_untrusted.a',
@@ -410,6 +296,7 @@
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libcommand_buffer_client_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libcommand_buffer_common_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libgpu_ipc_untrusted.a',
+              '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libtracing_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libgles2_cmd_helper_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libgles2_utils_untrusted.a',
               '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libipc_untrusted.a',
@@ -423,7 +310,7 @@
             ],
           },
           'dependencies': [
-            '../ppapi_ipc_proxy_untrusted.gyp:ppapi_proxy_untrusted',
+            '../ppapi_proxy_untrusted.gyp:ppapi_proxy_untrusted',
             '../ppapi_ipc_untrusted.gyp:ppapi_ipc_untrusted',
             '../ppapi_shared_untrusted.gyp:ppapi_shared_untrusted',
             '../../gpu/command_buffer/command_buffer_untrusted.gyp:gles2_utils_untrusted',
@@ -432,6 +319,7 @@
             '../../gpu/gpu_untrusted.gyp:gles2_implementation_untrusted',
             '../../gpu/gpu_untrusted.gyp:gles2_cmd_helper_untrusted',
             '../../gpu/gpu_untrusted.gyp:gpu_ipc_untrusted',
+            '../../components/tracing_untrusted.gyp:tracing_untrusted',
             '../../ipc/ipc_untrusted.gyp:ipc_untrusted',
             '../../base/base_untrusted.gyp:base_untrusted',
             '../../media/media_untrusted.gyp:shared_memory_support_untrusted',
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/DEPS b/ppapi/native_client/src/shared/ppapi_proxy/DEPS
deleted file mode 100644
index f8bca48..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/DEPS
+++ /dev/null
@@ -1,14 +0,0 @@
-include_rules = [
-  # TODO(bradnelson): eliminate this as its actually an incorrectly rooted
-  # internal reference.
-  "+native_client/src/trusted/plugin",
-
-  "+gpu",
-  "+media",
-  "+native_client/src/shared/imc",
-  "+native_client/src/shared/srpc",
-  "+native_client/src/trusted/desc",
-  "+native_client/src/trusted/service_runtime/include/machine",
-  "+native_client/src/untrusted/irt",
-  "+native_client/src/untrusted/pthread",
-]
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/array_buffer_proxy_var.h b/ppapi/native_client/src/shared/ppapi_proxy/array_buffer_proxy_var.h
deleted file mode 100644
index 04e2f67..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/array_buffer_proxy_var.h
+++ /dev/null
@@ -1,48 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_ARRAY_BUFFER_PROXY_VAR_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_ARRAY_BUFFER_PROXY_VAR_H_
-
-#include "native_client/src/include/nacl_memory.h"
-#include "native_client/src/shared/ppapi_proxy/proxy_var.h"
-
-#include <vector>
-
-namespace ppapi_proxy {
-
-// Subclass of ProxyVar that handles ArrayBuffer objects.
-class ArrayBufferProxyVar : public ProxyVar {
- public:
-  explicit ArrayBufferProxyVar(uint32_t size_in_bytes)
-      : ProxyVar(PP_VARTYPE_ARRAY_BUFFER), buffer_(size_in_bytes, 0) {}
-
-  void* buffer() { return buffer_.empty() ? NULL : &buffer_[0]; }
-  uint32_t buffer_length() const { return buffer_.size(); }
-
-  // Convenience function to do type checking and down-casting. This returns a
-  // scoped_refptr<>, so you don't have to down-cast the raw pointer.
-  static scoped_refptr<ArrayBufferProxyVar> CastFromProxyVar(
-      SharedProxyVar proxy_var) {
-    if (proxy_var == NULL ||
-        proxy_var->pp_var_type() != PP_VARTYPE_ARRAY_BUFFER) {
-      scoped_refptr<ArrayBufferProxyVar> null_ptr;
-      return null_ptr;
-    }
-    return scoped_refptr<ArrayBufferProxyVar>(
-        static_cast<ArrayBufferProxyVar*>(proxy_var.get()));
-  }
-
- protected:
-  virtual ~ArrayBufferProxyVar() {}
-
- private:
-  std::vector<uint8_t> buffer_;
-};
-
-typedef scoped_refptr<ArrayBufferProxyVar> SharedArrayBufferProxyVar;
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_ARRAY_BUFFER_PROXY_VAR_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_callback.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_callback.cc
deleted file mode 100644
index debb0bf..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_callback.cc
+++ /dev/null
@@ -1,185 +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 "native_client/src/shared/ppapi_proxy/browser_callback.h"
-
-#include <new>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "native_client/src/trusted/plugin/plugin.h"
-#include "srpcgen/ppp_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-bool BytesWereRead(int32_t num_bytes) {
-  return (num_bytes > 0);
-}
-
-nacl_abi_size_t CastToNaClAbiSize(int32_t result) {
-  return static_cast<nacl_abi_size_t>(result);
-}
-
-// Data structure used on the browser side to invoke a completion callback
-// on the plugin side.
-//
-// A plugin-side callback is proxied over to the browser side using
-// a |callback_id|. This id is then paired with an |srpc_channel| listened to
-// by the nexe that supplied the callback.
-//
-// |read_buffer| is used with callbacks that are invoked on byte reads.
-// |check_result_func| is a pointer to a function used to check the
-// result of the operation.  The semantics of the result value may be different
-// depending on how the callback operation was initiated, and
-// |check_result_func| provides an abstraction to the semantics.
-// |get_size_read_func| is a pointer to a function used to get the
-// number of bytes read.  The way the number of bytes read
-// retrieved/calculated may be different depending on how the callback was
-// initiated, and |get_size_read_func| provides the indirection.
-struct RemoteCallbackInfo {
-  NaClSrpcChannel* srpc_channel;
-  int32_t callback_id;
-  char* read_buffer;
-  PP_Var read_var;
-  CheckResultFunc check_result_func;
-  GetReadSizeFunc get_size_read_func;
-};
-
-// Calls the remote implementation of a callback on the plugin side.
-// Implements a PP_CompletionCallback_Func type that can be used along with an
-// instance of a RemoteCallbackInfo as |user_data| to provide a
-// PP_CompletionCallback to browser functions.
-//
-// |remote_callback| is a pointer to a RemoteCallbackInfo,
-// deleted after rpc via scoped_ptr. The associated |read_buffer| is also
-// deleted.
-// |result| is passed by the callback invoker to indicate success or error.
-// It is passed as-is to the plugin side callback.
-void RunRemoteCallback(void* user_data, int32_t result) {
-  CHECK(PPBCoreInterface()->IsMainThread());
-  DebugPrintf("RunRemoteCallback: result=%"NACL_PRId32"\n", result);
-  nacl::scoped_ptr<RemoteCallbackInfo> remote_callback(
-      reinterpret_cast<RemoteCallbackInfo*>(user_data));
-  nacl::scoped_array<char> read_buffer(remote_callback->read_buffer);
-
-  // If the proxy is down, the channel is no longer usable for remote calls.
-  PP_Instance instance =
-      LookupInstanceIdForSrpcChannel(remote_callback->srpc_channel);
-  if (LookupBrowserPppForInstance(instance) == NULL) {
-    DebugPrintf("RunRemoteCallback: proxy=NULL\n", result);
-    return;
-  }
-
-  nacl_abi_size_t read_buffer_size = 0;
-  CheckResultFunc check_result_func = remote_callback->check_result_func;
-  GetReadSizeFunc get_size_read_func = remote_callback->get_size_read_func;
-  if ((*check_result_func)(result) && remote_callback->read_buffer != NULL)
-    read_buffer_size = (*get_size_read_func)(result);
-  if (remote_callback->read_var.type != PP_VARTYPE_NULL) {
-    read_buffer_size = kMaxReturnVarSize;
-    read_buffer.reset(
-        Serialize(&remote_callback->read_var, 1, &read_buffer_size));
-    PPBVarInterface()->Release(remote_callback->read_var);
-  }
-
-  NaClSrpcError srpc_result =
-      CompletionCallbackRpcClient::RunCompletionCallback(
-          remote_callback->srpc_channel,
-          remote_callback->callback_id,
-          result,
-          read_buffer_size,
-          read_buffer.get());
-  DebugPrintf("RunRemoteCallback: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_INTERNAL)
-    CleanUpAfterDeadNexe(instance);
-}
-
-}  // namespace
-
-// Builds a RemoteCallbackInfo and returns PP_CompletionCallback corresponding
-// to RunRemoteCallback or NULL on failure.
-struct PP_CompletionCallback MakeRemoteCompletionCallback(
-    NaClSrpcChannel* srpc_channel,
-    int32_t callback_id,
-    int32_t bytes_to_read,
-    char** buffer,
-    PP_Var** var,
-    CheckResultFunc check_result_func,
-    GetReadSizeFunc get_size_read_func) {
-  nacl::scoped_ptr<RemoteCallbackInfo> remote_callback(
-      new(std::nothrow) RemoteCallbackInfo);
-  if (remote_callback.get() == NULL)  // new failed.
-    return PP_BlockUntilComplete();
-  remote_callback->srpc_channel = srpc_channel;
-  remote_callback->callback_id = callback_id;
-  remote_callback->read_buffer = NULL;
-  remote_callback->read_var = PP_MakeNull();
-  remote_callback->check_result_func = check_result_func;
-  remote_callback->get_size_read_func = get_size_read_func;
-
-  if (bytes_to_read > 0 && buffer != NULL) {
-    *buffer = new(std::nothrow) char[bytes_to_read];
-    if (*buffer == NULL)  // new failed.
-      return PP_BlockUntilComplete();
-    remote_callback->read_buffer = *buffer;
-  }
-  if (var)
-    *var = &remote_callback->read_var;
-
-  return PP_MakeOptionalCompletionCallback(
-      RunRemoteCallback, remote_callback.release());
-}
-
-struct PP_CompletionCallback MakeRemoteCompletionCallback(
-    NaClSrpcChannel* srpc_channel,
-    int32_t callback_id,
-    int32_t bytes_to_read,
-    char** buffer,
-    CheckResultFunc check_result_func,
-    GetReadSizeFunc get_size_read_func) {
-  return MakeRemoteCompletionCallback(srpc_channel, callback_id, bytes_to_read,
-                                      buffer, NULL, check_result_func,
-                                      get_size_read_func);
-}
-
-struct PP_CompletionCallback MakeRemoteCompletionCallback(
-    NaClSrpcChannel* srpc_channel,
-    int32_t callback_id,
-    int32_t bytes_to_read,
-    char** buffer) {
-  return MakeRemoteCompletionCallback(srpc_channel, callback_id, bytes_to_read,
-                                      buffer, BytesWereRead, CastToNaClAbiSize);
-}
-
-struct PP_CompletionCallback MakeRemoteCompletionCallback(
-    NaClSrpcChannel* srpc_channel,
-    int32_t callback_id,
-    PP_Var** var) {
-  return MakeRemoteCompletionCallback(srpc_channel, callback_id, 0, NULL, var,
-                                      BytesWereRead, CastToNaClAbiSize);
-}
-
-struct PP_CompletionCallback MakeRemoteCompletionCallback(
-    NaClSrpcChannel* srpc_channel,
-    int32_t callback_id) {
-  return MakeRemoteCompletionCallback(srpc_channel, callback_id, 0, NULL);
-}
-
-void DeleteRemoteCallbackInfo(struct PP_CompletionCallback callback) {
-  nacl::scoped_ptr<RemoteCallbackInfo> remote_callback(
-      reinterpret_cast<RemoteCallbackInfo*>(callback.user_data));
-  nacl::scoped_array<char> read_buffer(remote_callback->read_buffer);
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_callback.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_callback.h
deleted file mode 100644
index e4a133b..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_callback.h
+++ /dev/null
@@ -1,65 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_CALLBACK_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_CALLBACK_H_
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/trusted/service_runtime/include/machine/_types.h"
-
-struct NaClSrpcChannel;
-struct PP_CompletionCallback;
-struct PP_Var;
-
-namespace ppapi_proxy {
-
-// Pointer to function to evaluate the result of a read operation.
-typedef bool (*CheckResultFunc)(int32_t result);
-// Pointer to function to retrieve/calculate the size read.
-typedef nacl_abi_size_t (*GetReadSizeFunc)(int32_t result);
-
-// Returns a PP_CompletionCallback that will call the remote implementation of
-// a callback by |callback_id| on the plugin side on |srpc_channel|.
-// This callback allows for optimized synchronous completion.
-// Allocates data that will be deleted by the underlying callback function.
-// Returns NULL callback on failure.
-struct PP_CompletionCallback MakeRemoteCompletionCallback(
-    NaClSrpcChannel* srpc_channel,
-    int32_t callback_id);
-struct PP_CompletionCallback MakeRemoteCompletionCallback(
-    NaClSrpcChannel* srpc_channel,
-    int32_t callback_id,
-     // For callbacks invoked on a byte read.
-    int32_t bytes_to_read,
-    char** buffer);
-struct PP_CompletionCallback MakeRemoteCompletionCallback(
-    NaClSrpcChannel* srpc_channel,
-    int32_t callback_id,
-     // For callbacks invoked on a byte read.
-    int32_t bytes_to_read,
-    char** buffer,
-    CheckResultFunc check_result,
-    GetReadSizeFunc get_size_read_func);
-struct PP_CompletionCallback MakeRemoteCompletionCallback(
-    NaClSrpcChannel* srpc_channel,
-    int32_t callback_id,
-    // For callbacks invoked on PP_Var read.
-    PP_Var** var);
-struct PP_CompletionCallback MakeRemoteCompletionCallback(
-    NaClSrpcChannel* srpc_channel,
-    int32_t callback_id,
-     // For callbacks invoked on a byte read.
-    int32_t bytes_to_read,
-    char** buffer,
-    PP_Var** var,
-    CheckResultFunc check_result,
-    GetReadSizeFunc get_size_read_func);
-
-// If the callback won't be called, use this to clean up the data from
-// the function above.
-void DeleteRemoteCallbackInfo(struct PP_CompletionCallback callback);
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_CALLBACK_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc
deleted file mode 100644
index 8589cdb..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc
+++ /dev/null
@@ -1,491 +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 "native_client/src/shared/ppapi_proxy/browser_globals.h"
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <map>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "native_client/src/trusted/plugin/plugin.h"
-#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
-#include "ppapi/c/dev/ppb_opengles2ext_dev.h"
-#include "ppapi/c/ppb_graphics_3d.h"
-#include "ppapi/c/ppb_opengles2.h"
-#include "ppapi/c/trusted/ppb_graphics_3d_trusted.h"
-
-namespace ppapi_proxy {
-
-// All of these methods are called from the browser main (UI, JavaScript, ...)
-// thread.
-
-const PP_Resource kInvalidResourceId = 0;
-
-namespace {
-
-std::map<PP_Instance, BrowserPpp*>* instance_to_ppp_map = NULL;
-
-// In the future, we might have one sel_ldr with one channel per module, shared
-// by multiple instances, where each instance consists of a trusted plugin with
-// a proxy to a nexe. When this happens, we will need to provide the instance id
-// with each SRPC message. But in the meantime it is enough to map channels
-// to instances since each proxy has its own SRPC channel.
-std::map<NaClSrpcChannel*, PP_Module>* channel_to_module_id_map = NULL;
-std::map<NaClSrpcChannel*, PP_Instance>* channel_to_instance_id_map = NULL;
-
-// The function pointer from the browser, and whether or not the plugin
-// is requesting PPAPI Dev interfaces to be available.
-// Set by SetPPBGetInterface().
-PPB_GetInterface get_interface = NULL;
-bool enable_dev_interfaces = false;
-
-// Whether Pepper 3D interfaces should be enabled.
-bool enable_3d_interfaces = true;
-
-}  // namespace
-
-void SetBrowserPppForInstance(PP_Instance instance, BrowserPpp* browser_ppp) {
-  // If there was no map, create one.
-  if (NULL == instance_to_ppp_map) {
-    instance_to_ppp_map = new std::map<PP_Instance, BrowserPpp*>;
-  }
-  // Add the instance to the map.
-  (*instance_to_ppp_map)[instance] = browser_ppp;
-}
-
-void UnsetBrowserPppForInstance(PP_Instance instance) {
-  if (NULL == instance_to_ppp_map) {
-    // Something major is wrong here.  We are deleting a map entry
-    // when there is no map.
-    NACL_NOTREACHED();
-    return;
-  }
-  // Erase the instance from the map.
-  instance_to_ppp_map->erase(instance);
-  // If there are no more instances alive, remove the map.
-  if (instance_to_ppp_map->size() == 0) {
-    delete instance_to_ppp_map;
-    instance_to_ppp_map = NULL;
-  }
-}
-
-BrowserPpp* LookupBrowserPppForInstance(PP_Instance instance) {
-  if (NULL == instance_to_ppp_map) {
-    return NULL;
-  }
-  std::map<PP_Instance, BrowserPpp*>::const_iterator iter =
-    instance_to_ppp_map->find(instance);
-  if (iter == instance_to_ppp_map->end())
-    return NULL;
-  return iter->second;
-}
-
-void SetModuleIdForSrpcChannel(NaClSrpcChannel* channel, PP_Module module_id) {
-  // If there was no map, create one.
-  if (NULL == channel_to_module_id_map) {
-    channel_to_module_id_map = new std::map<NaClSrpcChannel*, PP_Module>;
-  }
-  // Add the channel to the map.
-  (*channel_to_module_id_map)[channel] = module_id;
-}
-
-void SetInstanceIdForSrpcChannel(NaClSrpcChannel* channel,
-                                 PP_Instance instance_id) {
-  if (NULL == channel_to_instance_id_map) {
-    channel_to_instance_id_map = new std::map<NaClSrpcChannel*, PP_Instance>;
-  }
-  (*channel_to_instance_id_map)[channel] = instance_id;
-}
-
-void UnsetModuleIdForSrpcChannel(NaClSrpcChannel* channel) {
-  if (NULL == channel_to_module_id_map) {
-    // Something major is wrong here.  We are deleting a map entry
-    // when there is no map.
-    NACL_NOTREACHED();
-    return;
-  }
-  // Erase the channel from the map.
-  channel_to_module_id_map->erase(channel);
-  // If there are no more channels alive, remove the map.
-  if (channel_to_module_id_map->size() == 0) {
-    delete channel_to_module_id_map;
-    channel_to_module_id_map = NULL;
-  }
-}
-
-void UnsetInstanceIdForSrpcChannel(NaClSrpcChannel* channel) {
-  if (NULL == channel_to_instance_id_map) {
-    NACL_NOTREACHED();
-    return;
-  }
-  channel_to_instance_id_map->erase(channel);
-  if (channel_to_instance_id_map->size() == 0) {
-    delete channel_to_module_id_map;
-    channel_to_module_id_map = NULL;
-  }
-}
-
-PP_Module LookupModuleIdForSrpcChannel(NaClSrpcChannel* channel) {
-  if (NULL == channel_to_module_id_map) {
-    return 0;
-  }
-  std::map<NaClSrpcChannel*, PP_Module>::const_iterator iter =
-    channel_to_module_id_map->find(channel);
-  if (iter == channel_to_module_id_map->end()) {
-    return 0;
-  }
-  return iter->second;
-}
-
-PP_Instance LookupInstanceIdForSrpcChannel(NaClSrpcChannel* channel) {
-  if (NULL == channel_to_instance_id_map) {
-    return 0;
-  }
-  std::map<NaClSrpcChannel*, PP_Instance>::const_iterator iter =
-    channel_to_instance_id_map->find(channel);
-  if (iter == channel_to_instance_id_map->end()) {
-    return 0;
-  }
-  return iter->second;
-}
-
-NaClSrpcChannel* GetMainSrpcChannel(NaClSrpcRpc* upcall_rpc) {
-  // The upcall channel's server_instance_data member is initialized to point
-  // to the main channel for this instance.  Here it is retrieved to use in
-  // constructing a RemoteCallbackInfo.
-  return static_cast<NaClSrpcChannel*>(
-      upcall_rpc->channel->server_instance_data);
-}
-
-NaClSrpcChannel* GetMainSrpcChannel(PP_Instance instance) {
-  BrowserPpp* proxy = LookupBrowserPppForInstance(instance);
-  if (NULL == proxy)
-    return NULL;
-  return proxy->main_channel();
-}
-
-void CleanUpAfterDeadNexe(PP_Instance instance) {
-  DebugPrintf("CleanUpAfterDeadNexe\n");
-  BrowserPpp* proxy = LookupBrowserPppForInstance(instance);
-  if (NULL == proxy)
-    return;
-  proxy->plugin()->ReportDeadNexe();  // Shuts down and deletes the proxy.
-}
-
-void SetPPBGetInterface(PPB_GetInterface get_interface_function,
-                        bool allow_dev_interfaces,
-                        bool allow_3d_interfaces) {
-  get_interface = get_interface_function;
-  enable_dev_interfaces = allow_dev_interfaces;
-  enable_3d_interfaces = allow_3d_interfaces;
-}
-
-const void* GetBrowserInterface(const char* interface_name) {
-  // Reject suspiciously long interface strings.
-  const size_t kMaxLength = 1024;
-  if (NULL == memchr(interface_name, '\0', kMaxLength)) {
-    return NULL;
-  }
-  // If dev interface is not enabled, reject interfaces containing "(Dev)"
-  if (!enable_dev_interfaces && strstr(interface_name, "(Dev)") != NULL) {
-    return NULL;
-  }
-  if (!enable_3d_interfaces) {
-    static const char* disabled_interface_names[] = {
-      PPB_GRAPHICS_3D_INTERFACE,
-      PPB_GRAPHICS_3D_TRUSTED_INTERFACE,
-      PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE,
-      PPB_OPENGLES2_INTERFACE,
-      PPB_OPENGLES2_INSTANCEDARRAYS_INTERFACE,
-      PPB_OPENGLES2_FRAMEBUFFERBLIT_INTERFACE,
-      PPB_OPENGLES2_FRAMEBUFFERMULTISAMPLE_INTERFACE,
-      PPB_OPENGLES2_CHROMIUMENABLEFEATURE_INTERFACE,
-      PPB_OPENGLES2_CHROMIUMMAPSUB_INTERFACE,
-      PPB_OPENGLES2_QUERY_INTERFACE
-    };
-    for (size_t i = 0; i < NACL_ARRAY_SIZE(disabled_interface_names); i++) {
-      if (strcmp(interface_name, disabled_interface_names[i]) == 0)
-        return NULL;
-    }
-  }
-  return (*get_interface)(interface_name);
-}
-
-const void* GetBrowserInterfaceSafe(const char* interface_name) {
-  const void* ppb_interface = GetBrowserInterface(interface_name);
-  if (NULL == ppb_interface)
-    DebugPrintf("PPB_GetInterface: %s not found\n", interface_name);
-  CHECK(NULL != ppb_interface);
-  return ppb_interface;
-}
-
-const PPB_Core* PPBCoreInterface() {
-  static const PPB_Core* ppb = static_cast<const PPB_Core*>(
-      GetBrowserInterfaceSafe(PPB_CORE_INTERFACE));
-  return ppb;
-}
-
-const PPB_Graphics2D* PPBGraphics2DInterface() {
-  static const PPB_Graphics2D* ppb = static_cast<const PPB_Graphics2D*>(
-      GetBrowserInterfaceSafe(PPB_GRAPHICS_2D_INTERFACE));
-  return ppb;
-}
-
-const PPB_Graphics3D* PPBGraphics3DInterface() {
-  static const PPB_Graphics3D* ppb = static_cast<const PPB_Graphics3D*>(
-      GetBrowserInterfaceSafe(PPB_GRAPHICS_3D_INTERFACE));
-  return ppb;
-}
-
-const PPB_Graphics3DTrusted* PPBGraphics3DTrustedInterface() {
-  static const PPB_Graphics3DTrusted* ppb =
-      static_cast<const PPB_Graphics3DTrusted*>(
-          GetBrowserInterfaceSafe(PPB_GRAPHICS_3D_TRUSTED_INTERFACE));
-  return ppb;
-}
-
-const PPB_HostResolver_Private* PPBHostResolverPrivateInterface() {
-  static const PPB_HostResolver_Private* ppb =
-      static_cast<const PPB_HostResolver_Private*>(
-          GetBrowserInterfaceSafe(PPB_HOSTRESOLVER_PRIVATE_INTERFACE));
-  return ppb;
-}
-
-const PPB_ImageData* PPBImageDataInterface() {
-  static const PPB_ImageData* ppb = static_cast<const PPB_ImageData*>(
-      GetBrowserInterfaceSafe(PPB_IMAGEDATA_INTERFACE));
-  return ppb;
-}
-
-const PPB_ImageDataTrusted* PPBImageDataTrustedInterface() {
-  static const PPB_ImageDataTrusted* ppb =
-      static_cast<const PPB_ImageDataTrusted*>(
-      GetBrowserInterfaceSafe(PPB_IMAGEDATA_TRUSTED_INTERFACE));
-  return ppb;
-}
-
-const PPB_InputEvent* PPBInputEventInterface() {
-  static const PPB_InputEvent* ppb = static_cast<const PPB_InputEvent*>(
-      GetBrowserInterfaceSafe(PPB_INPUT_EVENT_INTERFACE));
-  return ppb;
-}
-
-const PPB_Instance* PPBInstanceInterface() {
-  static const PPB_Instance* ppb = static_cast<const PPB_Instance*>(
-      GetBrowserInterfaceSafe(PPB_INSTANCE_INTERFACE));
-  return ppb;
-}
-
-const PPB_KeyboardInputEvent* PPBKeyboardInputEventInterface() {
-  static const PPB_KeyboardInputEvent* ppb =
-      static_cast<const PPB_KeyboardInputEvent*>(
-          GetBrowserInterfaceSafe(PPB_KEYBOARD_INPUT_EVENT_INTERFACE));
-  return ppb;
-}
-
-const PPB_Memory_Dev* PPBMemoryInterface() {
-  static const PPB_Memory_Dev* ppb = static_cast<const PPB_Memory_Dev*>(
-      GetBrowserInterfaceSafe(PPB_MEMORY_DEV_INTERFACE));
-  return ppb;
-}
-
-const PPB_Messaging* PPBMessagingInterface() {
-  static const PPB_Messaging* ppb =
-      static_cast<const PPB_Messaging*>(
-          GetBrowserInterfaceSafe(PPB_MESSAGING_INTERFACE));
-  return ppb;
-}
-
-const PPB_MouseInputEvent* PPBMouseInputEventInterface() {
-  static const PPB_MouseInputEvent* ppb =
-      static_cast<const PPB_MouseInputEvent*>(
-          GetBrowserInterfaceSafe(PPB_MOUSE_INPUT_EVENT_INTERFACE));
-  return ppb;
-}
-
-const PPB_NetAddress_Private* PPBNetAddressPrivateInterface() {
-  static const PPB_NetAddress_Private* ppb =
-      static_cast<const PPB_NetAddress_Private*>(
-          GetBrowserInterfaceSafe(PPB_NETADDRESS_PRIVATE_INTERFACE));
-  return ppb;
-}
-
-const PPB_NetworkList_Private* PPBNetworkListPrivateInterface() {
-  static const PPB_NetworkList_Private* ppb =
-      static_cast<const PPB_NetworkList_Private*>(
-          GetBrowserInterfaceSafe(PPB_NETWORKLIST_PRIVATE_INTERFACE));
-  return ppb;
-}
-
-const PPB_NetworkMonitor_Private* PPBNetworkMonitorPrivateInterface() {
-  static const PPB_NetworkMonitor_Private* ppb =
-      static_cast<const PPB_NetworkMonitor_Private*>(
-          GetBrowserInterfaceSafe(PPB_NETWORKMONITOR_PRIVATE_INTERFACE));
-  return ppb;
-}
-
-const PPB_URLLoader* PPBURLLoaderInterface() {
-  static const PPB_URLLoader* ppb =
-      static_cast<const PPB_URLLoader*>(
-          GetBrowserInterfaceSafe(PPB_URLLOADER_INTERFACE));
-  return ppb;
-}
-
-const PPB_URLRequestInfo* PPBURLRequestInfoInterface() {
-  static const PPB_URLRequestInfo* ppb =
-      static_cast<const PPB_URLRequestInfo*>(
-          GetBrowserInterfaceSafe(PPB_URLREQUESTINFO_INTERFACE));
-  return ppb;
-}
-
-const PPB_URLResponseInfo* PPBURLResponseInfoInterface() {
-  static const PPB_URLResponseInfo* ppb =
-      static_cast<const PPB_URLResponseInfo*>(
-          GetBrowserInterfaceSafe(PPB_URLRESPONSEINFO_INTERFACE));
-  return ppb;
-}
-
-const PPB_Var* PPBVarInterface() {
-  static const PPB_Var* ppb =
-      static_cast<const PPB_Var*>(
-          GetBrowserInterfaceSafe(PPB_VAR_INTERFACE));
-  return ppb;
-}
-
-const PPB_VarArrayBuffer* PPBVarArrayBufferInterface() {
-  static const PPB_VarArrayBuffer* ppb =
-      static_cast<const PPB_VarArrayBuffer*>(
-          GetBrowserInterfaceSafe(PPB_VAR_ARRAY_BUFFER_INTERFACE));
-  return ppb;
-}
-
-const PPB_WheelInputEvent* PPBWheelInputEventInterface() {
-  static const PPB_WheelInputEvent* ppb =
-      static_cast<const PPB_WheelInputEvent*>(
-          GetBrowserInterfaceSafe(PPB_WHEEL_INPUT_EVENT_INTERFACE));
-  return ppb;
-}
-
-// Dev interfaces.
-const PPB_FileIO* PPBFileIOInterface() {
-  static const PPB_FileIO* ppb =
-      static_cast<const PPB_FileIO*>(
-        GetBrowserInterfaceSafe(PPB_FILEIO_INTERFACE));
-  return ppb;
-}
-
-const PPB_FileRef* PPBFileRefInterface() {
-  static const PPB_FileRef* ppb =
-      static_cast<const PPB_FileRef*>(
-        GetBrowserInterfaceSafe(PPB_FILEREF_INTERFACE));
-  return ppb;
-}
-
-const PPB_FileSystem* PPBFileSystemInterface() {
-  static const PPB_FileSystem* ppb =
-      static_cast<const PPB_FileSystem*>(
-        GetBrowserInterfaceSafe(PPB_FILESYSTEM_INTERFACE));
-  return ppb;
-}
-
-const PPB_Find_Dev* PPBFindInterface() {
-  static const PPB_Find_Dev* ppb =
-      static_cast<const PPB_Find_Dev*>(
-        GetBrowserInterfaceSafe(PPB_FIND_DEV_INTERFACE));
-  return ppb;
-}
-
-const PPB_Font_Dev* PPBFontInterface() {
-  static const PPB_Font_Dev* ppb =
-      static_cast<const PPB_Font_Dev*>(
-        GetBrowserInterfaceSafe(PPB_FONT_DEV_INTERFACE));
-  return ppb;
-}
-
-const PPB_Fullscreen* PPBFullscreenInterface() {
-  static const PPB_Fullscreen* ppb =
-      static_cast<const PPB_Fullscreen*>(
-        GetBrowserInterfaceSafe(PPB_FULLSCREEN_INTERFACE));
-  return ppb;
-}
-
-const PPB_Gamepad* PPBGamepadInterface() {
-  static const PPB_Gamepad* ppb =
-      static_cast<const PPB_Gamepad*>(
-          GetBrowserInterfaceSafe(PPB_GAMEPAD_INTERFACE));
-  return ppb;
-}
-
-const PPB_MouseCursor_1_0* PPBMouseCursorInterface() {
-  static const PPB_MouseCursor_1_0* ppb =
-      static_cast<const PPB_MouseCursor_1_0*>(
-          GetBrowserInterfaceSafe(PPB_MOUSECURSOR_INTERFACE_1_0));
-  return ppb;
-}
-
-const PPB_MouseLock* PPBMouseLockInterface() {
-  static const PPB_MouseLock* ppb = static_cast<const PPB_MouseLock*>(
-      GetBrowserInterfaceSafe(PPB_MOUSELOCK_INTERFACE));
-  return ppb;
-}
-
-const PPB_Testing_Dev* PPBTestingInterface() {
-  static const PPB_Testing_Dev* ppb =
-      static_cast<const PPB_Testing_Dev*>(
-          GetBrowserInterfaceSafe(PPB_TESTING_DEV_INTERFACE));
-  return ppb;
-}
-
-const PPB_View* PPBViewInterface() {
-  static const PPB_View* ppb =
-      static_cast<const PPB_View*>(
-          GetBrowserInterfaceSafe(PPB_VIEW_INTERFACE));
-  return ppb;
-}
-
-const PPB_WebSocket* PPBWebSocketInterface() {
-  static const PPB_WebSocket* ppb =
-      static_cast<const PPB_WebSocket*>(
-          GetBrowserInterfaceSafe(PPB_WEBSOCKET_INTERFACE));
-  return ppb;
-}
-
-const PPB_Zoom_Dev* PPBZoomInterface() {
-  static const PPB_Zoom_Dev* ppb =
-      static_cast<const PPB_Zoom_Dev*>(
-          GetBrowserInterfaceSafe(PPB_ZOOM_DEV_INTERFACE));
-  return ppb;
-}
-
-// Private interfaces.
-const PPB_TCPServerSocket_Private* PPBTCPServerSocketPrivateInterface() {
-  static const PPB_TCPServerSocket_Private* ppb =
-      static_cast<const PPB_TCPServerSocket_Private*>(
-          GetBrowserInterfaceSafe(PPB_TCPSERVERSOCKET_PRIVATE_INTERFACE));
-  return ppb;
-}
-
-const PPB_TCPSocket_Private* PPBTCPSocketPrivateInterface() {
-  static const PPB_TCPSocket_Private* ppb =
-      static_cast<const PPB_TCPSocket_Private*>(
-          GetBrowserInterfaceSafe(PPB_TCPSOCKET_PRIVATE_INTERFACE));
-  return ppb;
-}
-
-const PPB_UDPSocket_Private* PPBUDPSocketPrivateInterface() {
-  static const PPB_UDPSocket_Private* ppb =
-      static_cast<const PPB_UDPSocket_Private*>(
-          GetBrowserInterfaceSafe(PPB_UDPSOCKET_PRIVATE_INTERFACE));
-  return ppb;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h
deleted file mode 100644
index d103bd8..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h
+++ /dev/null
@@ -1,147 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_GLOBALS_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_GLOBALS_H_
-
-#include "ppapi/c/dev/ppb_find_dev.h"
-#include "ppapi/c/dev/ppb_font_dev.h"
-#include "ppapi/c/dev/ppb_memory_dev.h"
-#include "ppapi/c/dev/ppb_testing_dev.h"
-#include "ppapi/c/dev/ppb_zoom_dev.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/ppb.h"
-#include "ppapi/c/ppb_core.h"
-#include "ppapi/c/ppb_file_io.h"
-#include "ppapi/c/ppb_file_ref.h"
-#include "ppapi/c/ppb_file_system.h"
-#include "ppapi/c/ppb_fullscreen.h"
-#include "ppapi/c/ppb_gamepad.h"
-#include "ppapi/c/ppb_graphics_2d.h"
-#include "ppapi/c/ppb_graphics_3d.h"
-#include "ppapi/c/ppb_image_data.h"
-#include "ppapi/c/ppb_input_event.h"
-#include "ppapi/c/ppb_instance.h"
-#include "ppapi/c/ppb_messaging.h"
-#include "ppapi/c/ppb_mouse_cursor.h"
-#include "ppapi/c/ppb_mouse_lock.h"
-#include "ppapi/c/ppb_url_loader.h"
-#include "ppapi/c/ppb_url_request_info.h"
-#include "ppapi/c/ppb_url_response_info.h"
-#include "ppapi/c/ppb_var.h"
-#include "ppapi/c/ppb_var_array_buffer.h"
-#include "ppapi/c/ppb_view.h"
-#include "ppapi/c/ppb_websocket.h"
-#include "ppapi/c/private/ppb_host_resolver_private.h"
-#include "ppapi/c/private/ppb_net_address_private.h"
-#include "ppapi/c/private/ppb_network_list_private.h"
-#include "ppapi/c/private/ppb_network_monitor_private.h"
-#include "ppapi/c/private/ppb_tcp_server_socket_private.h"
-#include "ppapi/c/private/ppb_tcp_socket_private.h"
-#include "ppapi/c/private/ppb_udp_socket_private.h"
-#include "ppapi/c/trusted/ppb_graphics_3d_trusted.h"
-#include "ppapi/c/trusted/ppb_image_data_trusted.h"
-
-struct NaClSrpcRpc;
-struct NaClSrpcChannel;
-
-namespace ppapi_proxy {
-
-// These functions handle the browser-side (trusted code) mapping of a browser
-// instance to instance-specific data, such as the SRPC communication channel.
-// These functions are called by the in-browser (trusted) plugin code, and are
-// always called from the main (foreground, UI, ...) thread. As such, they are
-// not thread-safe (they do not need to be).
-
-// BrowserPpp keeps browser side PPP_Instance specific information, such as the
-// channel used to talk to the instance.
-class BrowserPpp;
-
-// Associate a particular BrowserPpp with a PP_Instance value.  This allows the
-// browser side to look up information it needs to communicate with the stub.
-void SetBrowserPppForInstance(PP_Instance instance,
-                              BrowserPpp* browser_ppp);
-// When an instance is destroyed, this is called to remove the association, as
-// the stub will be destroyed by a call to Shutdown.
-void UnsetBrowserPppForInstance(PP_Instance instance);
-// Gets the BrowserPpp information remembered for a particular instance.
-BrowserPpp* LookupBrowserPppForInstance(PP_Instance instance);
-
-// To keep track of memory allocated by a particular module, we need to remember
-// the PP_Module corresponding to a particular NaClSrpcChannel*.
-void SetModuleIdForSrpcChannel(NaClSrpcChannel* channel, PP_Module module_id);
-// To call remote callbacks only when the proxy is up and running, we need to
-// remember the PP_Instance corresponding to a particular NaClSrpcChannel*.
-void SetInstanceIdForSrpcChannel(NaClSrpcChannel* channel,
-                                 PP_Instance instance_id);
-// Removes the association with a given channel.
-void UnsetModuleIdForSrpcChannel(NaClSrpcChannel* channel);
-void UnsetInstanceIdForSrpcChannel(NaClSrpcChannel* channel);
-// Looks up the association with a given channel.
-PP_Module LookupModuleIdForSrpcChannel(NaClSrpcChannel* channel);
-PP_Instance LookupInstanceIdForSrpcChannel(NaClSrpcChannel* channel);
-
-// Helpers for getting a pointer to the "main channel" for a specific nexe.
-NaClSrpcChannel* GetMainSrpcChannel(NaClSrpcRpc* upcall_rpc);
-NaClSrpcChannel* GetMainSrpcChannel(PP_Instance);
-
-// Invalidates the proxy and alerts the plugin about a dead nexe.
-void CleanUpAfterDeadNexe(PP_Instance instance);
-
-// Support for getting PPB_ browser interfaces.
-// Safe version CHECK's for NULL.
-void SetPPBGetInterface(PPB_GetInterface get_interface_function,
-                        bool allow_dev_interfaces,
-                        bool allow_3d_interfaces);
-const void* GetBrowserInterface(const char* interface_name);
-const void* GetBrowserInterfaceSafe(const char* interface_name);
-// Functions marked "shared" are to be provided by both the browser and the
-// plugin side of the proxy, so they can be used by the shared proxy code
-// under both trusted and untrusted compilation.
-const PPB_Core* PPBCoreInterface();  // shared
-const PPB_MouseCursor_1_0* PPBMouseCursorInterface();
-const PPB_FileIO* PPBFileIOInterface();
-const PPB_FileRef* PPBFileRefInterface();
-const PPB_FileSystem* PPBFileSystemInterface();
-const PPB_Find_Dev* PPBFindInterface();
-const PPB_Font_Dev* PPBFontInterface();
-const PPB_Fullscreen* PPBFullscreenInterface();
-const PPB_Gamepad* PPBGamepadInterface();
-const PPB_Graphics2D* PPBGraphics2DInterface();
-const PPB_Graphics3D* PPBGraphics3DInterface();
-const PPB_Graphics3DTrusted* PPBGraphics3DTrustedInterface();
-const PPB_HostResolver_Private* PPBHostResolverPrivateInterface();
-const PPB_ImageData* PPBImageDataInterface();
-const PPB_ImageDataTrusted* PPBImageDataTrustedInterface();
-const PPB_InputEvent* PPBInputEventInterface();
-const PPB_Instance* PPBInstanceInterface();
-const PPB_KeyboardInputEvent* PPBKeyboardInputEventInterface();
-const PPB_Memory_Dev* PPBMemoryInterface();  // shared
-const PPB_MouseInputEvent* PPBMouseInputEventInterface();
-const PPB_Messaging* PPBMessagingInterface();
-const PPB_MouseLock* PPBMouseLockInterface();
-const PPB_NetAddress_Private* PPBNetAddressPrivateInterface();
-const PPB_NetworkList_Private* PPBNetworkListPrivateInterface();
-const PPB_NetworkMonitor_Private* PPBNetworkMonitorPrivateInterface();
-const PPB_TCPServerSocket_Private* PPBTCPServerSocketPrivateInterface();
-const PPB_TCPSocket_Private* PPBTCPSocketPrivateInterface();
-const PPB_Testing_Dev* PPBTestingInterface();
-const PPB_UDPSocket_Private* PPBUDPSocketPrivateInterface();
-const PPB_URLLoader* PPBURLLoaderInterface();
-const PPB_URLRequestInfo* PPBURLRequestInfoInterface();
-const PPB_URLResponseInfo* PPBURLResponseInfoInterface();
-const PPB_Var* PPBVarInterface();  // shared
-const PPB_VarArrayBuffer* PPBVarArrayBufferInterface();  // shared
-const PPB_View* PPBViewInterface();
-const PPB_WheelInputEvent* PPBWheelInputEventInterface();
-const PPB_WebSocket* PPBWebSocketInterface();
-const PPB_Zoom_Dev* PPBZoomInterface();
-
-// PPAPI constants used in the proxy.
-extern const PP_Resource kInvalidResourceId;
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_GLOBALS_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_config_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_config_rpc_server.cc
deleted file mode 100644
index 205cbf9..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_config_rpc_server.cc
+++ /dev/null
@@ -1,181 +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.
-//
-// SRPC-abstraction wrappers around PPB_AudioConfig functions.
-
-#include "ppapi/c/ppb_audio_config.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-
-static const PPB_AudioConfig_1_0* GetAudioConfigInterface_1_0() {
-  static const PPB_AudioConfig_1_0* audio_config =
-      static_cast<const PPB_AudioConfig_1_0*>
-          (ppapi_proxy::GetBrowserInterface(PPB_AUDIO_CONFIG_INTERFACE_1_0));
-  return audio_config;
-}
-
-static const PPB_AudioConfig* GetAudioConfigInterface() {
-  static const PPB_AudioConfig* audio_config =
-      static_cast<const PPB_AudioConfig*>
-          (ppapi_proxy::GetBrowserInterface(PPB_AUDIO_CONFIG_INTERFACE));
-  return audio_config;
-}
-
-void PpbAudioConfigRpcServer::PPB_AudioConfig_CreateStereo16Bit(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    int32_t sample_rate,
-    int32_t sample_frame_count,
-    PP_Resource* resource) {
-  NaClSrpcClosureRunner runner(done);
-  const PPB_AudioConfig* audio_config = GetAudioConfigInterface();
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (NULL == audio_config) {
-    return;
-  }
-  if (NULL == resource) {
-    return;
-  }
-  *resource = audio_config->CreateStereo16Bit(
-      instance, static_cast<PP_AudioSampleRate>(sample_rate),
-      sample_frame_count);
-  DebugPrintf("PPB_AudioConfig::CreateStereo16Bit: resource=%"NACL_PRId32"\n",
-      *resource);
-  DebugPrintf(
-      "PPB_AudioConfig::CreateStereo16Bit: sample_rate=%"NACL_PRIu32"\n",
-      sample_rate);
-  DebugPrintf(
-      "PPB_AudioConfig::CreateStereo16Bit: frame_count=%"NACL_PRIu32"\n",
-      sample_frame_count);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-// Preserve old behavior for applications that request 1.0 interface.
-void PpbAudioConfigRpcServer::PPB_AudioConfig_RecommendSampleFrameCount_1_0(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    int32_t sample_rate,
-    int32_t request_sample_frame_count,
-    int32_t* sample_frame_count) {
-  NaClSrpcClosureRunner runner(done);
-  const PPB_AudioConfig_1_0* audio_config = GetAudioConfigInterface_1_0();
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (NULL == audio_config) {
-    return;
-  }
-  *sample_frame_count = audio_config->RecommendSampleFrameCount(
-      static_cast<PP_AudioSampleRate>(sample_rate),
-      request_sample_frame_count);
-  DebugPrintf("PPB_AudioConfig::RecommendSampleFrameCount_1_0: "
-              "sample_frame_count=%"NACL_PRId32"\n", *sample_frame_count);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbAudioConfigRpcServer::PPB_AudioConfig_RecommendSampleFrameCount(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    int32_t sample_rate,
-    int32_t request_sample_frame_count,
-    int32_t* sample_frame_count) {
-  NaClSrpcClosureRunner runner(done);
-  const PPB_AudioConfig* audio_config = GetAudioConfigInterface();
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (NULL == audio_config) {
-    return;
-  }
-  *sample_frame_count = audio_config->RecommendSampleFrameCount(
-      instance,
-      static_cast<PP_AudioSampleRate>(sample_rate),
-      request_sample_frame_count);
-  DebugPrintf("PPB_AudioConfig::RecommendSampleFrameCount: "
-              "sample_frame_count=%"NACL_PRId32"\n", *sample_frame_count);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbAudioConfigRpcServer::PPB_AudioConfig_IsAudioConfig(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  const PPB_AudioConfig* audio_config = GetAudioConfigInterface();
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (NULL == audio_config) {
-    return;
-  }
-  PP_Bool pp_success = audio_config->IsAudioConfig(resource);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_AudioConfig::IsAudioConfig: success=%d\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbAudioConfigRpcServer::PPB_AudioConfig_GetSampleRate(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t* sample_rate) {
-  NaClSrpcClosureRunner runner(done);
-  const PPB_AudioConfig* audio_config = GetAudioConfigInterface();
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (NULL == audio_config) {
-    return;
-  }
-  if (ppapi_proxy::kInvalidResourceId == resource) {
-    return;
-  }
-  if (NULL == sample_rate) {
-    return;
-  }
-  *sample_rate = audio_config->GetSampleRate(resource);
-  DebugPrintf("PPB_AudioConfig::GetSampleRate: pp_success=%"NACL_PRId32"\n",
-              *sample_rate);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbAudioConfigRpcServer::PPB_AudioConfig_GetSampleFrameCount(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t* sample_frame_count) {
-  NaClSrpcClosureRunner runner(done);
-  const PPB_AudioConfig* audio_config = GetAudioConfigInterface();
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (NULL == audio_config) {
-    return;
-  }
-  if (ppapi_proxy::kInvalidResourceId == resource) {
-    return;
-  }
-  if (NULL == sample_frame_count) {
-    return;
-  }
-  *sample_frame_count = audio_config->GetSampleFrameCount(resource);
-  DebugPrintf("PPB_AudioConfig::GetSampleFrameCount: "
-              "sample_frame_count=%"NACL_PRId32"\n", *sample_frame_count);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbAudioConfigRpcServer::PPB_AudioConfig_RecommendSampleRate(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    int32_t* sample_rate) {
-  NaClSrpcClosureRunner runner(done);
-  const PPB_AudioConfig* audio_config = GetAudioConfigInterface();
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (NULL == audio_config) {
-    return;
-  }
-  *sample_rate = audio_config->RecommendSampleRate(instance);
-  DebugPrintf("PPB_AudioConfig::RecommendSampleRate: "
-              "sample_rate=%"NACL_PRIu32"\n", *sample_rate);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_rpc_server.cc
deleted file mode 100644
index 4224a85..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_rpc_server.cc
+++ /dev/null
@@ -1,238 +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.
-//
-// SRPC-abstraction wrappers around PPB_Audio functions.
-
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/imc/nacl_imc.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/trusted/desc/nacl_desc_invalid.h"
-#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
-#include "media/audio/shared_memory_util.h"
-#include "ppapi/c/ppb_audio.h"
-#include "ppapi/c/ppb_audio_config.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/trusted/ppb_audio_trusted.h"
-#include "ppapi/cpp/completion_callback.h"
-#include "ppapi/cpp/core.h"
-#include "ppapi/cpp/module.h"
-#include "srpcgen/ppb_rpc.h"
-#include "srpcgen/ppp_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-
-namespace {
-
-const PPB_AudioTrusted* GetAudioTrustedInterface() {
-  DebugPrintf("GetAudioTrustedInterface\n");
-  static const PPB_AudioTrusted* audioTrusted =
-      static_cast<const PPB_AudioTrusted*>
-          (ppapi_proxy::GetBrowserInterface(PPB_AUDIO_TRUSTED_INTERFACE));
-  return audioTrusted;
-}
-
-const PPB_Audio* GetAudioInterface() {
-  DebugPrintf("GetAudioInterface\n");
-  static const PPB_Audio* audio =
-      static_cast<const PPB_Audio*>
-          (ppapi_proxy::GetBrowserInterface(PPB_AUDIO_INTERFACE));
-  return audio;
-}
-
-struct StreamCreatedCallbackData {
-  PP_Instance instance_id;
-  PP_Resource audio_id;
-  StreamCreatedCallbackData(PP_Instance i, PP_Resource a) :
-      instance_id(i),
-      audio_id(a) { }
-};
-
-// This completion callback will be invoked when the sync socket and shared
-// memory handles become available.
-void StreamCreatedCallback(void* user_data, int32_t result) {
-  DebugPrintf("StreamCreatedCallback: user_data=%p result=%"NACL_PRId32"\n",
-              user_data, result);
-  if (NULL == user_data) {
-    return;
-  }
-  nacl::scoped_ptr<StreamCreatedCallbackData> data(
-      static_cast<StreamCreatedCallbackData*>(user_data));
-  if (result < 0) {
-    return;
-  }
-  const PPB_AudioTrusted* audioTrusted = GetAudioTrustedInterface();
-  if (NULL == audioTrusted) {
-    return;
-  }
-  const int kInvalidIntHandle = int(nacl::kInvalidHandle);
-  int sync_socket_handle = kInvalidIntHandle;
-  int shared_memory_handle = kInvalidIntHandle;
-  uint32_t audio_buffer_size = 0;
-  if (PP_OK != audioTrusted->GetSyncSocket(data->audio_id,
-                                           &sync_socket_handle)) {
-    return;
-  }
-  if (kInvalidIntHandle == sync_socket_handle) {
-    return;
-  }
-  if (PP_OK != audioTrusted->GetSharedMemory(data->audio_id,
-                                             &shared_memory_handle,
-                                             &audio_buffer_size)) {
-    return;
-  }
-  if (kInvalidIntHandle == shared_memory_handle) {
-    return;
-  }
-  size_t total_shared_memory_size =
-      media::TotalSharedMemorySizeInBytes(audio_buffer_size);
-  nacl::DescWrapperFactory factory;
-  NaClHandle nacl_shm_handle = NaClHandle(shared_memory_handle);
-  NaClHandle nacl_sync_handle = NaClHandle(sync_socket_handle);
-  NaClHandle nacl_shm_dup_handle = NaClDuplicateNaClHandle(nacl_shm_handle);
-  if (nacl::kInvalidHandle == nacl_shm_dup_handle) {
-    return;
-  }
-  nacl::scoped_ptr<nacl::DescWrapper> shm_wrapper(factory.ImportShmHandle(
-      nacl_shm_dup_handle, total_shared_memory_size));
-  NaClHandle nacl_sync_dup_handle = NaClDuplicateNaClHandle(nacl_sync_handle);
-  if (nacl::kInvalidHandle == nacl_sync_dup_handle) {
-    return;
-  }
-  nacl::scoped_ptr<nacl::DescWrapper> socket_wrapper(
-      factory.ImportSyncSocketHandle(nacl_sync_dup_handle));
-  NaClDesc *nacl_shm = shm_wrapper->desc();
-  NaClDesc *nacl_socket = socket_wrapper->desc();
-  NaClSrpcChannel* nacl_srpc_channel = ppapi_proxy::GetMainSrpcChannel(
-      data->instance_id);
-  if (NULL == nacl_srpc_channel)
-    return;
-  static_cast<void>(PppAudioRpcClient::PPP_Audio_StreamCreated(
-      nacl_srpc_channel,
-      data->audio_id,
-      nacl_shm,
-      audio_buffer_size,
-      nacl_socket));
-}
-
-}  // namespace
-
-void PpbAudioRpcServer::PPB_Audio_Create(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    PP_Resource config,
-    PP_Resource* resource) {
-  DebugPrintf("PPB_Audio::Create: instance=%"NACL_PRId32" config=%"NACL_PRId32
-              "\n", instance, config);
-  NaClSrpcClosureRunner runner(done);
-  const PPB_AudioTrusted* audio = GetAudioTrustedInterface();
-  PP_CompletionCallback callback;
-  StreamCreatedCallbackData* data;
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (ppapi_proxy::kInvalidResourceId == config) {
-    return;
-  }
-  if (NULL == audio) {
-    return;
-  }
-  *resource = audio->CreateTrusted(instance);
-  DebugPrintf("PPB_Audio::Create: resource=%"NACL_PRId32"\n", *resource);
-  PP_Resource audio_id = *resource;
-  if (ppapi_proxy::kInvalidResourceId == audio_id) {
-    return;
-  }
-  data = new StreamCreatedCallbackData(instance, audio_id);
-  callback = PP_MakeOptionalCompletionCallback(StreamCreatedCallback, data);
-  int32_t pp_error = audio->Open(audio_id, config, callback);
-  DebugPrintf("PPB_Audio::Create: pp_error=%"NACL_PRId32"\n", pp_error);
-  // If the Open() call failed, pass failure code and explicitly
-  // invoke the completion callback, giving it a chance to release data.
-  if (pp_error != PP_OK_COMPLETIONPENDING) {
-    PP_RunCompletionCallback(&callback, pp_error);
-    return;
-  }
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbAudioRpcServer::PPB_Audio_StartPlayback(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t* success) {
-  DebugPrintf("PPB_Audio::StartPlayback: resource=%"NACL_PRId32"\n", resource);
-  NaClSrpcClosureRunner runner(done);
-  const PPB_Audio* audio = GetAudioInterface();
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (NULL == audio) {
-    *success = false;
-    return;
-  }
-  PP_Bool pp_success = audio->StartPlayback(resource);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_Audio::StartPlayback: success=%"NACL_PRId32"\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbAudioRpcServer::PPB_Audio_StopPlayback(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t* success) {
-  DebugPrintf("PPB_Audio::StopPlayback: resource=%"NACL_PRId32"\n", resource);
-  NaClSrpcClosureRunner runner(done);
-  const PPB_Audio* audio = GetAudioInterface();
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (NULL == audio) {
-    *success = false;
-    return;
-  }
-  PP_Bool pp_success = audio->StopPlayback(resource);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_Audio::StopPlayback: success=%"NACL_PRId32"\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbAudioRpcServer::PPB_Audio_IsAudio(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t* success) {
-  DebugPrintf("PPB_Audio::IsAudio: resource=%"NACL_PRId32"\n", resource);
-  NaClSrpcClosureRunner runner(done);
-  const PPB_Audio* audio = GetAudioInterface();
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (NULL == audio) {
-    *success = false;
-    return;
-  }
-  PP_Bool pp_success = audio->IsAudio(resource);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_Audio::IsAudio: success=%"NACL_PRId32"\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbAudioRpcServer::PPB_Audio_GetCurrentConfig(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    PP_Resource* config) {
-  DebugPrintf("PPB_Audio::GetCurrentConfig: resource=%"NACL_PRId32"\n",
-              resource);
-  NaClSrpcClosureRunner runner(done);
-  const PPB_Audio* audio = GetAudioInterface();
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (NULL == audio) {
-    return;
-  }
-  if (ppapi_proxy::kInvalidResourceId == resource) {
-    return;
-  }
-  *config = audio->GetCurrentConfig(resource);
-  DebugPrintf("PPB_Audio::GetCurrentConfig: config=%"NACL_PRId32"\n", *config);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_core_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_core_rpc_server.cc
deleted file mode 100644
index b35c315..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_core_rpc_server.cc
+++ /dev/null
@@ -1,120 +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.
-//
-// SRPC-abstraction wrappers around PPB_Core functions.
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "srpcgen/ppb_rpc.h"
-#include "srpcgen/upcall.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::PPBCoreInterface;
-using ppapi_proxy::MakeRemoteCompletionCallback;
-using ppapi_proxy::GetMainSrpcChannel;
-
-void PpbCoreRpcServer::PPB_Core_AddRefResource(NaClSrpcRpc* rpc,
-                                               NaClSrpcClosure* done,
-                                               PP_Resource resource) {
-  NaClSrpcClosureRunner runner(done);
-  PPBCoreInterface()->AddRefResource(resource);
-  DebugPrintf("PPB_Core::AddRefResource: resource=%"NACL_PRId32"\n", resource);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbCoreRpcServer::PPB_Core_ReleaseResource(NaClSrpcRpc* rpc,
-                                                NaClSrpcClosure* done,
-                                                PP_Resource resource) {
-  NaClSrpcClosureRunner runner(done);
-  PPBCoreInterface()->ReleaseResource(resource);
-  DebugPrintf("PPB_Core::ReleaseResource: resource=%"NACL_PRId32"\n",
-              resource);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-// MemAlloc and MemFree are handled locally to the plugin, and do not need a
-// browser stub.
-
-void PpbCoreRpcServer::PPB_Core_GetTime(NaClSrpcRpc* rpc,
-                                        NaClSrpcClosure* done,
-                                        double* time) {
-  NaClSrpcClosureRunner runner(done);
-  *time = PPBCoreInterface()->GetTime();
-  DebugPrintf("PPB_Core::GetTime: time=%f\n", *time);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbCoreRpcServer::PPB_Core_GetTimeTicks(NaClSrpcRpc* rpc,
-                                             NaClSrpcClosure* done,
-                                             double* time_ticks) {
-  NaClSrpcClosureRunner runner(done);
-  *time_ticks = PPBCoreInterface()->GetTimeTicks();
-  DebugPrintf("PPB_Core::GetTimeTicks: time_ticks=%f\n", *time_ticks);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-// Release multiple references at once.
-void PpbCoreRpcServer::ReleaseResourceMultipleTimes(NaClSrpcRpc* rpc,
-                                                    NaClSrpcClosure* done,
-                                                    PP_Resource resource,
-                                                    int32_t count) {
-  NaClSrpcClosureRunner runner(done);
-  while (count--)
-    PPBCoreInterface()->ReleaseResource(resource);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-// Invoked from main thread.
-void PpbCoreRpcServer::PPB_Core_CallOnMainThread(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    int32_t delay_in_milliseconds,
-    int32_t callback_id,
-    int32_t result) {
-  CHECK(PPBCoreInterface()->IsMainThread());
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id);
-  if (remote_callback.func == NULL)
-    return;  // Treat this as a generic SRPC error.
-
-  PPBCoreInterface()->CallOnMainThread(
-      delay_in_milliseconds, remote_callback, result);
-  DebugPrintf("PPB_Core::CallOnMainThread_main: "
-              "delay_in_milliseconds=%"NACL_PRId32"\n", delay_in_milliseconds);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-  // Invoked from upcall thread.
-void PppUpcallRpcServer::PPB_Core_CallOnMainThread(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    int32_t delay_in_milliseconds,
-    int32_t callback_id,
-    int32_t result) {
-  CHECK(!PPBCoreInterface()->IsMainThread());
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback_on_main =
-      MakeRemoteCompletionCallback(GetMainSrpcChannel(rpc), callback_id);
-  if (remote_callback_on_main.func == NULL)
-    return;  // Treat this as a generic SRPC error.
-
-  PPBCoreInterface()->CallOnMainThread(
-      delay_in_milliseconds, remote_callback_on_main, result);
-  DebugPrintf("PPB_Core::CallOnMainThread_upcall: "
-              "delay_in_milliseconds=%"NACL_PRId32"\n", delay_in_milliseconds);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-// IsMainThread is handled locally to the plugin, and does not need a browser
-// stub.
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_file_io_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_file_io_rpc_server.cc
deleted file mode 100644
index 16af9ce..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_file_io_rpc_server.cc
+++ /dev/null
@@ -1,309 +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 <string.h>
-#include <limits>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_file_info.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_file_io.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::DeleteRemoteCallbackInfo;
-using ppapi_proxy::MakeRemoteCompletionCallback;
-using ppapi_proxy::PPBFileIOInterface;
-
-void PpbFileIORpcServer::PPB_FileIO_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      // input
-      PP_Instance instance,
-      // output
-      PP_Resource* resource) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  *resource = PPBFileIOInterface()->Create(instance);
-  DebugPrintf("PPB_FileIO::Create: resource=%"NACL_PRId32"\n", *resource);
-}
-
-// TODO(sanga): Use a caching resource tracker instead of going over the proxy
-// to determine if the given resource is a file io.
-void PpbFileIORpcServer::PPB_FileIO_IsFileIO(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource resource,
-    // output
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  PP_Bool pp_success = PPBFileIOInterface()->IsFileIO(resource);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_FileIO::IsFileIO: success=%d\n", *success);
-}
-
-void PpbFileIORpcServer::PPB_FileIO_Open(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource file_io,
-    PP_Resource file_ref,
-    int32_t open_flags,
-    int32_t callback_id,
-    // output
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error = PPBFileIOInterface()->Open(
-      file_io,
-      file_ref,
-      open_flags,
-      remote_callback);
-  DebugPrintf("PPB_FileIO::Open: pp_error=%"NACL_PRId32"\n", *pp_error);
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)  // Async error.
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-namespace {
-
-bool IsResultPP_OK(int32_t result) {
-  return (result == PP_OK);
-}
-
-nacl_abi_size_t SizeOfPP_FileInfo(int32_t /*query_callback_result*/) {
-  return sizeof(PP_FileInfo);
-}
-
-}  // namespace
-
-void PpbFileIORpcServer::PPB_FileIO_Query(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_io,
-      int32_t bytes_to_read,
-      int32_t callback_id,
-      nacl_abi_size_t* info_bytes, char* info,
-      int32_t* pp_error) {
-  // Since PPB_FileIO::Query does not complete synchronously, and we use remote
-  // completion callback with completion callback table on the untrusted side
-  // (see browser_callback.h and plugin_callback.h), so the actual file info
-  // parameter is not used.
-  UNREFERENCED_PARAMETER(info);
-
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  // TODO(sanga): Drop bytes_to_read for parameters since it is not part of the
-  // interface, and just use the buffer size itself.
-  CHECK(bytes_to_read == sizeof(PP_FileInfo));
-  char* callback_buffer = NULL;
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id, bytes_to_read,
-                                   &callback_buffer, IsResultPP_OK,
-                                   SizeOfPP_FileInfo);
-  if (NULL == remote_callback.func)
-    return;
-
-  // callback_buffer has been assigned to a buffer on the heap, the size
-  // of PP_FileInfo.
-  PP_FileInfo* file_info = reinterpret_cast<PP_FileInfo*>(callback_buffer);
-  *pp_error = PPBFileIOInterface()->Query(file_io, file_info, remote_callback);
-  DebugPrintf("PPB_FileIO::Query: pp_error=%"NACL_PRId32"\n", *pp_error);
-  CHECK(*pp_error != PP_OK);  // Query should not complete synchronously
-
-  *info_bytes = 0;
-  if (*pp_error != PP_OK_COMPLETIONPENDING) {
-    DeleteRemoteCallbackInfo(remote_callback);
-  }
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFileIORpcServer::PPB_FileIO_Touch(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource file_io,
-    double last_access_time,
-    double last_modified_time,
-    int32_t callback_id,
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback = MakeRemoteCompletionCallback(
-      rpc->channel,
-      callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error = PPBFileIOInterface()->Touch(file_io, last_access_time,
-                                          last_modified_time, remote_callback);
-  DebugPrintf("PPB_FileIO::Touch: pp_error=%"NACL_PRId32"\n", *pp_error);
-  CHECK(*pp_error != PP_OK);  // Touch should not complete synchronously
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFileIORpcServer::PPB_FileIO_Read(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      // inputs
-      PP_Resource file_io,
-      int64_t offset,
-      int32_t bytes_to_read,
-      int32_t callback_id,
-      // outputs
-      nacl_abi_size_t* buffer_size,
-      char* buffer,
-      int32_t* pp_error_or_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  CHECK(*buffer_size <=
-        static_cast<nacl_abi_size_t>(std::numeric_limits<int32_t>::max()));
-  CHECK(*buffer_size == static_cast<nacl_abi_size_t>(bytes_to_read));
-
-  char* callback_buffer = NULL;
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id, bytes_to_read,
-                                   &callback_buffer);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error_or_bytes = PPBFileIOInterface()->Read(
-      file_io,
-      offset,
-      callback_buffer,
-      bytes_to_read,
-      remote_callback);
-  DebugPrintf("PPB_FileIO::Read: pp_error_or_bytes=%"NACL_PRId32"\n",
-              *pp_error_or_bytes);
-  CHECK(*pp_error_or_bytes <= bytes_to_read);
-
-  if (*pp_error_or_bytes > 0) {  // Bytes read into |callback_buffer|.
-    // No callback scheduled.
-    CHECK(static_cast<nacl_abi_size_t>(*pp_error_or_bytes) <= *buffer_size);
-    *buffer_size = static_cast<nacl_abi_size_t>(*pp_error_or_bytes);
-    memcpy(buffer, callback_buffer, *buffer_size);
-    DeleteRemoteCallbackInfo(remote_callback);
-  } else if (*pp_error_or_bytes != PP_OK_COMPLETIONPENDING) {  // Async error.
-    // No callback scheduled.
-    *buffer_size = 0;
-    DeleteRemoteCallbackInfo(remote_callback);
-  } else {
-    // Callback scheduled.
-    *buffer_size = 0;
-  }
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFileIORpcServer::PPB_FileIO_Write(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource file_io,
-    int64_t offset,
-    nacl_abi_size_t buffer_bytes, char* buffer,
-    int32_t bytes_to_write,
-    int32_t callback_id,
-    int32_t* pp_error_or_bytes) {
-  // TODO(sanga): Add comments for the parameters.
-
-  CHECK(buffer_bytes <=
-        static_cast<nacl_abi_size_t>(std::numeric_limits<int32_t>::max()));
-  CHECK(static_cast<nacl_abi_size_t>(bytes_to_write) <= buffer_bytes);
-
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback = MakeRemoteCompletionCallback(
-      rpc->channel, callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error_or_bytes = PPBFileIOInterface()->Write(file_io, offset, buffer,
-                                                   bytes_to_write,
-                                                   remote_callback);
-  DebugPrintf("PPB_FileIO::Write: pp_error_or_bytes=%"NACL_PRId32"\n",
-              *pp_error_or_bytes);
-
-  // Bytes must be written asynchronously.
-  if (*pp_error_or_bytes != PP_OK_COMPLETIONPENDING) {
-    DeleteRemoteCallbackInfo(remote_callback);
-  }
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFileIORpcServer::PPB_FileIO_SetLength(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource file_io,
-    int64_t length,
-    int32_t callback_id,
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback = MakeRemoteCompletionCallback(
-      rpc->channel, callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error = PPBFileIOInterface()->SetLength(file_io, length, remote_callback);
-  DebugPrintf("PPB_FileIO::SetLength: pp_error=%"NACL_PRId32"\n", *pp_error);
-  CHECK(*pp_error != PP_OK);  // SetLength should not complete synchronously
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFileIORpcServer::PPB_FileIO_Flush(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource file_io,
-    int32_t callback_id,
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback = MakeRemoteCompletionCallback(
-      rpc->channel, callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error = PPBFileIOInterface()->Flush(file_io, remote_callback);
-  DebugPrintf("PPB_FileIO::Flush: pp_error=%"NACL_PRId32"\n", *pp_error);
-  CHECK(*pp_error != PP_OK);  // Flush should not complete synchronously
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFileIORpcServer::PPB_FileIO_Close(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource file_io) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-  DebugPrintf("PPB_FileIO::Close: file_io=%"NACL_PRId32"\n", file_io);
-  PPBFileIOInterface()->Close(file_io);
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_file_ref_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_file_ref_rpc_server.cc
deleted file mode 100644
index 64d5503..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_file_ref_rpc_server.cc
+++ /dev/null
@@ -1,213 +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 "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_errors.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::DeleteRemoteCallbackInfo;
-using ppapi_proxy::MakeRemoteCompletionCallback;
-using ppapi_proxy::PPBFileRefInterface;
-using ppapi_proxy::SerializeTo;
-
-void PpbFileRefRpcServer::PPB_FileRef_Create(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource file_system,
-    nacl_abi_size_t path_size,
-    char* path_bytes,
-    PP_Resource* resource) {
-  UNREFERENCED_PARAMETER(path_size);
-
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  *resource = PPBFileRefInterface()->Create(file_system, path_bytes);
-  DebugPrintf("PPB_FileRef::Create: resource=%"NACL_PRId32"\n", *resource);
-}
-
-// TODO(sanga): Use a caching resource tracker instead of going over the proxy
-// to determine if the given resource is a file ref.
-void PpbFileRefRpcServer::PPB_FileRef_IsFileRef(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t* pp_success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  *pp_success = PPBFileRefInterface()->IsFileRef(resource);
-  DebugPrintf("PPB_FileRef::IsFileRef: pp_success=%d\n", *pp_success);
-}
-
-void PpbFileRefRpcServer::PPB_FileRef_GetFileSystemType(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource file_ref,
-    int32_t* file_system_type) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  *file_system_type = PPBFileRefInterface()->GetFileSystemType(file_ref);
-  DebugPrintf("PPB_FileRef::GetFileSystemType: file_system_type=%d\n",
-              file_system_type);
-}
-
-void PpbFileRefRpcServer::PPB_FileRef_GetName(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_ref,
-      nacl_abi_size_t* name_size,
-      char* name_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Var name = PPBFileRefInterface()->GetName(file_ref);
-  DebugPrintf("PPB_FileRef::GetName: name.type=%d\n", name.type);
-
-  if (SerializeTo(&name, name_bytes, name_size))
-    rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFileRefRpcServer::PPB_FileRef_GetPath(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_ref,
-      nacl_abi_size_t* path_size,
-      char* path_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Var path = PPBFileRefInterface()->GetPath(file_ref);
-  DebugPrintf("PPB_FileRef::GetName: path.type=%d\n", path.type);
-
-  if (SerializeTo(&path, path_bytes, path_size))
-    rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFileRefRpcServer::PPB_FileRef_GetParent(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource file_ref,
-    PP_Resource* parent) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  *parent = PPBFileRefInterface()->GetParent(file_ref);
-  DebugPrintf("PPB_FileRef::GetParent: parent=%"NACL_PRId32"\n", *parent);
-}
-
-void PpbFileRefRpcServer::PPB_FileRef_MakeDirectory(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource directory_ref,
-    int32_t make_ancestors,
-    int32_t callback_id,
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback = MakeRemoteCompletionCallback(
-      rpc->channel,
-      callback_id);
-  if (remote_callback.func == NULL)
-    return;
-
-  *pp_error = PPBFileRefInterface()->MakeDirectory(
-      directory_ref,
-      PP_FromBool(make_ancestors),
-      remote_callback);
-  DebugPrintf("PPB_FileRef::MakeDirectory: pp_error=%"NACL_PRId32"\n",
-              *pp_error);
-  CHECK(*pp_error != PP_OK);  // MakeDirectory does not complete synchronously
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFileRefRpcServer::PPB_FileRef_Touch(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource file_ref,
-    double last_access_time,
-    double last_modified_time,
-    int32_t callback_id,
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback = MakeRemoteCompletionCallback(
-      rpc->channel,
-      callback_id);
-  if (remote_callback.func == NULL)
-    return;
-
-  *pp_error = PPBFileRefInterface()->Touch(
-      file_ref,
-      last_access_time,
-      last_modified_time,
-      remote_callback);
-  DebugPrintf("PPB_FileRef::Touch: pp_error=%"NACL_PRId32"\n", *pp_error);
-  CHECK(*pp_error != PP_OK);  // Touch does not complete synchronously
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFileRefRpcServer::PPB_FileRef_Delete(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource file_ref,
-    int32_t callback_id,
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback = MakeRemoteCompletionCallback(
-      rpc->channel,
-      callback_id);
-  if (remote_callback.func == NULL)
-    return;
-
-  *pp_error = PPBFileRefInterface()->Delete(file_ref, remote_callback);
-  DebugPrintf("PPB_FileRef::Delete: pp_error=%"NACL_PRId32"\n", *pp_error);
-  CHECK(*pp_error != PP_OK);  // Delete does not complete synchronously
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFileRefRpcServer::PPB_FileRef_Rename(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource file_ref,
-    PP_Resource new_file_ref,
-    int32_t callback_id,
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback = MakeRemoteCompletionCallback(
-      rpc->channel,
-      callback_id);
-  if (remote_callback.func == NULL)
-    return;
-
-  *pp_error = PPBFileRefInterface()->Rename(file_ref, new_file_ref,
-                                            remote_callback);
-  DebugPrintf("PPB_FileRef::Rename: pp_error=%"NACL_PRId32"\n", *pp_error);
-  CHECK(*pp_error != PP_OK);  // Rename does not complete synchronously
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_file_system_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_file_system_rpc_server.cc
deleted file mode 100644
index 8ef2393..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_file_system_rpc_server.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::DeleteRemoteCallbackInfo;
-using ppapi_proxy::MakeRemoteCompletionCallback;
-using ppapi_proxy::PPBFileSystemInterface;
-
-void PpbFileSystemRpcServer::PPB_FileSystem_Create(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    int32_t file_system_type,
-    PP_Resource* resource) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  *resource = PPBFileSystemInterface()->Create(
-      instance,
-      static_cast<PP_FileSystemType>(file_system_type));
-  DebugPrintf("PPB_FileSystem::Create: resource=%"NACL_PRId32"\n",
-              *resource);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFileSystemRpcServer::PPB_FileSystem_IsFileSystem(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  *success = PPBFileSystemInterface()->IsFileSystem(resource);
-
-  DebugPrintf("PPB_FileSystem::IsFileSystem: resource=%"NACL_PRId32"\n",
-              resource);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFileSystemRpcServer::PPB_FileSystem_Open(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource file_system,
-    int64_t expected_size,
-    int32_t callback_id,
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  DebugPrintf("PPB_FileSystem::Open: file_system=%"NACL_PRId32"\n",
-              file_system);
-
-  PP_CompletionCallback remote_callback = MakeRemoteCompletionCallback(
-      rpc->channel,
-      callback_id);
-
-  if (remote_callback.func == NULL)
-    return;
-
-  *pp_error = PPBFileSystemInterface()->Open(file_system, expected_size,
-                                             remote_callback);
-
-  DebugPrintf("PPB_FileSystem::Open: pp_error=%"NACL_PRId32"\n", *pp_error);
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFileSystemRpcServer::PPB_FileSystem_GetType(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource file_system,
-    int32_t* type) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  DebugPrintf("PPB_FileSystem::GetType: file_system=%"NACL_PRId32"\n",
-              file_system);
-
-  *type = PPBFileSystemInterface()->GetType(file_system);
-
-  DebugPrintf("PPB_FileSystem::GetType: type=%"NACL_PRId32"\n", *type);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_find_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_find_rpc_server.cc
deleted file mode 100644
index e46d494..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_find_rpc_server.cc
+++ /dev/null
@@ -1,54 +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.
-//
-// SRPC-abstraction wrappers around PPB_Find_Dev functions.
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
-#include "ppapi/c/dev/ppb_find_dev.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_point.h"
-#include "ppapi/c/ppb_image_data.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::PPBFindInterface;
-
-void PpbFindRpcServer::PPB_Find_NumberOfFindResultsChanged(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    int32_t total,
-    int32_t final_result) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PPBFindInterface()->NumberOfFindResultsChanged(
-      instance,
-      total,
-      PP_FromBool(final_result));
-
-  DebugPrintf("PPB_Find::NumberOfFindResultsChanged: "
-              "instance=%"NACL_PRId32"\n", instance);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFindRpcServer::PPB_Find_SelectedFindResultChanged(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    int32_t index) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PPBFindInterface()->SelectedFindResultChanged(instance, index);
-
-  DebugPrintf("PPB_Find::SelectedFindResultChanged: "
-              "instance=%"NACL_PRId32"\n", instance);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_font_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_font_rpc_server.cc
deleted file mode 100644
index 28c0a1e..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_font_rpc_server.cc
+++ /dev/null
@@ -1,229 +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.
-//
-// SRPC-abstraction wrappers around PPB_Font_Dev functions.
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
-#include "ppapi/c/dev/ppb_font_dev.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_point.h"
-#include "ppapi/c/pp_rect.h"
-#include "ppapi/c/ppb_image_data.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::SerializeTo;
-using ppapi_proxy::DeserializeTo;
-using ppapi_proxy::PPBFontInterface;
-
-void PpbFontRpcServer::PPB_Font_GetFontFamilies(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      // inputs
-      PP_Instance instance,
-      // outputs
-      nacl_abi_size_t* font_families_size, char* font_families_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Var font_families = PPBFontInterface()->GetFontFamilies(instance);
-  DebugPrintf("PPB_Font::GetFontFamilies: type=%d\n",
-              font_families.type);
-
-  if (!SerializeTo(
-      &font_families, font_families_bytes, font_families_size))
-    return;
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFontRpcServer::PPB_Font_Create(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    nacl_abi_size_t description_size, char* description,
-    nacl_abi_size_t face_size, char* face,
-    PP_Resource* font) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (description_size != sizeof(struct PP_FontDescription_Dev))
-    return;
-  struct PP_FontDescription_Dev* pp_description =
-      reinterpret_cast<struct PP_FontDescription_Dev*>(description);
-  if (!DeserializeTo(face, face_size, 1, &pp_description->face)) {
-    return;
-  }
-  *font = PPBFontInterface()->Create(instance, pp_description);
-
-  DebugPrintf("PPB_Font_Dev::Create: font=%"NACL_PRId32"\n", *font);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFontRpcServer::PPB_Font_IsFont(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t* is_font) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Bool pp_is_font = PPBFontInterface()->IsFont(resource);
-  *is_font = PP_ToBool(pp_is_font);
-
-  DebugPrintf("PPB_Font_Dev::IsFont: is_font=%"NACL_PRId32"\n", *is_font);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFontRpcServer::PPB_Font_Describe(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource font,
-    nacl_abi_size_t* description_size, char* description,
-    nacl_abi_size_t* face_size, char* face,
-    nacl_abi_size_t* metrics_size, char* metrics,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (*description_size != sizeof(struct PP_FontDescription_Dev))
-    return;
-  if (*metrics_size != sizeof(struct PP_FontMetrics_Dev))
-    return;
-  struct PP_FontDescription_Dev* pp_description =
-      reinterpret_cast<struct PP_FontDescription_Dev*>(description);
-  pp_description->face= PP_MakeUndefined();
-  pp_description->padding = 0;
-  struct PP_FontMetrics_Dev* pp_metrics =
-      reinterpret_cast<struct PP_FontMetrics_Dev*>(metrics);
-  PP_Bool pp_success = PPBFontInterface()->Describe(font,
-                                                    pp_description,
-                                                    pp_metrics);
-  if (!SerializeTo(&pp_description->face, face, face_size))
-    return;
-  *success = PP_ToBool(pp_success);
-
-  DebugPrintf("PPB_Font_Dev::Describe: success=%"NACL_PRId32"\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFontRpcServer::PPB_Font_DrawTextAt(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource font,
-    PP_Resource image_data,
-    nacl_abi_size_t text_run_size, char* text_run,
-    nacl_abi_size_t text_size, char* text,
-    nacl_abi_size_t position_size, char* position,
-    int32_t color,
-    nacl_abi_size_t clip_size, char* clip,
-    int32_t image_data_is_opaque,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (text_run_size != sizeof(struct PP_TextRun_Dev))
-    return;
-  if (position_size != sizeof(struct PP_Point))
-    return;
-  if (clip_size != sizeof(struct PP_Rect))
-    return;
-  struct PP_TextRun_Dev* pp_text_run =
-      reinterpret_cast<struct PP_TextRun_Dev*>(text_run);
-  if (!DeserializeTo(text, text_size, 1, &pp_text_run->text))
-    return;
-  struct PP_Point* pp_position =
-      reinterpret_cast<struct PP_Point*>(position);
-  struct PP_Rect* pp_clip =
-      reinterpret_cast<struct PP_Rect*>(clip);
-  PP_Bool pp_image_data_is_opaque = PP_FromBool(image_data_is_opaque != 0);
-  PP_Bool pp_success = PPBFontInterface()->DrawTextAt(font,
-                                                      image_data,
-                                                      pp_text_run,
-                                                      pp_position,
-                                                      color,
-                                                      pp_clip,
-                                                      pp_image_data_is_opaque);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_Font_Dev::DrawTextAt: success=%"NACL_PRId32"\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFontRpcServer::PPB_Font_MeasureText(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource font,
-    nacl_abi_size_t text_run_size, char* text_run,
-    nacl_abi_size_t text_size, char* text,
-    int32_t* width) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (text_run_size != sizeof(struct PP_TextRun_Dev))
-    return;
-  struct PP_TextRun_Dev* pp_text_run =
-      reinterpret_cast<struct PP_TextRun_Dev*>(text_run);
-  if (!DeserializeTo(text, text_size, 1, &pp_text_run->text))
-    return;
-  *width = PPBFontInterface()->MeasureText(font, pp_text_run);
-
-  DebugPrintf("PPB_Font_Dev::MeasureText: width=%"NACL_PRId32"\n", *width);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFontRpcServer::PPB_Font_CharacterOffsetForPixel(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource font,
-    nacl_abi_size_t text_run_size, char* text_run,
-    nacl_abi_size_t text_size, char* text,
-    int32_t pixel_position,
-    int32_t* offset) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (text_run_size != sizeof(struct PP_TextRun_Dev))
-    return;
-  struct PP_TextRun_Dev* pp_text_run =
-      reinterpret_cast<struct PP_TextRun_Dev*>(text_run);
-  if (!DeserializeTo(text, text_size, 1, &pp_text_run->text))
-    return;
-  *offset = PPBFontInterface()->CharacterOffsetForPixel(font,
-                                                        pp_text_run,
-                                                        pixel_position);
-
-  DebugPrintf("PPB_Font_Dev::CharacterOffsetForPixel: "
-              "offset=%"NACL_PRId32"\n", *offset);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbFontRpcServer::PPB_Font_PixelOffsetForCharacter(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource font,
-    nacl_abi_size_t text_run_size, char* text_run,
-    nacl_abi_size_t text_size, char* text,
-    int32_t char_offset,
-    int32_t* offset) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (text_run_size != sizeof(struct PP_TextRun_Dev))
-    return;
-  struct PP_TextRun_Dev* pp_text_run =
-      reinterpret_cast<struct PP_TextRun_Dev*>(text_run);
-  if (!DeserializeTo(text, text_size, 1, &pp_text_run->text))
-    return;
-  *offset = PPBFontInterface()->PixelOffsetForCharacter(font,
-                                                        pp_text_run,
-                                                        char_offset);
-  DebugPrintf("PPB_Font_Dev::PixelOffsetForCharacter: "
-              "offset=%"NACL_PRId32"\n", *offset);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_fullscreen_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_fullscreen_rpc_server.cc
deleted file mode 100644
index 115b9ff..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_fullscreen_rpc_server.cc
+++ /dev/null
@@ -1,58 +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.
-//
-// SRPC-abstraction wrappers around PPB_Fullscreen functions.
-
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_size.h"
-#include "ppapi/c/ppb_fullscreen.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::PPBFullscreenInterface;
-
-// IsFullscreen is implemented via an extra flag to the DidChangeView proxy.
-
-void PpbFullscreenRpcServer::PPB_Fullscreen_SetFullscreen(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      // inputs
-      PP_Instance instance,
-      int32_t fullscreen,
-      // outputs
-      int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Bool pp_success = PPBFullscreenInterface()->SetFullscreen(
-      instance,
-      PP_FromBool(fullscreen));
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_Fullscreen::SetFullscreen: success=%d\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-
-void PpbFullscreenRpcServer::PPB_Fullscreen_GetScreenSize(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      // inputs
-      PP_Instance instance,
-      // outputs
-      nacl_abi_size_t* size_bytes, char* size,
-      int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  *success = 0;
-  if (*size_bytes != sizeof(struct PP_Size))
-    return;
-
-  PP_Bool pp_success = PPBFullscreenInterface()->GetScreenSize(
-      instance,
-      reinterpret_cast<struct PP_Size*>(size));
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_Fullscreen::GetScreenSize: success=%d\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_gamepad_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_gamepad_rpc_server.cc
deleted file mode 100644
index dfaebe6..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_gamepad_rpc_server.cc
+++ /dev/null
@@ -1,33 +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.
-//
-// SRPC-abstraction wrappers around PPB_Gamepad functions.
-
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/ppb_gamepad.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::PPBGamepadInterface;
-
-void PpbGamepadRpcServer::PPB_Gamepad_Sample(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      // inputs
-      PP_Instance instance,
-      // outputs
-      nacl_abi_size_t* pads_bytes, char* pads) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (*pads_bytes != sizeof(struct PP_GamepadsSampleData))
-    return;
-
-  PPBGamepadInterface()->Sample(
-      instance,
-      reinterpret_cast<struct PP_GamepadsSampleData*>(pads));
-  DebugPrintf("PPB_Gamepad::SampleGamepads\n");
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_2d_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_2d_rpc_server.cc
deleted file mode 100644
index 1e0b825..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_2d_rpc_server.cc
+++ /dev/null
@@ -1,180 +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.
-//
-// SRPC-abstraction wrappers around PPB_Graphics2D functions.
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_point.h"
-#include "ppapi/c/pp_rect.h"
-#include "ppapi/c/pp_size.h"
-#include "ppapi/c/ppb_graphics_2d.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::PPBGraphics2DInterface;
-
-namespace {
-
-// Two functions below use a NULL PP_Rect pointer to indicate that the
-// entire image should be updated.
-const struct PP_Rect* kEntireImage = NULL;
-
-}  // namespace
-
-void PpbGraphics2DRpcServer::PPB_Graphics2D_Create(NaClSrpcRpc* rpc,
-                                                   NaClSrpcClosure* done,
-                                                   PP_Instance instance,
-                                                   nacl_abi_size_t size_bytes,
-                                                   char* size,
-                                                   int32_t is_always_opaque,
-                                                   PP_Resource* resource) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  *resource = ppapi_proxy::kInvalidResourceId;
-  if (size_bytes != sizeof(struct PP_Size)) {
-    return;
-  }
-  *resource = PPBGraphics2DInterface()->Create(
-      instance,
-      const_cast<const struct PP_Size*>(
-          reinterpret_cast<struct PP_Size*>(size)),
-      PP_FromBool(is_always_opaque));
-  DebugPrintf("PPB_Graphics2D::Create: resource=%"NACL_PRId32"\n", *resource);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics2DRpcServer::PPB_Graphics2D_IsGraphics2D(NaClSrpcRpc* rpc,
-                                                         NaClSrpcClosure* done,
-                                                         PP_Resource resource,
-                                                         int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  *success = 0;
-  PP_Bool pp_success = PPBGraphics2DInterface()->IsGraphics2D(resource);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_Graphics2D::IsGraphics2D: success=%d\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics2DRpcServer::PPB_Graphics2D_Describe(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource graphics_2d,
-    nacl_abi_size_t* size_bytes,
-    char* size,
-    int32_t* is_always_opaque,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  *success = 0;
-  if (*size_bytes != sizeof(struct PP_Size)) {
-    return;
-  }
-  PP_Bool is_opaque;
-  PP_Bool pp_success = PPBGraphics2DInterface()->Describe(
-      graphics_2d, reinterpret_cast<struct PP_Size*>(size), &is_opaque);
-  *is_always_opaque = PP_ToBool(is_opaque);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_Graphics2D::Describe: success=%d\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics2DRpcServer::PPB_Graphics2D_PaintImageData(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource graphics_2d,
-    PP_Resource image,
-    nacl_abi_size_t top_left_bytes,
-    char* top_left,
-    nacl_abi_size_t src_rect_bytes,
-    char* src_rect) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (top_left_bytes != sizeof(struct PP_Point)) {  // NULL top_left is invalid.
-    return;
-  }
-  const struct PP_Rect* rect = kEntireImage;
-  if (src_rect_bytes == sizeof(struct PP_Rect)) {
-    rect = const_cast<const struct PP_Rect*>(
-        reinterpret_cast<struct PP_Rect*>(src_rect));
-  } else if (src_rect_bytes != 0) {
-    return;
-  }
-  PPBGraphics2DInterface()->PaintImageData(
-      graphics_2d,
-      image,
-      const_cast<const struct PP_Point*>(
-          reinterpret_cast<struct PP_Point*>(top_left)),
-      rect);
-  DebugPrintf("PPB_Graphics2D::PaintImageData\n");
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics2DRpcServer::PPB_Graphics2D_Scroll(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource graphics_2d,
-    nacl_abi_size_t clip_rect_bytes,
-    char* clip_rect,
-    nacl_abi_size_t amount_bytes,
-    char* amount) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (amount_bytes != sizeof(struct PP_Point)) {  // NULL amount is invalid.
-    return;
-  }
-  const struct PP_Rect* rect = kEntireImage;
-  if (clip_rect_bytes == sizeof(struct PP_Rect)) {
-    rect = const_cast<const struct PP_Rect*>(
-        reinterpret_cast<struct PP_Rect*>(clip_rect));
-  } else if (clip_rect_bytes != 0) {
-    return;
-  }
-  PPBGraphics2DInterface()->Scroll(
-      graphics_2d,
-      rect,
-      const_cast<const struct PP_Point*>(
-          reinterpret_cast<struct PP_Point*>(amount)));
-  DebugPrintf("PPB_Graphics2D::Scroll\n");
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics2DRpcServer::PPB_Graphics2D_ReplaceContents(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource graphics_2d,
-    PP_Resource image) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  PPBGraphics2DInterface()->ReplaceContents(graphics_2d, image);
-  DebugPrintf("PPB_Graphics2D::ReplaceContents\n");
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics2DRpcServer::PPB_Graphics2D_Flush(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource graphics_2d,
-    int32_t callback_id,
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback =
-      ppapi_proxy::MakeRemoteCompletionCallback(rpc->channel, callback_id);
-  if (remote_callback.func == NULL)
-    return;  // Treat this as a generic SRPC error.
-
-  *pp_error = PPBGraphics2DInterface()->Flush(graphics_2d, remote_callback);
-  if (*pp_error != PP_OK_COMPLETIONPENDING)  // Async error.
-    ppapi_proxy::DeleteRemoteCallbackInfo(remote_callback);
-  DebugPrintf("PPB_Graphics2D::Flush: pp_error=%"NACL_PRId32"\n", *pp_error);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc
deleted file mode 100644
index 03f7624..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc
+++ /dev/null
@@ -1,405 +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.
-//
-// SRPC-abstraction wrappers around PPB_Graphics3D functions.
-
-#include <limits>
-
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/imc/nacl_imc.h"
-#include "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_graphics_3d.h"
-#include "ppapi/c/ppb_graphics_3d.h"
-#include "ppapi/c/private/ppb_gpu_blacklist_private.h"
-#include "ppapi/c/trusted/ppb_graphics_3d_trusted.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::SerializeTo;
-
-namespace {
-
-const int32_t kMaxAllowedBufferSize = 16777216;
-
-/// Check that the attribute list is well formed.
-bool ValidateAttribList(nacl_abi_size_t attrib_list_count,
-                        int32_t* attrib_list) {
-  DebugPrintf("ValidateAttribList: count = %d, ptr_null = %d\n",
-      static_cast<int>(attrib_list_count), (attrib_list == NULL) ? 1 : 0);
-  // Zero count lists are ok.
-  if (attrib_list_count == 0)
-    return true;
-  // NULL lists w/ a non-zero count are not allowed.
-  if (attrib_list == NULL)
-    return false;
-  // Must be an odd count, and the last item must be the terminator.
-  return (attrib_list_count & 1) &&
-         (attrib_list[attrib_list_count - 1] == PP_GRAPHICS3DATTRIB_NONE);
-}
-
-/// Check that the attribute list is well formed, then copy to output.
-bool ValidateAndCopyAttribList(nacl_abi_size_t in_attrib_list_count,
-                               int32_t* in_attrib_list,
-                               nacl_abi_size_t* out_attrib_list_count,
-                               int32_t* out_attrib_list) {
-
-  DebugPrintf("ValidateAndCopyAttribList: in_count = %d, in_ptr_null = %d\n",
-      static_cast<int>(in_attrib_list_count),
-      (in_attrib_list == NULL) ? 1 : 0);
-  DebugPrintf("                           out_count = %d, out_ptr_null = %d\n",
-      static_cast<int>(*out_attrib_list_count),
-      (out_attrib_list == NULL) ? 1 : 0);
-
-  // Attrib lists can both be NULL w/ 0 count.
-  if ((in_attrib_list == NULL) && (out_attrib_list == NULL))
-    return (in_attrib_list_count == 0) && (*out_attrib_list_count == 0);
-  // Don't allow only one list to be NULL.
-  if ((in_attrib_list == NULL) || (out_attrib_list == NULL))
-    return false;
-  // Input and output lists must be the same size.
-  if (in_attrib_list_count != *out_attrib_list_count)
-    return false;
-  // Make sure input list is well formed.
-  if (!ValidateAttribList(in_attrib_list_count, in_attrib_list))
-    return false;
-  // Copy input list to output list.
-  // Note: attrib lists can be zero sized.
-  for (nacl_abi_size_t i = 0; i < in_attrib_list_count; ++i)
-    out_attrib_list[i] = in_attrib_list[i];
-  return true;
-}
-
-bool IsGpuBlacklisted() {
-  static const PPB_GpuBlacklist_Private* gpu_black_list_interface =
-      static_cast<const PPB_GpuBlacklist_Private*>(
-          ppapi_proxy::GetBrowserInterfaceSafe(
-              PPB_GPUBLACKLIST_PRIVATE_INTERFACE));
-  return gpu_black_list_interface->IsGpuBlacklisted();
-}
-
-}  // namespace
-
-//@{
-/// The following methods are SRPC dispatchers for ppapi/c/ppb_graphics_3d.h.
-
-void PpbGraphics3DRpcServer::PPB_Graphics3D_GetAttribMaxValue(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance_id,
-    int32_t attrib,
-    int32_t* attrib_value,
-    int32_t* pp_error) {
-  DebugPrintf(
-      "PpbGraphics3DRpcServer::PPB_Graphics3D_GetAttribMaxValue(...)\n");
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  *pp_error = ppapi_proxy::PPBGraphics3DInterface()->GetAttribMaxValue(
-      instance_id, attrib, attrib_value);
-  DebugPrintf("    PPB_Graphics3D_GetAttribMaxValue: pp_error=%"NACL_PRId32"\n",
-              *pp_error);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics3DRpcServer::PPB_Graphics3D_Create(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    PP_Resource share_context,
-    nacl_abi_size_t num_attrib_list, int32_t* attrib_list,
-    PP_Resource* graphics3d_id) {
-  DebugPrintf("PpbGraphics3DRpcServer::PPB_Graphics3D_Create(...)\n");
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (num_attrib_list == 0)
-    attrib_list = NULL;
-  if (!ValidateAttribList(num_attrib_list, attrib_list))
-    return;
-  *graphics3d_id = ppapi_proxy::PPBGraphics3DInterface()->Create(
-      instance, share_context, attrib_list);
-  DebugPrintf("    PPB_Graphics3D_Create: resource=%"NACL_PRId32"\n",
-              *graphics3d_id);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics3DRpcServer::PPB_Graphics3D_GetAttribs(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource graphics3d_id,
-    nacl_abi_size_t in_attrib_list_count, int32_t* in_attrib_list,
-    nacl_abi_size_t* out_attrib_list_count, int32_t* out_attrib_list,
-    int32_t* pp_error) {
-  DebugPrintf("PpbGraphics3DRpcServer::PPB_Graphics3D_GetAttribs(...)\n");
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (in_attrib_list_count == 0)
-    in_attrib_list = NULL;
-  if (*out_attrib_list_count == 0)
-    out_attrib_list = NULL;
-  if (!ValidateAndCopyAttribList(in_attrib_list_count, in_attrib_list,
-                                 out_attrib_list_count, out_attrib_list))
-    return;
-  *pp_error = ppapi_proxy::PPBGraphics3DInterface()->GetAttribs(
-      graphics3d_id, out_attrib_list);
-  DebugPrintf("    PPB_Graphics3D_GetAttrib: pp_error=%"NACL_PRId32"\n",
-              *pp_error);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics3DRpcServer::PPB_Graphics3D_SetAttribs(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource graphics3d_id,
-    nacl_abi_size_t attrib_list_count, int32_t* attrib_list,
-    int32_t* pp_error) {
-  DebugPrintf("PpbGraphics3DRpcServer::PPB_Graphics3D_SetAttribs(...)\n");
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (attrib_list_count == 0)
-    attrib_list = NULL;
-  if (!ValidateAttribList(attrib_list_count, attrib_list))
-    return;
-  *pp_error = ppapi_proxy::PPBGraphics3DInterface()->SetAttribs(
-      graphics3d_id, attrib_list);
-  DebugPrintf("    PPB_Graphics3D_SetAttrib: pp_error=%"NACL_PRId32"\n",
-              *pp_error);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics3DRpcServer::PPB_Graphics3D_GetError(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource graphics3d_id,
-    int32_t* pp_error) {
-  DebugPrintf("PpbGraphics3DRpcServer::PPB_Graphics3D_GetError(...)\n");
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  *pp_error = ppapi_proxy::PPBGraphics3DInterface()->GetError(graphics3d_id);
-  DebugPrintf("    PPB_Graphics3D_GetError: pp_error=%"NACL_PRId32"\n",
-              *pp_error);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics3DRpcServer::PPB_Graphics3D_SwapBuffers(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource graphics3d_id,
-    int32_t callback_id,
-    int32_t* pp_error) {
-  DebugPrintf("PpbGraphics3DRpcServer::PPB_Graphics3D_SwapBuffers(...)\n");
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  PP_CompletionCallback remote_callback =
-      ppapi_proxy::MakeRemoteCompletionCallback(rpc->channel, callback_id);
-  if (remote_callback.func == NULL) {
-    DebugPrintf("    PPB_Graphics3D_SwapBuffers() FAILED!\n");
-    return;  // Treat this as a generic SRPC error.
-  }
-  *pp_error = ppapi_proxy::PPBGraphics3DInterface()->SwapBuffers(
-      graphics3d_id, remote_callback);
-  if (*pp_error != PP_OK_COMPLETIONPENDING)
-    ppapi_proxy::DeleteRemoteCallbackInfo(remote_callback);
-  DebugPrintf("    PPB_Graphics3D_SwapBuffers: pp_error=%"NACL_PRId32"\n",
-              *pp_error);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-//@}
-
-//@{
-/// The following methods are the SRPC dispatchers for
-/// ppapi/c/ppb_graphics_3d_trusted.h.
-void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_CreateRaw(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    PP_Resource share_context,
-    nacl_abi_size_t attrib_list_size, int32_t* attrib_list,
-    PP_Resource* resource_id) {
-  DebugPrintf("PPB_Graphics3DTrusted_CreateRaw: instance: %"NACL_PRId32"\n",
-              instance);
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (attrib_list_size == 0)
-    attrib_list = NULL;
-  if (!ValidateAttribList(attrib_list_size, attrib_list))
-    return;
-  if (IsGpuBlacklisted()) {
-    *resource_id = ppapi_proxy::kInvalidResourceId;
-  } else {
-    *resource_id = ppapi_proxy::PPBGraphics3DTrustedInterface()->CreateRaw(
-        instance, share_context, attrib_list);
-  }
-  DebugPrintf("    PPB_Graphics3DTrusted_CreateRaw: resource=%"NACL_PRId32"\n",
-              *resource_id);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_InitCommandBuffer(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource_id,
-    int32_t* success) {
-  DebugPrintf("PPB_Graphics3DTrusted_InitCommandBuffer(...) resource_id: %d\n",
-      resource_id);
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  *success = ppapi_proxy::PPBGraphics3DTrustedInterface()->InitCommandBuffer(
-      resource_id);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_SetGetBuffer(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource_id,
-    int32_t transfer_buffer_id) {
-  DebugPrintf("PPB_Graphics3DTrusted_SetGetBuffer\n");
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  ppapi_proxy::PPBGraphics3DTrustedInterface()->SetGetBuffer(
-      resource_id, transfer_buffer_id);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_GetState(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource_id,
-    nacl_abi_size_t* state_size, char* state) {
-  DebugPrintf("PPB_Graphics3DTrusted_GetState\n");
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (*state_size != sizeof(PP_Graphics3DTrustedState))
-    return;
-  PP_Graphics3DTrustedState trusted_state =
-      ppapi_proxy::PPBGraphics3DTrustedInterface()->GetState(resource_id);
-  *reinterpret_cast<PP_Graphics3DTrustedState*>(state) = trusted_state;
-  *state_size = sizeof(trusted_state);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_Flush(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource_id,
-    int32_t put_offset) {
-  DebugPrintf("PPB_Graphics3DTrusted_Flush(id: %d, put_offset: %d\n",
-      resource_id, put_offset);
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  ppapi_proxy::PPBGraphics3DTrustedInterface()->Flush(resource_id, put_offset);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_FlushSync(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource_id,
-    int32_t put_offset,
-    nacl_abi_size_t* state_size, char* state) {
-  DebugPrintf("PPB_Graphics3DTrusted_FlushSync\n");
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (*state_size != sizeof(PP_Graphics3DTrustedState))
-    return;
-  PP_Graphics3DTrustedState trusted_state =
-      ppapi_proxy::PPBGraphics3DTrustedInterface()->FlushSync(resource_id,
-                                                              put_offset);
-  *reinterpret_cast<PP_Graphics3DTrustedState*>(state) = trusted_state;
-  *state_size = sizeof(trusted_state);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_FlushSyncFast(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource_id,
-    int32_t put_offset,
-    int32_t last_known_get,
-    nacl_abi_size_t* state_size, char* state) {
-  DebugPrintf("PPB_Graphics3DTrusted_FlushSyncFast\n");
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (*state_size != sizeof(PP_Graphics3DTrustedState))
-    return;
-  PP_Graphics3DTrustedState trusted_state =
-      ppapi_proxy::PPBGraphics3DTrustedInterface()->FlushSyncFast(
-          resource_id, put_offset, last_known_get);
-  *reinterpret_cast<PP_Graphics3DTrustedState*>(state) = trusted_state;
-  *state_size = sizeof(trusted_state);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_CreateTransferBuffer(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource_id,
-    int32_t size,
-    int32_t id_request,
-    int32_t* id) {
-  UNREFERENCED_PARAMETER(id_request);
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  DebugPrintf("PPB_Graphics3DTrusted_CreateTransferBuffer\n");
-  if ((size > kMaxAllowedBufferSize) || (size < 0))
-    return;
-  *id = ppapi_proxy::PPBGraphics3DTrustedInterface()->CreateTransferBuffer(
-      resource_id, size);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_DestroyTransferBuffer(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource_id,
-    int32_t id) {
-  DebugPrintf("PPB_Graphics3DTrusted_DestroyTransferBuffer\n");
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  ppapi_proxy::PPBGraphics3DTrustedInterface()->DestroyTransferBuffer(
-      resource_id, id);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_GetTransferBuffer(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource_id,
-    int32_t id,
-    NaClSrpcImcDescType* shm_desc,
-    int32_t* shm_size) {
-  DebugPrintf("PPB_Graphics3DTrusted_GetTransferBuffer\n");
-  nacl::DescWrapperFactory factory;
-  nacl::scoped_ptr<nacl::DescWrapper> desc_wrapper(factory.MakeInvalid());
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  *shm_desc = desc_wrapper->desc();
-  *shm_size = 0;
-  const int kInvalidIntHandle = int(nacl::kInvalidHandle);
-  int native_handle = kInvalidIntHandle;
-  uint32_t native_size = 0;
-  bool transfer_buffer_aquired = ppapi_proxy::PPBGraphics3DTrustedInterface()->
-      GetTransferBuffer(resource_id, id, &native_handle, &native_size);
-  if (!transfer_buffer_aquired || kInvalidIntHandle == native_handle) {
-    return;
-  }
-  NaClHandle nacl_handle = NaClHandle(native_handle);
-  NaClHandle nacl_dup_handle = NaClDuplicateNaClHandle(nacl_handle);
-  if (nacl::kInvalidHandle == nacl_dup_handle) {
-    return;
-  }
-  desc_wrapper.reset(factory.ImportShmHandle(nacl_dup_handle, native_size));
-  *shm_desc = desc_wrapper->desc();
-  *shm_size = native_size;
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-//@}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_host_resolver_private_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_host_resolver_private_rpc_server.cc
deleted file mode 100644
index 4c51dc9..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_host_resolver_private_rpc_server.cc
+++ /dev/null
@@ -1,179 +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.
-//
-// SRPC-abstraction wrappers around PPB_HostResolver_Private functions.
-
-#include <limits>
-#include <sys/types.h>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/cpp/var.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::DeleteRemoteCallbackInfo;
-using ppapi_proxy::MakeRemoteCompletionCallback;
-using ppapi_proxy::PPBHostResolverPrivateInterface;
-using ppapi_proxy::SerializeTo;
-
-void PpbHostResolverPrivateRpcServer::PPB_HostResolver_Private_Create(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Instance instance,
-    // output
-    PP_Resource* resource) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  *resource = PPBHostResolverPrivateInterface()->Create(instance);
-
-  DebugPrintf("PPB_HostResolver_Private::Create: " \
-              "resource=%"NACL_PRId32"\n", *resource);
-}
-
-void PpbHostResolverPrivateRpcServer::PPB_HostResolver_Private_IsHostResolver(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource resource,
-    // output
-    int32_t* is_host_resolver) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  PP_Bool pp_success =
-      PPBHostResolverPrivateInterface()->IsHostResolver(resource);
-  *is_host_resolver = PP_ToBool(pp_success);
-
-  DebugPrintf("PPB_HostResolver_Private::IsHostResolver: " \
-              "is_host_resolver=%d\n", *is_host_resolver);
-}
-
-void PpbHostResolverPrivateRpcServer::PPB_HostResolver_Private_Resolve(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource host_resolver,
-    const char* host,
-    int32_t port,
-    nacl_abi_size_t hint_bytes, char* hint,
-    int32_t callback_id,
-    // output
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (hint_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_HostResolver_Private_Hint))) {
-    return;
-  }
-
-  if (port < std::numeric_limits<uint16_t>::min() ||
-      port > std::numeric_limits<uint16_t>::max()) {
-    return;
-  }
-
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error = PPBHostResolverPrivateInterface()->Resolve(
-      host_resolver,
-      host,
-      static_cast<uint16_t>(port),
-      reinterpret_cast<const PP_HostResolver_Private_Hint*>(hint),
-      remote_callback);
-
-  DebugPrintf("PPB_HostResolver_Private::Resolve: " \
-              "pp_error=%"NACL_PRId32"\n", *pp_error);
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbHostResolverPrivateRpcServer::PPB_HostResolver_Private_GetCanonicalName(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource host_resolver,
-    // outputs
-    nacl_abi_size_t* canonical_name_bytes, char* canonical_name) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  pp::Var pp_canonical_name(
-      pp::PASS_REF,
-      PPBHostResolverPrivateInterface()->GetCanonicalName(host_resolver));
-
-  if (!SerializeTo(&pp_canonical_name.pp_var(),
-                   canonical_name,
-                   canonical_name_bytes)) {
-    return;
-  }
-
-  DebugPrintf("PPB_HostResolver_Private::GetCanonicalName: " \
-              "canonical_name=%s\n", pp_canonical_name.AsString().c_str());
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbHostResolverPrivateRpcServer::PPB_HostResolver_Private_GetSize(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource host_resolver,
-    // output
-    int32_t* size) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  uint32_t list_size =
-      PPBHostResolverPrivateInterface()->GetSize(
-          host_resolver);
-
-  DebugPrintf("PPB_HostResolver_Private::GetSize: " \
-              "size=%"NACL_PRIu32"\n", list_size);
-
-  if (list_size > static_cast<uint32_t>(std::numeric_limits<int32_t>::max()))
-    return;
-  *size = static_cast<int32_t>(list_size);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbHostResolverPrivateRpcServer::PPB_HostResolver_Private_GetNetAddress(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource host_resolver,
-    int32_t index,
-    // outputs
-    nacl_abi_size_t* addr_bytes, char* addr,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (*addr_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)))
-    return;
-
-  PP_Bool pp_success =
-      PPBHostResolverPrivateInterface()->GetNetAddress(
-          host_resolver,
-          index,
-          reinterpret_cast<PP_NetAddress_Private*>(addr));
-  *success = PP_FromBool(pp_success);
-
-  DebugPrintf("PPB_HostResolver_Private::GetNetAddress: " \
-              "success=%d\n", *success);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_image_data_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_image_data_rpc_server.cc
deleted file mode 100644
index 67e937c..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_image_data_rpc_server.cc
+++ /dev/null
@@ -1,160 +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.
-//
-// SRPC-abstraction wrappers around PPB_ImageData functions.
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/imc/nacl_imc.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_point.h"
-#include "ppapi/c/pp_rect.h"
-#include "ppapi/c/pp_size.h"
-#include "ppapi/c/ppb_image_data.h"
-#include "ppapi/c/trusted/ppb_image_data_trusted.h"
-#include "srpcgen/ppb_rpc.h"
-
-
-using ppapi_proxy::DebugPrintf;
-
-void PpbImageDataRpcServer::PPB_ImageData_GetNativeImageDataFormat(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    int32_t* format) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  PP_ImageDataFormat pp_format =
-      ppapi_proxy::PPBImageDataInterface()->GetNativeImageDataFormat();
-  *format = static_cast<int32_t>(pp_format);
-  DebugPrintf("PPB_ImageData::GetNativeImageDataFormat: "
-              "format=%"NACL_PRId32"\n", *format);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbImageDataRpcServer::PPB_ImageData_IsImageDataFormatSupported(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    int32_t format,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  PP_Bool pp_success =
-      ppapi_proxy::PPBImageDataInterface()->IsImageDataFormatSupported(
-          static_cast<PP_ImageDataFormat>(format));
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_ImageData::IsImageDataFormatSupported: "
-              "format=%"NACL_PRId32", success=%"NACL_PRId32"\n",
-              format, *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbImageDataRpcServer::PPB_ImageData_Create(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    int32_t format,
-    nacl_abi_size_t size_bytes, char* size,
-    int32_t init_to_zero,
-    PP_Resource* resource) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (size_bytes != sizeof(struct PP_Size)) {
-    return;
-  }
-  PP_Size pp_size = *(reinterpret_cast<struct PP_Size*>(size));
-  *resource = ppapi_proxy::PPBImageDataInterface()->Create(
-      instance,
-      static_cast<PP_ImageDataFormat>(format),
-      &pp_size,
-      PP_FromBool(init_to_zero));
-  DebugPrintf("PPB_ImageData::Create: format=%"NACL_PRId32", "
-              "size=(%"NACL_PRId32", %"NACL_PRId32"), "
-              "init_to_zero=%"NACL_PRId32", "
-              "resource=%"NACL_PRId32"\n",
-              format, pp_size.width, pp_size.height,
-              init_to_zero, *resource);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbImageDataRpcServer::PPB_ImageData_IsImageData(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  PP_Bool pp_success =
-      ppapi_proxy::PPBImageDataInterface()->IsImageData(resource);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_ImageData::IsImageData: resource=%"NACL_PRId32", "
-              "success=%"NACL_PRId32"\n", resource, *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbImageDataRpcServer::PPB_ImageData_Describe(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    nacl_abi_size_t* desc_bytes,
-    char* desc,
-    NaClSrpcImcDescType* shm,
-    int32_t* shm_size,
-    int32_t* success) {
-  nacl::DescWrapperFactory factory;
-  nacl::scoped_ptr<nacl::DescWrapper> desc_wrapper(factory.MakeInvalid());
-  // IMPORTANT!
-  // Make sure that the runner is destroyed before DescWrapper!
-  // NaclDescs are refcounted. When the DescWrapper is destructed, it decreases
-  // the refcount, and causes the Desc to be freed. The closure runner will send
-  // the response in the destructor and segfault when trying to process a freed
-  // Desc.
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  if (*desc_bytes != sizeof(struct PP_ImageDataDesc)) {
-    return;
-  }
-  *shm = desc_wrapper->desc();
-  *shm_size = 0;
-  *success = PP_FALSE;
-  PP_Bool pp_success =
-      ppapi_proxy::PPBImageDataInterface()->Describe(
-          resource, reinterpret_cast<struct PP_ImageDataDesc*>(desc));
-  if (pp_success == PP_TRUE) {
-    const int kInvalidIntHandle = int(nacl::kInvalidHandle);
-    int native_handle = kInvalidIntHandle;
-    uint32_t native_size = 0;
-    if (ppapi_proxy::PPBImageDataTrustedInterface()->GetSharedMemory(
-        static_cast<PP_Resource>(resource),
-        &native_handle,
-        &native_size) == PP_OK) {
-      if (kInvalidIntHandle != native_handle) {
-#if NACL_LINUX
-        desc_wrapper.reset(factory.ImportSysvShm(native_handle, native_size));
-        *shm = desc_wrapper->desc();
-        *shm_size = native_size;
-        *success = PP_TRUE;
-#else
-        NaClHandle nacl_handle = NaClHandle(native_handle);
-        NaClHandle nacl_dup_handle = NaClDuplicateNaClHandle(nacl_handle);
-        if (nacl::kInvalidHandle != nacl_dup_handle) {
-          desc_wrapper.reset(
-              factory.ImportShmHandle(nacl_dup_handle, native_size));
-          *shm = desc_wrapper->desc();
-          *shm_size = native_size;
-          *success = PP_TRUE;
-        }
-#endif
-      }
-    }
-  }
-  DebugPrintf("PPB_ImageData::Describe: resource=%"NACL_PRId32", "
-              "success=%"NACL_PRId32"\n", resource, *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-// Map and Unmap are purely plugin-side methods, just using mmap/munmap.
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_input_event_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_input_event_rpc_server.cc
deleted file mode 100644
index a2db095..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_input_event_rpc_server.cc
+++ /dev/null
@@ -1,186 +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.
-//
-// SRPC-abstraction wrappers around PPB_InputEvent functions.
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp_input_event.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_input_event.h"
-
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::DeserializeTo;
-
-void PpbInputEventRpcServer::PPB_InputEvent_RequestInputEvents(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    int32_t event_classes,
-    int32_t filtering,
-    int32_t* success)  {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  *success = PP_ERROR_FAILED;
-  DebugPrintf("PPB_InputEvent::RequestInputEvents: instance=%"NACL_PRId32", "
-              "event_classes=%"NACL_PRIu32", filtering=%"NACL_PRId32"\n",
-              instance, static_cast<uint32_t>(event_classes), filtering);
-  const PPB_InputEvent* input_event_if = ppapi_proxy::PPBInputEventInterface();
-  if (!input_event_if) {
-    *success = PP_ERROR_NOTSUPPORTED;
-    DebugPrintf("PPB_InputEvent::RequestInputEvents: success=%"NACL_PRId32"\n",
-                *success);
-    return;
-  }
-  if (filtering) {
-    *success = input_event_if->RequestFilteringInputEvents(
-        instance,
-        static_cast<uint32_t>(event_classes));
-  } else {
-    *success = input_event_if->RequestInputEvents(
-        instance,
-        static_cast<uint32_t>(event_classes));
-  }
-  DebugPrintf("PPB_InputEvent::RequestInputEvents: success=%"NACL_PRId32"\n",
-              *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbInputEventRpcServer::PPB_InputEvent_ClearInputEventRequest(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    int32_t event_classes)  {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  DebugPrintf("PPB_InputEvent::ClearInputEventRequest: instance=%"NACL_PRId32
-              ", event_classes=%"NACL_PRIu32"\n",
-              instance, static_cast<uint32_t>(event_classes));
-  const PPB_InputEvent* input_event_if = ppapi_proxy::PPBInputEventInterface();
-  if (!input_event_if) {
-    return;
-  }
-  input_event_if->ClearInputEventRequest(instance,
-                                         static_cast<uint32_t>(event_classes));
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbInputEventRpcServer::PPB_InputEvent_CreateMouseInputEvent(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    int32_t type,  // PP_InputEvent_Type
-    double time_stamp,  // PP_TimeTicks
-    int32_t modifiers,  // uint32_t
-    int32_t mouse_button,  // PP_InputEvent_MouseButton
-    int32_t position_x,  // PP_Point.x
-    int32_t position_y,  // PP_Point.y
-    int32_t click_count,
-    int32_t movement_x,  // PP_Point.x
-    int32_t movement_y,  // PP_Point.y
-    PP_Resource* resource_id) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  *resource_id = 0;
-  // TODO(dmichael): Add DebugPrintf.
-  const PPB_MouseInputEvent* input_event_if =
-      ppapi_proxy::PPBMouseInputEventInterface();
-  if (!input_event_if) {
-    return;
-  }
-  PP_Point mouse_position = { position_x, position_y };
-  PP_Point mouse_movement = { movement_x, movement_y };
-  *resource_id = input_event_if->Create(
-        instance,
-        static_cast<PP_InputEvent_Type>(type),
-        static_cast<PP_TimeTicks>(time_stamp),
-        static_cast<uint32_t>(modifiers),
-        static_cast<PP_InputEvent_MouseButton>(mouse_button),
-        &mouse_position,
-        click_count,
-        &mouse_movement);
-  DebugPrintf("PPB_InputEvent::CreateMouseInputEvent: resource_id="
-              "%"NACL_PRId32"\n",
-              *resource_id);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbInputEventRpcServer::PPB_InputEvent_CreateKeyboardInputEvent(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    int32_t type,  // PP_InputEvent_Type
-    double time_stamp,  // PP_TimeTicks
-    int32_t modifiers,  // uint32_t
-    int32_t key_code,
-    nacl_abi_size_t character_size,
-    char* character_bytes,
-    PP_Resource* resource_id) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  *resource_id = 0;
-  // TODO(dmichael): Add DebugPrintf.
-  const PPB_KeyboardInputEvent* input_event_if =
-      ppapi_proxy::PPBKeyboardInputEventInterface();
-  if (!input_event_if) {
-    return;
-  }
-  PP_Var character_text;
-  if (!DeserializeTo(character_bytes, character_size, 1, &character_text)) {
-    return;
-  }
-
-  *resource_id = input_event_if->Create(instance,
-                                        static_cast<PP_InputEvent_Type>(type),
-                                        static_cast<PP_TimeTicks>(time_stamp),
-                                        static_cast<uint32_t>(modifiers),
-                                        key_code,
-                                        character_text);
-  DebugPrintf("PPB_InputEvent::CreateKeyboardInputEvent: resource_id="
-              "%"NACL_PRId32"\n",
-              *resource_id);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbInputEventRpcServer::PPB_InputEvent_CreateWheelInputEvent(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    double time_stamp,  // PP_TimeTicks
-    int32_t modifiers,  // uint32_t
-    double delta_x,  // PP_FloatPoint.x
-    double delta_y,  // PP_FloatPoint.y
-    double ticks_x,  // PP_FloatPoint.x
-    double ticks_y,  // PP_FloatPoint.y
-    int32_t scroll_by_page,  // PP_Bool
-    PP_Resource* resource_id) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  *resource_id = 0;
-  // TODO(dmichael): Add DebugPrintf.
-  const PPB_WheelInputEvent* input_event_if =
-      ppapi_proxy::PPBWheelInputEventInterface();
-  if (!input_event_if) {
-    return;
-  }
-  PP_FloatPoint wheel_delta = { static_cast<float>(delta_x),
-                                static_cast<float>(delta_y) };
-  PP_FloatPoint wheel_ticks = { static_cast<float>(ticks_x),
-                                static_cast<float>(ticks_y) };
-  *resource_id = input_event_if->Create(
-        instance,
-        static_cast<PP_TimeTicks>(time_stamp),
-        static_cast<uint32_t>(modifiers),
-        &wheel_delta,
-        &wheel_ticks,
-        PP_FromBool(scroll_by_page));
-  DebugPrintf("PPB_InputEvent::CreateWheelInputEvent: resource_id="
-              "%"NACL_PRId32"\n",
-              *resource_id);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_instance_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_instance_rpc_server.cc
deleted file mode 100644
index 5436bb2..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_instance_rpc_server.cc
+++ /dev/null
@@ -1,46 +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.
-//
-// SRPC-abstraction wrappers around PPB_Instance functions.
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "srpcgen/ppb_rpc.h"
-
-void PpbInstanceRpcServer::PPB_Instance_BindGraphics(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    PP_Resource graphics_device,
-    // outputs
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Bool pp_success =
-      ppapi_proxy::PPBInstanceInterface()->BindGraphics(
-        instance,
-        graphics_device);
-  *success = PP_ToBool(pp_success);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbInstanceRpcServer::PPB_Instance_IsFullFrame(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    // outputs
-    int32_t* is_full_frame) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Bool pp_is_full_frame =
-      ppapi_proxy::PPBInstanceInterface()->IsFullFrame(instance);
-  *is_full_frame = PP_ToBool(pp_is_full_frame);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_messaging_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_messaging_rpc_server.cc
deleted file mode 100644
index 0ffc0b5..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_messaging_rpc_server.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "srpcgen/ppb_rpc.h"
-
-// This is here due to a Windows API collision.
-#ifdef PostMessage
-#undef PostMessage
-#endif
-
-using ppapi_proxy::PPBMessagingInterface;
-using ppapi_proxy::PPBVarInterface;
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::DeserializeTo;
-
-void PpbMessagingRpcServer::PPB_Messaging_PostMessage(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    nacl_abi_size_t message_size,
-    char* message_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Var message;
-  if (!DeserializeTo(message_bytes, message_size, 1, &message))
-    return;
-
-  PPBMessagingInterface()->PostMessage(instance, message);
-
-  // In the case of a string, DeserializeTo creates a PP_Var with a reference-
-  // count of 1. We must release the var, or it will stay in the browser's map.
-  PPBVarInterface()->Release(message);
-
-  DebugPrintf("PPB_Messaging::PostMessage: instance=%"NACL_PRId32"\n",
-              instance);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_mouse_cursor_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_mouse_cursor_rpc_server.cc
deleted file mode 100644
index 96c4687..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_mouse_cursor_rpc_server.cc
+++ /dev/null
@@ -1,49 +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.
-//
-// SRPC-abstraction wrappers around PPB_MouseCursor functions.
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_point.h"
-#include "ppapi/c/ppb_image_data.h"
-#include "ppapi/c/ppb_mouse_cursor.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::PPBMouseCursorInterface;
-
-void PpbMouseCursorRpcServer::PPB_MouseCursor_SetCursor(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    int32_t type,
-    PP_Resource custom_image,
-    nacl_abi_size_t hot_spot_size, char* hot_spot,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Point* pp_hot_spot = NULL;
-  if (hot_spot_size != 0) {
-    if (hot_spot_size != sizeof(struct PP_Point))
-      return;
-    pp_hot_spot = reinterpret_cast<struct PP_Point*>(hot_spot);
-  }
-  PP_Bool pp_success = PPBMouseCursorInterface()->SetCursor(
-      instance,
-      static_cast<PP_MouseCursor_Type>(type),
-      custom_image,
-      pp_hot_spot);
-  *success = PP_ToBool(pp_success);
-
-  DebugPrintf("PPB_MouseCursor::SetCursor: success=%"NACL_PRId32"\n",
-              *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_mouse_lock_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_mouse_lock_rpc_server.cc
deleted file mode 100644
index f38a710..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_mouse_lock_rpc_server.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// SRPC-abstraction wrappers around PPB_MouseLock functions.
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_mouse_lock.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::DeleteRemoteCallbackInfo;
-using ppapi_proxy::MakeRemoteCompletionCallback;
-using ppapi_proxy::PPBMouseLockInterface;
-
-void PpbMouseLockRpcServer::PPB_MouseLock_LockMouse(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    int32_t callback_id,
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback = MakeRemoteCompletionCallback(
-      rpc->channel, callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error = PPBMouseLockInterface()->LockMouse(instance, remote_callback);
-  DebugPrintf("PPB_MouseLock::LockMouse: pp_error=%"NACL_PRId32"\n", *pp_error);
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbMouseLockRpcServer::PPB_MouseLock_UnlockMouse(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-  DebugPrintf("PPB_MouseLock::UnlockMouse\n");
-  PPBMouseLockInterface()->UnlockMouse(instance);
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_net_address_private_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_net_address_private_rpc_server.cc
deleted file mode 100644
index bf9566f..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_net_address_private_rpc_server.cc
+++ /dev/null
@@ -1,338 +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.
-//
-// SRPC-abstraction wrappers around PPB_NetAddress_Private functions.
-
-#include <limits>
-
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/private/ppb_net_address_private.h"
-#include "ppapi/cpp/var.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::PPBNetAddressPrivateInterface;
-using ppapi_proxy::SerializeTo;
-using ppapi_proxy::kMaxReturnVarSize;
-
-void PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_AreEqual(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    nacl_abi_size_t addr1_bytes, char* addr1,
-    nacl_abi_size_t addr2_bytes, char* addr2,
-    // output
-    int32_t* equals) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (addr1_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private))) {
-    return;
-  }
-  if (addr2_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private))) {
-    return;
-  }
-
-  PP_Bool pp_equals =
-      PPBNetAddressPrivateInterface()->AreEqual(
-          reinterpret_cast<PP_NetAddress_Private*>(addr1),
-          reinterpret_cast<PP_NetAddress_Private*>(addr2));
-
-  DebugPrintf("PPB_NetAddress_Private::AreEqual: pp_equals=%d\n",
-              pp_equals);
-
-  *equals = (pp_equals == PP_TRUE);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_AreHostsEqual(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    nacl_abi_size_t addr1_bytes, char* addr1,
-    nacl_abi_size_t addr2_bytes, char* addr2,
-    // output
-    int32_t* equals) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (addr1_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private))) {
-    return;
-  }
-  if (addr2_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private))) {
-    return;
-  }
-
-  PP_Bool pp_equals =
-      PPBNetAddressPrivateInterface()->AreHostsEqual(
-          reinterpret_cast<PP_NetAddress_Private*>(addr1),
-          reinterpret_cast<PP_NetAddress_Private*>(addr2));
-
-  DebugPrintf("PPB_NetAddress_Private::AreHostsEqual: pp_equals=%d\n",
-              pp_equals);
-
-  *equals = (pp_equals == PP_TRUE);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_Describe(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    int32_t module,
-    nacl_abi_size_t addr_bytes, char* addr,
-    int32_t include_port,
-    // output
-    nacl_abi_size_t* description_bytes, char* description) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (addr_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private))) {
-    return;
-  }
-  if (include_port != PP_FALSE && include_port != PP_TRUE)
-    return;
-  if (*description_bytes != static_cast<nacl_abi_size_t>(kMaxReturnVarSize))
-    return;
-
-  PP_Var pp_address = PPBNetAddressPrivateInterface()->Describe(
-      module,
-      reinterpret_cast<PP_NetAddress_Private*>(addr),
-      static_cast<PP_Bool>(include_port));
-  pp::Var address(pp::PASS_REF, pp_address);
-
-  if (!SerializeTo(&address.pp_var(), description, description_bytes))
-    return;
-
-  DebugPrintf("PPB_NetAddress_Private::Describe: description=%s\n",
-              address.AsString().c_str());
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_ReplacePort(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    nacl_abi_size_t src_addr_bytes, char* src_addr,
-    int32_t port,
-    // output
-    nacl_abi_size_t* dst_addr_bytes, char* dst_addr,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (src_addr_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private))) {
-    return;
-  }
-  if (port < 0 || port > std::numeric_limits<uint16_t>::max())
-    return;
-  if (*dst_addr_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private))) {
-    return;
-  }
-
-  PP_Bool pp_success = PPBNetAddressPrivateInterface()->ReplacePort(
-      reinterpret_cast<PP_NetAddress_Private*>(src_addr),
-      static_cast<uint16_t>(port),
-      reinterpret_cast<PP_NetAddress_Private*>(dst_addr));
-
-  DebugPrintf("PPB_NetAddress_Private::ReplacePort: pp_success=%d\n",
-              pp_success);
-
-  *success = (pp_success == PP_TRUE);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_GetAnyAddress(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    int32_t is_ipv6,
-    // output
-    nacl_abi_size_t* addr_bytes, char* addr) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (is_ipv6 != PP_FALSE && is_ipv6 != PP_TRUE)
-    return;
-  if (*addr_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private))) {
-    return;
-  }
-
-  PPBNetAddressPrivateInterface()->GetAnyAddress(
-      static_cast<PP_Bool>(is_ipv6),
-      reinterpret_cast<PP_NetAddress_Private*>(addr));
-
-  DebugPrintf("PPB_NetAddress_Private::GetAnyAddress\n");
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_GetFamily(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    nacl_abi_size_t addr_bytes, char* addr,
-    // output
-    int32_t* addr_family) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (addr_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private))) {
-    return;
-  }
-
-  *addr_family = static_cast<int32_t>(
-      PPBNetAddressPrivateInterface()->GetFamily(
-          reinterpret_cast<PP_NetAddress_Private*>(addr)));
-
-  DebugPrintf("PPB_NetAddress_Private::GetFamily\n");
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_GetPort(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    nacl_abi_size_t addr_bytes, char* addr,
-    // output
-    int32_t* port) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (addr_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private))) {
-    return;
-  }
-
-  *port = PPBNetAddressPrivateInterface()->GetPort(
-      reinterpret_cast<PP_NetAddress_Private*>(addr));
-
-  DebugPrintf("PPB_NetAddress_Private::GetPort\n");
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_GetAddress(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    nacl_abi_size_t addr_bytes, char* addr,
-    // output
-    nacl_abi_size_t* address_bytes, char* address,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (addr_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private))) {
-    return;
-  }
-
-  PP_Bool pp_success = PPBNetAddressPrivateInterface()->GetAddress(
-      reinterpret_cast<PP_NetAddress_Private*>(addr),
-      address, static_cast<uint16_t>(*address_bytes));
-
-  DebugPrintf("PPB_NetAddress_Private::GetAddress: pp_success=%d\n",
-              pp_success);
-
-  *success = (pp_success == PP_TRUE);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_GetScopeID(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    nacl_abi_size_t addr_bytes, char* addr,
-    // output
-    int32_t* scope_id) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (addr_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private))) {
-    return;
-  }
-
-  *scope_id = PPBNetAddressPrivateInterface()->GetScopeID(
-      reinterpret_cast<PP_NetAddress_Private*>(addr));
-
-  DebugPrintf("PPB_NetAddress_Private::GetScopeID\n");
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void
-PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_CreateFromIPv4Address(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    nacl_abi_size_t ip_bytes, char* ip,
-    int32_t port,
-    // output
-    nacl_abi_size_t* addr_bytes, char* addr) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (ip_bytes != static_cast<nacl_abi_size_t>(4))
-    return;
-  if (port < 0 || port > std::numeric_limits<uint16_t>::max())
-    return;
-  if (*addr_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private))) {
-    return;
-  }
-
-  PPBNetAddressPrivateInterface()->CreateFromIPv4Address(
-      reinterpret_cast<uint8_t*>(ip), static_cast<uint16_t>(port),
-      reinterpret_cast<PP_NetAddress_Private*>(addr));
-
-  DebugPrintf("PPB_NetAddress_Private::CreateFromIPv4Address\n");
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void
-PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_CreateFromIPv6Address(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    nacl_abi_size_t ip_bytes, char* ip,
-    int32_t scope_id,
-    int32_t port,
-    // output
-    nacl_abi_size_t* addr_bytes, char* addr) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (ip_bytes != static_cast<nacl_abi_size_t>(16))
-    return;
-  if (port < 0 || port > std::numeric_limits<uint16_t>::max())
-    return;
-  if (*addr_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private))) {
-    return;
-  }
-
-  PPBNetAddressPrivateInterface()->CreateFromIPv6Address(
-      reinterpret_cast<uint8_t*>(ip), static_cast<uint32_t>(scope_id),
-      static_cast<uint16_t>(port),
-      reinterpret_cast<PP_NetAddress_Private*>(addr));
-
-  DebugPrintf("PPB_NetAddress_Private::CreateFromIPv6Address\n");
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_network_list_private_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_network_list_private_rpc_server.cc
deleted file mode 100644
index 7b1ac72..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_network_list_private_rpc_server.cc
+++ /dev/null
@@ -1,177 +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.
-//
-// SRPC-abstraction wrappers around PPB_NetworkList_Private functions.
-
-#include <string.h>
-#include <algorithm>
-#include <limits>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/private/ppb_udp_socket_private.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::DeleteRemoteCallbackInfo;
-using ppapi_proxy::MakeRemoteCompletionCallback;
-using ppapi_proxy::PPBNetworkListPrivateInterface;
-using ppapi_proxy::SerializeTo;
-
-void PpbNetworkListPrivateServer::PPB_NetworkList_Private_IsNetworkList(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t* out_bool) {
-  DebugPrintf("PPB_NetworkList_Private::IsNetworkList: "
-              "resource=%"NACL_PRId32"\n", resource);
-
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Bool pp_success =
-      PPBNetworkListPrivateInterface()->IsNetworkList(resource);
-  *out_bool = PP_ToBool(pp_success);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbNetworkListPrivateServer::PPB_NetworkList_Private_GetCount(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t* count) {
-  DebugPrintf("PPB_NetworkList_Private::GetCount: "
-              "resource=%"NACL_PRId32"\n", resource);
-
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  *count = PPBNetworkListPrivateInterface()->GetCount(resource);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbNetworkListPrivateServer::PPB_NetworkList_Private_GetName(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t index,
-    nacl_abi_size_t* name_bytes, char* name) {
-  DebugPrintf("PPB_NetworkList_Private::GetName: "
-              "resource=%"NACL_PRId32" index=%"NACL_PRId32"\n",
-              resource, index);
-
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Var pp_string =
-      PPBNetworkListPrivateInterface()->GetName(resource, index);
-  if (SerializeTo(&pp_string, name, name_bytes))
-    rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbNetworkListPrivateServer::PPB_NetworkList_Private_GetType(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t index,
-    int32_t* type) {
-  DebugPrintf("PPB_NetworkList_Private::GetType: "
-              "resource=%"NACL_PRId32" index=%"NACL_PRId32"\n",
-              resource, index);
-
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  *type = PPBNetworkListPrivateInterface()->GetType(resource, index);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbNetworkListPrivateServer::PPB_NetworkList_Private_GetState(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t index,
-    int32_t* state) {
-  DebugPrintf("PPB_NetworkList_Private::GetState: "
-              "resource=%"NACL_PRId32" index=%"NACL_PRId32"\n",
-              resource, index);
-
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  *state = PPBNetworkListPrivateInterface()->GetState(resource, index);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbNetworkListPrivateServer::PPB_NetworkList_Private_GetIpAddresses(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t index,
-    nacl_abi_size_t* addr_bytes, char* addr,
-    int32_t* result) {
-  DebugPrintf("PPB_NetworkList_Private::GetIpAddresses: "
-              "resource=%"NACL_PRId32" index=%"NACL_PRId32"\n",
-              resource, index);
-
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  int addr_buffer_size = *addr_bytes / sizeof(PP_NetAddress_Private);
-  *result = PPBNetworkListPrivateInterface()->GetIpAddresses(
-      resource, index,
-      reinterpret_cast<PP_NetAddress_Private*>(addr), addr_buffer_size);
-
-  *addr_bytes = std::min(
-      static_cast<nacl_abi_size_t>(*result * sizeof(PP_NetAddress_Private)),
-      *addr_bytes);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbNetworkListPrivateServer::PPB_NetworkList_Private_GetDisplayName(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t index,
-    nacl_abi_size_t* display_name_bytes, char* display_name) {
-  DebugPrintf("PPB_NetworkList_Private::GetDisplayName: "
-              "resource=%"NACL_PRId32" index=%"NACL_PRId32"\n",
-              resource, index);
-
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Var pp_string =
-      PPBNetworkListPrivateInterface()->GetDisplayName(resource, index);
-
-  if (SerializeTo(&pp_string, display_name, display_name_bytes))
-    rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbNetworkListPrivateServer::PPB_NetworkList_Private_GetMTU(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t index,
-    int32_t* mtu) {
-  DebugPrintf("PPB_NetworkList_Private::GetMTU: "
-              "resource=%"NACL_PRId32" index=%"NACL_PRId32"\n",
-              resource, index);
-
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  *mtu = PPBNetworkListPrivateInterface()->GetMTU(resource, index);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_network_monitor_private_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_network_monitor_private_rpc_server.cc
deleted file mode 100644
index 1078d2b..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_network_monitor_private_rpc_server.cc
+++ /dev/null
@@ -1,90 +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.
-//
-// SRPC-abstraction wrappers around PPB_NetworkMonitor_Private functions.
-
-#include <string.h>
-#include <limits>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/private/ppb_udp_socket_private.h"
-#include "srpcgen/ppb_rpc.h"
-#include "srpcgen/ppp_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::DeleteRemoteCallbackInfo;
-using ppapi_proxy::MakeRemoteCompletionCallback;
-using ppapi_proxy::PPBNetworkMonitorPrivateInterface;
-
-namespace {
-
-struct NetworkListCallbackData {
-  PP_Instance instance_id;
-  PP_Resource network_monitor;
-};
-
-void NetworkListChangedCallback(void* user_data, PP_Resource network_list) {
-  NetworkListCallbackData* data =
-      reinterpret_cast<NetworkListCallbackData*>(user_data);
-
-  NaClSrpcChannel* nacl_srpc_channel = ppapi_proxy::GetMainSrpcChannel(
-      data->instance_id);
-  PppNetworkMonitorPrivateRpcClient::
-      PPP_NetworkMonitor_Private_NetworkListChanged(
-          nacl_srpc_channel, data->network_monitor, network_list);
-}
-
-}  // namespace
-
-void PpbNetworkMonitorPrivateServer::PPB_NetworkMonitor_Private_Create(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    PP_Resource* resource) {
-  DebugPrintf("PPB_NetworkMonitor_Private::Create: "
-              "instance=%"NACL_PRId32"\n", instance);
-
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  // NetworkListCallbackData is always leaked - it's non-trivial to detect when
-  // NetworkMonitor resource is destroyed. This code is going to be removed
-  // soon, so it doesn't make sense to fix it.
-  //
-  // TODO(sergeyu): Fix this leak if for any reason we decide to keep this code
-  // long term.
-  NetworkListCallbackData* callback_data = new NetworkListCallbackData();
-  callback_data->instance_id = instance;
-
-  *resource = PPBNetworkMonitorPrivateInterface()->Create(
-      instance, &NetworkListChangedCallback, callback_data);
-
-  callback_data->network_monitor = *resource;
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void
-PpbNetworkMonitorPrivateServer::PPB_NetworkMonitor_Private_IsNetworkMonitor(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource resource,
-    int32_t* out_bool) {
-  DebugPrintf("PPB_NetworkMonitor_Private::IsNetworkMonitor: "
-              "resource=%"NACL_PRId32"\n", resource);
-
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Bool pp_success =
-      PPBNetworkMonitorPrivateInterface()->IsNetworkMonitor(resource);
-  *out_bool = PP_ToBool(pp_success);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_rpc_server.cc
deleted file mode 100644
index 4c52f66..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_rpc_server.cc
+++ /dev/null
@@ -1,25 +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 "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::GetBrowserInterface;
-
-void PpbRpcServer::PPB_GetInterface(NaClSrpcRpc* rpc,
-                                    NaClSrpcClosure* done,
-                                    const char* interface_name,
-                                    int32_t* exports_interface_name) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  // Since the proxy will make calls to proxied interfaces, we need simply
-  // to know whether the plugin exports a given interface.
-  const void* browser_interface = GetBrowserInterface(interface_name);
-  DebugPrintf("PPB_GetInterface('%s'): %p\n",
-              interface_name, browser_interface);
-  *exports_interface_name = (browser_interface != NULL);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_tcp_server_socket_private_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_tcp_server_socket_private_rpc_server.cc
deleted file mode 100644
index f501f31..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_tcp_server_socket_private_rpc_server.cc
+++ /dev/null
@@ -1,153 +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.
-//
-// SRPC-abstraction wrappers around PPB_TCPServerSocket_Private functions.
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/private/ppb_tcp_server_socket_private.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::DeleteRemoteCallbackInfo;
-using ppapi_proxy::MakeRemoteCompletionCallback;
-using ppapi_proxy::PPBTCPServerSocketPrivateInterface;
-
-namespace {
-
-bool SuccessResourceRead(int32_t num_bytes) {
-  return num_bytes >= 0;
-}
-
-nacl_abi_size_t ResourceReadSize(int32_t result) {
-  UNREFERENCED_PARAMETER(result);
-  return static_cast<nacl_abi_size_t>(sizeof(PP_Resource));
-}
-
-}  // namespace
-
-void PpbTCPServerSocketPrivateRpcServer::PPB_TCPServerSocket_Private_Create(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    // outputs
-    PP_Resource* resource) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  *resource = PPBTCPServerSocketPrivateInterface()->Create(instance);
-
-  DebugPrintf("PPB_TCPServerSocket_Private::Create: " \
-              "resource=%"NACL_PRId32"\n", *resource);
-}
-
-void PpbTCPServerSocketPrivateRpcServer::
-PPB_TCPServerSocket_Private_IsTCPServerSocket(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource resource,
-    // output
-    int32_t* is_tcp_server_socket) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  PP_Bool pp_success =
-      PPBTCPServerSocketPrivateInterface()->IsTCPServerSocket(resource);
-  *is_tcp_server_socket = PP_ToBool(pp_success);
-
-  DebugPrintf("PPB_TCPServerSocket_Private::IsTCPServerSocket: " \
-              "is_tcp_server_socket=%d\n", *is_tcp_server_socket);
-}
-
-void PpbTCPServerSocketPrivateRpcServer::PPB_TCPServerSocket_Private_Listen(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource tcp_server_socket,
-    nacl_abi_size_t addr_bytes, char* addr,
-    int32_t backlog,
-    int32_t callback_id,
-    // output
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (addr_bytes != static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)))
-    return;
-
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error = PPBTCPServerSocketPrivateInterface()->Listen(
-      tcp_server_socket,
-      reinterpret_cast<PP_NetAddress_Private*>(addr),
-      backlog,
-      remote_callback);
-
-  DebugPrintf("PPB_TCPServerSocket_Private::Listen: " \
-              "pp_error=%"NACL_PRId32"\n", *pp_error);
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbTCPServerSocketPrivateRpcServer::PPB_TCPServerSocket_Private_Accept(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource tcp_server_socket,
-    int32_t callback_id,
-    // outputs
-    PP_Resource* tcp_socket,
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  char* callback_buffer = NULL;
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel,
-                                   callback_id,
-                                   sizeof(PP_Resource),
-                                   &callback_buffer,
-                                   SuccessResourceRead,
-                                   ResourceReadSize);
-  *pp_error = PPBTCPServerSocketPrivateInterface()->Accept(
-      tcp_server_socket,
-      reinterpret_cast<PP_Resource*>(callback_buffer),
-      remote_callback);
-
-  DebugPrintf("PPB_TCPServerSocket_Private::Accept: "
-              "pp_error=%"NACL_PRId32"\n", *pp_error);
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  else
-    *tcp_socket = 0;
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbTCPServerSocketPrivateRpcServer::
-PPB_TCPServerSocket_Private_StopListening(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource tcp_server_socket) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  DebugPrintf("PPB_TCPServerSocket_Private::StopListening: " \
-              "tcp_socket=%"NACL_PRId32"\n", tcp_server_socket);
-
-  PPBTCPServerSocketPrivateInterface()->StopListening(tcp_server_socket);
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_tcp_socket_private_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_tcp_socket_private_rpc_server.cc
deleted file mode 100644
index 01c6897..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_tcp_socket_private_rpc_server.cc
+++ /dev/null
@@ -1,304 +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.
-//
-// SRPC-abstraction wrappers around PPB_TCPSocket_Private functions.
-
-#include <string.h>
-#include <limits>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/private/ppb_tcp_socket_private.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::DeleteRemoteCallbackInfo;
-using ppapi_proxy::MakeRemoteCompletionCallback;
-using ppapi_proxy::PPBTCPSocketPrivateInterface;
-
-void PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_Create(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Instance instance,
-    // output
-    PP_Resource* resource) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  *resource = PPBTCPSocketPrivateInterface()->Create(instance);
-
-  DebugPrintf("PPB_TCPSocket_Private::Create: resource=%"NACL_PRId32"\n",
-              *resource);
-}
-
-void PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_IsTCPSocket(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource resource,
-    // output
-    int32_t* is_tcp_socket) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  PP_Bool pp_success =
-      PPBTCPSocketPrivateInterface()->IsTCPSocket(resource);
-  *is_tcp_socket = PP_ToBool(pp_success);
-  DebugPrintf("PPB_TCPSocket_Private::IsTCPSocket: is_tcp_socket=%d\n",
-              *is_tcp_socket);
-}
-
-void PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_Connect(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource tcp_socket,
-    const char* host,
-    int32_t port,
-    int32_t callback_id,
-    // output
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error = PPBTCPSocketPrivateInterface()->Connect(
-      tcp_socket,
-      host,
-      port,
-      remote_callback);
-
-  DebugPrintf("PPB_TCPSocket_Private::Connect: "
-              "pp_error=%"NACL_PRId32"\n", *pp_error);
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)  // Async error.
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_ConnectWithNetAddress(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource tcp_socket,
-    nacl_abi_size_t addr_bytes, char* addr,
-    int32_t callback_id,
-    // output
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (addr_bytes != sizeof(PP_NetAddress_Private))
-    return;
-
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error = PPBTCPSocketPrivateInterface()->ConnectWithNetAddress(
-      tcp_socket,
-      reinterpret_cast<struct PP_NetAddress_Private*>(addr),
-      remote_callback);
-
-  DebugPrintf("PPB_TCPSocket_Private::ConnectWithNetAddress: "
-              "pp_error=%"NACL_PRId32"\n", *pp_error);
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)  // Async error.
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_GetLocalAddress(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource tcp_socket,
-    // output
-    nacl_abi_size_t* local_addr_bytes, char* local_addr,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (*local_addr_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)))
-    return;
-
-  PP_Bool pp_success = PPBTCPSocketPrivateInterface()->GetLocalAddress(
-      tcp_socket, reinterpret_cast<struct PP_NetAddress_Private*>(local_addr));
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_TCPSocket_Private::GetLocalAddress: success=%d\n",
-              *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_GetRemoteAddress(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource tcp_socket,
-    // output
-    nacl_abi_size_t* remote_addr_bytes, char* remote_addr,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (*remote_addr_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)))
-    return;
-
-  PP_Bool pp_success =
-      PPBTCPSocketPrivateInterface()->GetRemoteAddress(
-          tcp_socket,
-          reinterpret_cast<struct PP_NetAddress_Private*>(remote_addr));
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_TCPSocket_Private::GetRemoteAddress: success=%d\n",
-              *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_SSLHandshake(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource tcp_socket,
-    const char* server_name,
-    int32_t server_port,
-    int32_t callback_id,
-    // output
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback = MakeRemoteCompletionCallback(
-      rpc->channel, callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error = PPBTCPSocketPrivateInterface()->SSLHandshake(
-      tcp_socket,
-      server_name,
-      server_port,
-      remote_callback);
-
-  DebugPrintf("PPB_TCPSocket_Private::SSLHandshake: "
-              "pp_error=%"NACL_PRId32"\n", *pp_error);
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING) // Async error.
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_Read(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure *done,
-    // input
-    PP_Resource tcp_socket,
-    int32_t bytes_to_read,
-    int32_t callback_id,
-    // output
-    nacl_abi_size_t* buffer_bytes, char* buffer,
-    int32_t* pp_error_or_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (*buffer_bytes != static_cast<nacl_abi_size_t>(bytes_to_read))
-    return;
-
-  char* callback_buffer = NULL;
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id, bytes_to_read,
-                                   &callback_buffer);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error_or_bytes = PPBTCPSocketPrivateInterface()->Read(
-      tcp_socket,
-      callback_buffer,
-      bytes_to_read,
-      remote_callback);
-
-  DebugPrintf("PPB_TCPSocket_Private::Read: "
-              "pp_error_or_bytes=%"NACL_PRId32"\n", *pp_error_or_bytes);
-
-  if (!(*pp_error_or_bytes <= bytes_to_read))
-    return;
-
-  if (*pp_error_or_bytes > 0) {  // Bytes read into |callback_buffer|.
-    // No callback scheduled.
-    if (!(static_cast<nacl_abi_size_t>(*pp_error_or_bytes) <= *buffer_bytes))
-      return;
-    *buffer_bytes = static_cast<nacl_abi_size_t>(*pp_error_or_bytes);
-    memcpy(buffer, callback_buffer, *buffer_bytes);
-    DeleteRemoteCallbackInfo(remote_callback);
-  } else if (*pp_error_or_bytes != PP_OK_COMPLETIONPENDING) {  // Async error.
-    // No callback scheduled.
-    *buffer_bytes = 0;
-    DeleteRemoteCallbackInfo(remote_callback);
-  } else {
-    // Callback scheduled.
-    *buffer_bytes = 0;
-  }
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_Write(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource tcp_socket,
-    // input
-    nacl_abi_size_t buffer_bytes, char* buffer,
-    int32_t bytes_to_write,
-    int32_t callback_id,
-    // output
-    int32_t* pp_error_or_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (!(static_cast<nacl_abi_size_t>(bytes_to_write) <= buffer_bytes))
-    return;
-
-  PP_CompletionCallback remote_callback = MakeRemoteCompletionCallback(
-      rpc->channel, callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error_or_bytes = PPBTCPSocketPrivateInterface()->Write(
-      tcp_socket,
-      buffer,
-      bytes_to_write,
-      remote_callback);
-
-  DebugPrintf("PPB_TCPSocket_Private::Write: "
-              "pp_error_or_bytes=%"NACL_PRId32"\n", *pp_error_or_bytes);
-
-  // Bytes must be written asynchronously.
-  if (*pp_error_or_bytes != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_Disconnect(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource tcp_socket) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  DebugPrintf("PPB_TCPSocket_Private::Disconnect: tcp_socket=%"NACL_PRId32"\n",
-              tcp_socket);
-
-  PPBTCPSocketPrivateInterface()->Disconnect(tcp_socket);
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_testing_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_testing_rpc_server.cc
deleted file mode 100644
index 8f3ab6e..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_testing_rpc_server.cc
+++ /dev/null
@@ -1,137 +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.
-//
-// SRPC-abstraction wrappers around PPB_Testing_Dev functions.
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
-#include "ppapi/c/dev/ppb_testing_dev.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_point.h"
-#include "ppapi/cpp/var.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::PPBTestingInterface;
-
-void PpbTestingRpcServer::PPB_Testing_ReadImageData(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource device_context_2d,
-    PP_Resource image,
-    nacl_abi_size_t top_left_size, char* top_left,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (top_left_size != sizeof(struct PP_Point))
-    return;
-  struct PP_Point* pp_top_left =
-      reinterpret_cast<struct PP_Point*>(top_left);
-
-  PP_Bool pp_success =
-      PPBTestingInterface()->ReadImageData(device_context_2d,
-                                           image,
-                                           pp_top_left);
-  *success = PP_ToBool(pp_success);
-
-  DebugPrintf("PPB_Testing_Dev::ReadImageData: "
-              "success=%"NACL_PRId32"\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbTestingRpcServer::PPB_Testing_RunMessageLoop(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PPBTestingInterface()->RunMessageLoop(instance);
-
-  DebugPrintf("PPB_Testing_Dev::RunMessageLoop: instance=%"NACL_PRId32"\n",
-              instance);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbTestingRpcServer::PPB_Testing_QuitMessageLoop(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PPBTestingInterface()->QuitMessageLoop(instance);
-
-  DebugPrintf("PPB_Testing_Dev::QuitMessageLoop: instance=%"NACL_PRId32"\n",
-              instance);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbTestingRpcServer::PPB_Testing_GetLiveObjectsForInstance(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    int32_t* live_objects) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  uint32_t pp_live_objects =
-      PPBTestingInterface()->GetLiveObjectsForInstance(instance);
-  *live_objects = pp_live_objects;
-
-  DebugPrintf("PPB_Testing_Dev::GetLiveObjectsForInstance: "
-              "live_objects=%"NACL_PRId32"\n", *live_objects);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbTestingRpcServer::PPB_Testing_SimulateInputEvent(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    PP_Resource input_event) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PPBTestingInterface()->SimulateInputEvent(instance, input_event);
-
-  DebugPrintf("PPB_Testing::SimulateInputEvent: instance=%"NACL_PRId32"\n",
-              instance);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbTestingRpcServer::PPB_Testing_GetDocumentURL(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    nacl_abi_size_t* components_bytes, char* components,
-    nacl_abi_size_t* url_bytes, char* url) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_URLComponents_Dev* pp_url_components = NULL;
-  if (*components_bytes != 0) {
-    if (*components_bytes != sizeof(struct PP_URLComponents_Dev))
-      return;
-    pp_url_components =
-        reinterpret_cast<struct PP_URLComponents_Dev*>(components);
-  }
-  if (*url_bytes != ppapi_proxy::kMaxReturnVarSize)
-    return;
-
-  struct PP_Var pp_url = PPBTestingInterface()->GetDocumentURL(
-      instance, pp_url_components);
-
-  if (!ppapi_proxy::SerializeTo(&pp_url, url, url_bytes))
-    return;
-
-  DebugPrintf("PPB_Testing_Dev::GetDocumentURL: url=%s\n",
-              pp::Var(pp::PASS_REF, pp_url).AsString().c_str());
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_udp_socket_private_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_udp_socket_private_rpc_server.cc
deleted file mode 100644
index 2137e5d..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_udp_socket_private_rpc_server.cc
+++ /dev/null
@@ -1,282 +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.
-//
-// SRPC-abstraction wrappers around PPB_UDPSocket_Private functions.
-
-#include <string.h>
-#include <limits>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/private/ppb_udp_socket_private.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::DeleteRemoteCallbackInfo;
-using ppapi_proxy::DeserializeTo;
-using ppapi_proxy::MakeRemoteCompletionCallback;
-using ppapi_proxy::PPBUDPSocketPrivateInterface;
-
-void PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_Create(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Instance instance_id,
-    // output
-    PP_Resource* resource) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  *resource = PPBUDPSocketPrivateInterface()->Create(instance_id);
-
-  DebugPrintf("PPB_UDPSocket_Private::Create: "
-              "resource=%"NACL_PRId32"\n", *resource);
-}
-
-void PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_IsUDPSocket(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource resource_id,
-    // output
-    int32_t* is_udp_socket) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  PP_Bool pp_success =
-      PPBUDPSocketPrivateInterface()->IsUDPSocket(resource_id);
-  *is_udp_socket = PP_ToBool(pp_success);
-  DebugPrintf("PPB_UDPSocket_Private::IsUDPSocket: "
-              "is_udp_socket=%d\n", *is_udp_socket);
-}
-
-void PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_SetSocketFeature(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource udp_socket,
-    int32_t name,
-    nacl_abi_size_t value_bytes, char* value,
-    // output
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (name < 0 || name >= PP_UDPSOCKETFEATURE_COUNT) {
-    *pp_error = PP_ERROR_BADARGUMENT;
-    rpc->result = NACL_SRPC_RESULT_OK;
-    return;
-  }
-
-  PP_Var pp_value = PP_MakeUndefined();
-  if (!DeserializeTo(value, value_bytes, 1, &pp_value))
-    return;
-
-  *pp_error = PPBUDPSocketPrivateInterface()->SetSocketFeature(
-      udp_socket,
-      static_cast<PP_UDPSocketFeature_Private>(name),
-      pp_value);
-
-  DebugPrintf("PPB_UDPSocket_Private::SetSocketFeature: "
-              "pp_error=%"NACL_PRId32"\n", *pp_error);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_Bind(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource udp_socket,
-    nacl_abi_size_t addr_bytes, char* addr,
-    int32_t callback_id,
-    // output
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (addr_bytes != sizeof(PP_NetAddress_Private))
-    return;
-
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error = PPBUDPSocketPrivateInterface()->Bind(
-      udp_socket,
-      reinterpret_cast<PP_NetAddress_Private*>(addr),
-      remote_callback);
-
-  DebugPrintf("PPB_UDPSocket_Private::Bind: "
-              "pp_error=%"NACL_PRId32"\n", *pp_error);
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)  // Async error.
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_GetBoundAddress(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource udp_socket,
-    // output
-    nacl_abi_size_t* addr_bytes, char* addr,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (*addr_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)))
-    return;
-
-  PP_Bool pp_success =
-      PPBUDPSocketPrivateInterface()->GetBoundAddress(
-          udp_socket,
-          reinterpret_cast<PP_NetAddress_Private*>(addr));
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_UDPSocket_Private::GetBoundAddress: "
-              "success=%"NACL_PRId32"\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_RecvFrom(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource udp_socket,
-    int32_t num_bytes,
-    int32_t callback_id,
-    // output
-    nacl_abi_size_t* buffer_bytes, char* buffer,
-    int32_t* pp_error_or_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (*buffer_bytes != static_cast<nacl_abi_size_t>(num_bytes))
-    return;
-
-  char* callback_buffer = NULL;
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id, num_bytes,
-                                   &callback_buffer);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error_or_bytes = PPBUDPSocketPrivateInterface()->RecvFrom(
-      udp_socket,
-      callback_buffer,
-      num_bytes,
-      remote_callback);
-
-  DebugPrintf("PPB_UDPSocket_Private::RecvFrom: "
-              "pp_error_or_bytes=%"NACL_PRId32"\n", *pp_error_or_bytes);
-
-  if (!(*pp_error_or_bytes <= num_bytes))
-    return;
-
-  if (*pp_error_or_bytes > 0) {  // Bytes read into |callback_buffer|.
-    // No callback scheduled.
-    if (!(static_cast<nacl_abi_size_t>(*pp_error_or_bytes) <= *buffer_bytes))
-      return;
-    *buffer_bytes = static_cast<nacl_abi_size_t>(*pp_error_or_bytes);
-    memcpy(buffer, callback_buffer, *buffer_bytes);
-    DeleteRemoteCallbackInfo(remote_callback);
-  } else if (*pp_error_or_bytes != PP_OK_COMPLETIONPENDING) {  // Async error.
-    // No callback scheduled.
-    *buffer_bytes = 0;
-    DeleteRemoteCallbackInfo(remote_callback);
-  } else {
-    // Callback scheduled.
-    *buffer_bytes = 0;
-  }
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_GetRecvFromAddress(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource udp_socket,
-    // output
-    nacl_abi_size_t* addr_bytes, char* addr,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (*addr_bytes !=
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)))
-    return;
-
-  PP_Bool pp_success =
-      PPBUDPSocketPrivateInterface()->GetRecvFromAddress(
-          udp_socket,
-          reinterpret_cast<PP_NetAddress_Private*>(addr));
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_UDPSocket_Private::GetRecvFromAddress: "
-              "success=%d\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_SendTo(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource udp_socket,
-    nacl_abi_size_t buffer_bytes, char* buffer,
-    int32_t num_bytes,
-    nacl_abi_size_t addr_bytes, char* addr,
-    int32_t callback_id,
-    // output
-    int32_t* pp_error_or_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  if (addr_bytes != static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)))
-    return;
-  if (!(static_cast<nacl_abi_size_t>(num_bytes) <= buffer_bytes))
-    return;
-
-  PP_CompletionCallback remote_callback = MakeRemoteCompletionCallback(
-      rpc->channel, callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error_or_bytes =
-      PPBUDPSocketPrivateInterface()->SendTo(
-          udp_socket,
-          buffer,
-          num_bytes,
-          reinterpret_cast<PP_NetAddress_Private*>(addr),
-          remote_callback);
-
-  DebugPrintf("PPB_UDPSocket_Private::SendTo: "
-              "pp_error_or_bytes=%"NACL_PRId32"\n", *pp_error_or_bytes);
-
-  // Bytes must be written asynchronously.
-  if (*pp_error_or_bytes != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_Close(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // input
-    PP_Resource udp_socket) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  DebugPrintf("PPB_UDPSocket_Private::Close: "
-              "udp_socket=%"NACL_PRId32"\n", udp_socket);
-
-  PPBUDPSocketPrivateInterface()->Close(udp_socket);
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_url_loader_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_url_loader_rpc_server.cc
deleted file mode 100644
index 69162aa..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_url_loader_rpc_server.cc
+++ /dev/null
@@ -1,242 +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.
-//
-// SRPC-abstraction wrappers around PPB_URLLoader functions.
-
-#include <stdio.h>
-#include <string.h>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_url_loader.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::PPBURLLoaderInterface;
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::MakeRemoteCompletionCallback;
-using ppapi_proxy::DeleteRemoteCallbackInfo;
-
-void PpbURLLoaderRpcServer::PPB_URLLoader_Create(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    // outputs
-    PP_Resource* resource) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  *resource = PPBURLLoaderInterface()->Create(instance);
-  DebugPrintf("PPB_URLLoader::Create: resource=%"NACL_PRId32"\n", *resource);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbURLLoaderRpcServer::PPB_URLLoader_IsURLLoader(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource resource,
-    // outputs
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Bool pp_success = PPBURLLoaderInterface()->IsURLLoader(resource);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_URLLoader::IsURLLoader: success=%d\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbURLLoaderRpcServer::PPB_URLLoader_Open(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource loader,
-    PP_Resource request,
-    int32_t callback_id,
-    // outputs
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id);
-  if (remote_callback.func == NULL)
-    return;
-
-  *pp_error = PPBURLLoaderInterface()->Open(loader, request, remote_callback);
-  DebugPrintf("PPB_URLLoader::Open: pp_error=%"NACL_PRId32"\n", *pp_error);
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)  // Async error.
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbURLLoaderRpcServer::PPB_URLLoader_FollowRedirect(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource loader,
-    int32_t callback_id,
-    // outputs
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id);
-  if (remote_callback.func == NULL)
-    return;
-
-  *pp_error = PPBURLLoaderInterface()->FollowRedirect(loader, remote_callback);
-  DebugPrintf("PPB_URLLoader::FollowRedirect: pp_error=%"NACL_PRId32"\n",
-              *pp_error);
-  if (*pp_error != PP_OK_COMPLETIONPENDING)  // Async error.
-    DeleteRemoteCallbackInfo(remote_callback);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbURLLoaderRpcServer::PPB_URLLoader_GetUploadProgress(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource loader,
-    // outputs
-    int64_t* bytes_sent,
-    int64_t* total_bytes_to_be_sent,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Bool pp_success = PPBURLLoaderInterface()->GetUploadProgress(
-      loader, bytes_sent, total_bytes_to_be_sent);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_URLLoader::GetUploadProgress: success=%d\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbURLLoaderRpcServer::PPB_URLLoader_GetDownloadProgress(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource loader,
-    // outputs
-    int64_t* bytes_received,
-    int64_t* total_bytes_to_be_received,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Bool pp_success = PPBURLLoaderInterface()->GetDownloadProgress(
-      loader, bytes_received, total_bytes_to_be_received);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_URLLoader::GetDownloadProgress: success=%d\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbURLLoaderRpcServer::PPB_URLLoader_GetResponseInfo(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource loader,
-    // outputs
-    PP_Resource* response) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  *response = PPBURLLoaderInterface()->GetResponseInfo(loader);
-  DebugPrintf("PPB_URLLoader::GetResponseInfo: response=%"NACL_PRId32"\n",
-              *response);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbURLLoaderRpcServer::PPB_URLLoader_ReadResponseBody(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource loader,
-    int32_t bytes_to_read,
-    int32_t callback_id,
-    // outputs
-    nacl_abi_size_t* buffer_size, char* buffer,
-    int32_t* pp_error_or_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  CHECK(*buffer_size == static_cast<nacl_abi_size_t>(bytes_to_read));
-
-  // |buffer| is allocated by the rpc server and will be freed after this
-  // function returns. Hence we must provide our own byte storage for
-  // a non-blocking call and tie it to the callback.
-  char* callback_buffer = NULL;
-  PP_CompletionCallback remote_callback = MakeRemoteCompletionCallback(
-      rpc->channel, callback_id, bytes_to_read, &callback_buffer);
-  if (remote_callback.func == NULL)
-    return;
-
-  *pp_error_or_bytes = PPBURLLoaderInterface()->ReadResponseBody(
-      loader, callback_buffer, bytes_to_read, remote_callback);
-  DebugPrintf("PPB_URLLoader::ReadResponseBody: pp_error_or_bytes=%"
-              NACL_PRId32"\n", *pp_error_or_bytes);
-  CHECK(*pp_error_or_bytes <= bytes_to_read);
-
-  if (*pp_error_or_bytes > 0) {  // Bytes read into |callback_buffer|.
-    // No callback scheduled.
-    *buffer_size = static_cast<nacl_abi_size_t>(*pp_error_or_bytes);
-    memcpy(buffer, callback_buffer, *buffer_size);
-    DeleteRemoteCallbackInfo(remote_callback);
-  } else if (*pp_error_or_bytes != PP_OK_COMPLETIONPENDING) {  // Async error.
-    // No callback scheduled.
-    *buffer_size = 0;
-    DeleteRemoteCallbackInfo(remote_callback);
-  } else {
-    // Callback scheduled.
-    *buffer_size = 0;
-   }
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbURLLoaderRpcServer::PPB_URLLoader_FinishStreamingToFile(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource loader,
-    int32_t callback_id,
-    // outputs
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id);
-  if (remote_callback.func == NULL)
-    return;
-
-  *pp_error =
-      PPBURLLoaderInterface()->FinishStreamingToFile(loader, remote_callback);
-  DebugPrintf("PPB_URLLoader::FinishStreamingToFile: pp_error=%"NACL_PRId32"\n",
-              *pp_error);
-  if (*pp_error != PP_OK_COMPLETIONPENDING)  // Async error.
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbURLLoaderRpcServer::PPB_URLLoader_Close(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource loader) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  PPBURLLoaderInterface()->Close(loader);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_url_request_info_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_url_request_info_rpc_server.cc
deleted file mode 100644
index ebb361c..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_url_request_info_rpc_server.cc
+++ /dev/null
@@ -1,120 +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.
-//
-// SRPC-abstraction wrappers around PPB_URLRequestInfo functions.
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/ppb_url_request_info.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::PPBURLRequestInfoInterface;
-using ppapi_proxy::DeserializeTo;
-using ppapi_proxy::DebugPrintf;
-
-void PpbURLRequestInfoRpcServer::PPB_URLRequestInfo_Create(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    // outputs
-    PP_Resource* resource) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  *resource = PPBURLRequestInfoInterface()->Create(instance);
-  DebugPrintf("PPB_URLRequestInfo::Create: resource=%"NACL_PRId32"\n",
-              *resource);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbURLRequestInfoRpcServer::PPB_URLRequestInfo_IsURLRequestInfo(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource resource,
-    // outputs
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Bool pp_success = PPBURLRequestInfoInterface()->IsURLRequestInfo(resource);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_URLRequestInfo::IsURLRequestInfo: success=%d\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbURLRequestInfoRpcServer::PPB_URLRequestInfo_SetProperty(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      // inputs
-      PP_Resource request,
-      int32_t property,
-      nacl_abi_size_t value_size, char* value_bytes,
-      // outputs
-      int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Var value;
-  if (!DeserializeTo(value_bytes, value_size, 1, &value))
-    return;
-
-  PP_Bool pp_success = PPBURLRequestInfoInterface()->SetProperty(
-      request, static_cast<PP_URLRequestProperty>(property), value);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_URLRequestInfo::SetProperty: success=%d\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbURLRequestInfoRpcServer::PPB_URLRequestInfo_AppendDataToBody(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      // inputs
-      PP_Resource request,
-      nacl_abi_size_t data_size, char* data_bytes,
-      // outputs
-      int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Bool pp_success = PPBURLRequestInfoInterface()->AppendDataToBody(
-      request,
-      static_cast<const char*>(data_bytes),
-      static_cast<uint32_t>(data_size));
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_URLRequestInfo::AppendDataToBody: success=%d\n",
-              *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbURLRequestInfoRpcServer::PPB_URLRequestInfo_AppendFileToBody(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      // inputs
-      PP_Resource request,
-      PP_Resource file_ref,
-      int64_t start_offset,
-      int64_t number_of_bytes,
-      double expected_last_modified_time,
-      // outputs
-      int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Bool pp_success = PPBURLRequestInfoInterface()->AppendFileToBody(
-      request,
-      file_ref,
-      start_offset,
-      number_of_bytes,
-      static_cast<PP_Time>(expected_last_modified_time));
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_URLRequestInfo::AppendFileToBody: pp_success=%d\n",
-              *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_url_response_info_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_url_response_info_rpc_server.cc
deleted file mode 100644
index 4bb787f..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_url_response_info_rpc_server.cc
+++ /dev/null
@@ -1,72 +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.
-//
-// SRPC-abstraction wrappers around PPB_URLResponseInfo functions.
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/ppb_url_response_info.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::PPBURLResponseInfoInterface;
-using ppapi_proxy::SerializeTo;
-using ppapi_proxy::DebugPrintf;
-
-void PpbURLResponseInfoRpcServer::PPB_URLResponseInfo_IsURLResponseInfo(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource resource,
-    // outputs
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-
-  PP_Bool pp_success =
-      PPBURLResponseInfoInterface()->IsURLResponseInfo(resource);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_URLResponseInfo::IsURLResponseInfo: success=%d\n",
-              *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbURLResponseInfoRpcServer::PPB_URLResponseInfo_GetProperty(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      // inputs
-      PP_Resource response,
-      int32_t property,
-      // outputs
-      nacl_abi_size_t* value_size, char* value_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Var value = PPBURLResponseInfoInterface()->GetProperty(
-      response, static_cast<PP_URLResponseProperty>(property));
-  DebugPrintf("PPB_URLResponseInfo::GetProperty: type=%d\n",
-              value.type);
-
-  if (!SerializeTo(&value, value_bytes, value_size))
-    return;
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbURLResponseInfoRpcServer::PPB_URLResponseInfo_GetBodyAsFileRef(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      // inputs
-      PP_Resource response,
-      // outputs
-      PP_Resource* file_ref) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  *file_ref = PPBURLResponseInfoInterface()->GetBodyAsFileRef(response);
-  DebugPrintf("PPB_URLResponseInfo::GetBodyAsFileRef: file_ref="NACL_PRId32"\n",
-              *file_ref);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_websocket_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_websocket_rpc_server.cc
deleted file mode 100644
index 0d233bb..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_websocket_rpc_server.cc
+++ /dev/null
@@ -1,342 +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.
-//
-// SRPC-abstraction wrappers around PPB_WebSocket functions.
-
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_core.h"
-#include "ppapi/c/ppb_websocket.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::DeleteRemoteCallbackInfo;
-using ppapi_proxy::DeserializeTo;
-using ppapi_proxy::MakeRemoteCompletionCallback;
-using ppapi_proxy::PPBCoreInterface;
-using ppapi_proxy::PPBWebSocketInterface;
-using ppapi_proxy::Serialize;
-using ppapi_proxy::SerializeTo;
-
-void PpbWebSocketRpcServer::PPB_WebSocket_Create(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    // outputs
-    PP_Resource* resource) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  *resource = PPBWebSocketInterface()->Create(instance);
-  DebugPrintf("PPB_WebSocket::Create: resource=%"NACL_PRId32"\n", *resource);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbWebSocketRpcServer::PPB_WebSocket_IsWebSocket(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource resource,
-    // outputs
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Bool pp_success = PPBWebSocketInterface()->IsWebSocket(resource);
-  *success = PP_ToBool(pp_success);
-  DebugPrintf("PPB_WebSocket::IsWebSocket: success=%d\n", *success);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbWebSocketRpcServer::PPB_WebSocket_Connect(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource ws,
-    nacl_abi_size_t url_size,
-    char* url_bytes,
-    nacl_abi_size_t protocols_size,
-    char* protocols_bytes,
-    int32_t protocol_count,
-    int32_t callback_id,
-    // outputs
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  PP_Var url;
-  if (!DeserializeTo(url_bytes, url_size, 1, &url))
-    return;
-
-  nacl::scoped_array<PP_Var> protocols(new PP_Var[protocol_count]);
-  if (!DeserializeTo(
-      protocols_bytes, protocols_size, protocol_count, protocols.get()))
-    return;
-
-  *pp_error = PPBWebSocketInterface()->Connect(
-      ws,
-      url,
-      protocols.get(),
-      static_cast<uint32_t>(protocol_count),
-      remote_callback);
-  DebugPrintf("PPB_WebSocket::Connect: pp_error=%"NACL_PRId32"\n", *pp_error);
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbWebSocketRpcServer::PPB_WebSocket_Close(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource ws,
-    int32_t code,
-    nacl_abi_size_t reason_size,
-    char* reason_bytes,
-    int32_t callback_id,
-    // outputs
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id);
-  if (NULL == remote_callback.func)
-    return;
-
-  PP_Var reason;
-  if (!DeserializeTo(reason_bytes, reason_size, 1, &reason))
-    return;
-
-  *pp_error = PPBWebSocketInterface()->Close(
-      ws, code, reason, remote_callback);
-  DebugPrintf("PPB_WebSocket::Close: pp_error=%"NACL_PRId32"\n", *pp_error);
-
-  if (*pp_error != PP_OK_COMPLETIONPENDING)
-    DeleteRemoteCallbackInfo(remote_callback);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbWebSocketRpcServer::PPB_WebSocket_ReceiveMessage(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource ws,
-    int32_t callback_id,
-    // outputs
-    int32_t* pp_error,
-    nacl_abi_size_t* sync_read_buffer_size,
-    char* sync_read_buffer_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Var* callback_var = NULL;
-  PP_CompletionCallback remote_callback =
-      MakeRemoteCompletionCallback(rpc->channel, callback_id, &callback_var);
-  if (NULL == remote_callback.func)
-    return;
-
-  *pp_error = PPBWebSocketInterface()->ReceiveMessage(
-      ws, callback_var, remote_callback);
-  DebugPrintf("PPB_WebSocket::ReceiveMessage: pp_error=%"NACL_PRId32"\n",
-      *pp_error);
-  rpc->result = NACL_SRPC_RESULT_OK;
-
-  // No callback scheduled. Handles synchronous completion here.
-  if (*pp_error != PP_OK_COMPLETIONPENDING) {
-    if (*pp_error == PP_OK) {
-      // Try serialization from callback_var to sync_read_buffer_bytes. It
-      // could fail if serialized callback_var is larger than
-      // sync_read_buffer_size.
-      if (!SerializeTo(callback_var, sync_read_buffer_bytes,
-          sync_read_buffer_size)) {
-        // Buffer for synchronous completion is not big enough. Uses
-        // asynchronous completion callback.
-        *pp_error = PP_OK_COMPLETIONPENDING;
-        // Schedule to invoke remote_callback later from main thread.
-        PPBCoreInterface()->CallOnMainThread(0, remote_callback, PP_OK);
-        return;
-      }
-    }
-    DeleteRemoteCallbackInfo(remote_callback);
-  }
-}
-
-void PpbWebSocketRpcServer::PPB_WebSocket_SendMessage(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource ws,
-    nacl_abi_size_t message_size,
-    char* message_bytes,
-    // outputs
-    int32_t* pp_error) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Var message;
-  if (!DeserializeTo(message_bytes, message_size, 1, &message))
-    return;
-
-  *pp_error = PPBWebSocketInterface()->SendMessage(ws, message);
-  DebugPrintf("PPB_WebSocket::SendMessage: pp_error=%"NACL_PRId32"\n",
-      *pp_error);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbWebSocketRpcServer::PPB_WebSocket_GetBufferedAmount(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource ws,
-    // outputs
-    int64_t* buffered_amount) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  *buffered_amount = static_cast<int64_t>(
-      PPBWebSocketInterface()->GetBufferedAmount(ws));
-  DebugPrintf("PPB_WebSocket::GetBufferedAmount: buffered_amount=%lu\n",
-      *buffered_amount);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbWebSocketRpcServer::PPB_WebSocket_GetCloseCode(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource ws,
-    // outputs
-    int32_t* close_code) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  *close_code = static_cast<int32_t>(
-      PPBWebSocketInterface()->GetCloseCode(ws));
-  DebugPrintf("PPB_WebSocket::GetCloseCode: close_code=%d\n", *close_code);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbWebSocketRpcServer::PPB_WebSocket_GetCloseReason(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource ws,
-    // outputs
-    nacl_abi_size_t* reason_size,
-    char* reason_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Var reason = PPBWebSocketInterface()->GetCloseReason(ws);
-  DebugPrintf("PPB_WebSocket::GetCloseReason:: reason.type=%d\n", reason.type);
-
-  if (SerializeTo(&reason, reason_bytes, reason_size))
-    rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbWebSocketRpcServer::PPB_WebSocket_GetCloseWasClean(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource ws,
-    // outputs
-    int32_t* was_clean) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Bool pp_was_clean = PPBWebSocketInterface()->GetCloseWasClean(ws);
-  *was_clean = PP_ToBool(pp_was_clean);
-  DebugPrintf("PPB_WebSocket::GetCloseWasClean: was_clean=%d\n", *was_clean);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbWebSocketRpcServer::PPB_WebSocket_GetExtensions(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource ws,
-    // outputs
-    nacl_abi_size_t* extensions_size,
-    char* extensions_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Var extensions = PPBWebSocketInterface()->GetExtensions(ws);
-  DebugPrintf("PPB_WebSocket::GetExtensions:: extensions.type=%d\n",
-      extensions.type);
-
-  if (SerializeTo(&extensions, extensions_bytes, extensions_size))
-    rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbWebSocketRpcServer::PPB_WebSocket_GetProtocol(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource ws,
-    // outputs
-    nacl_abi_size_t* protocol_size,
-    char* protocol_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Var protocol = PPBWebSocketInterface()->GetProtocol(ws);
-  DebugPrintf("PPB_WebSocket::GetProtocol:: protocol.type=%d\n",
-      protocol.type);
-
-  if (SerializeTo(&protocol, protocol_bytes, protocol_size))
-    rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbWebSocketRpcServer::PPB_WebSocket_GetReadyState(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource ws,
-    // outputs
-    int32_t* ready_state) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  *ready_state = static_cast<int32_t>(
-      PPBWebSocketInterface()->GetReadyState(ws));
-  DebugPrintf("PPB_WebSocket::GetReadyState:: ready_state=%d\n", ready_state);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbWebSocketRpcServer::PPB_WebSocket_GetURL(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Resource ws,
-    // outputs
-    nacl_abi_size_t* url_size,
-    char* url_bytes) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PP_Var url = PPBWebSocketInterface()->GetURL(ws);
-  DebugPrintf("PPB_WebSocket::GetURL:: url.type=%d\n", url.type);
-
-  if (SerializeTo(&url, url_bytes, url_size))
-    rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_zoom_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_zoom_rpc_server.cc
deleted file mode 100644
index d0e3d78..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_zoom_rpc_server.cc
+++ /dev/null
@@ -1,52 +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.
-//
-// SRPC-abstraction wrappers around PPB_Zoom_Dev functions.
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_point.h"
-#include "ppapi/c/ppb_image_data.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::PPBZoomInterface;
-
-void PpbZoomRpcServer::PPB_Zoom_ZoomChanged(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    double factor) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PPBZoomInterface()->ZoomChanged(instance, factor);
-
-  DebugPrintf("PPB_Zoom::ZoomChanged: instance=%"NACL_PRId32"\n",
-              instance);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PpbZoomRpcServer::PPB_Zoom_ZoomLimitsChanged(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Instance instance,
-    double minimum_factor,
-    double maximum_factor) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  PPBZoomInterface()->ZoomLimitsChanged(instance,
-                                        minimum_factor,
-                                        maximum_factor);
-
-  DebugPrintf("PPB_Zoom::ZoomLimitsChanged: instance=%"NACL_PRId32"\n",
-              instance);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc
deleted file mode 100644
index 7e24e30..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc
+++ /dev/null
@@ -1,213 +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 "native_client/src/shared/ppapi_proxy/browser_ppp.h"
-
-#include <string.h>
-
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/include/portability_process.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp_find.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp_input_event.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp_instance.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp_messaging.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp_printing.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp_selection.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp_zoom.h"
-#include "native_client/src/shared/ppapi_proxy/browser_upcall.h"
-#include "native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h"
-#include "native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
-#include "native_client/src/trusted/plugin/plugin.h"
-#include "ppapi/c/dev/ppp_find_dev.h"
-#include "ppapi/c/dev/ppp_printing_dev.h"
-#include "ppapi/c/dev/ppp_selection_dev.h"
-#include "ppapi/c/dev/ppp_zoom_dev.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppp.h"
-#include "ppapi/c/ppp_input_event.h"
-#include "ppapi/c/ppp_mouse_lock.h"
-#include "ppapi/c/private/ppb_nacl_private.h"
-
-namespace ppapi_proxy {
-
-//
-// The following methods are the SRPC dispatchers for ppapi/c/ppp.h.
-//
-
-namespace {
-
-// PPB_GetInterface must only be called on the main thread. So as we are adding
-// off-the-main-thread support for various interfaces, we need to ensure that
-// their pointers are available on upcall thread of the the trusted proxy.
-void PPBGetInterfaces() {
-  PPBCoreInterface();
-  // TODO(all): add more interfaces here once available off the main thread.
-}
-
-}  // namespace
-
-int32_t BrowserPpp::InitializeModule(PP_Module module_id,
-                                     PPB_GetInterface get_browser_interface) {
-  DebugPrintf("PPP_InitializeModule: module=%"NACL_PRId32"\n", module_id);
-  // Ask the browser for an interface which provides missing functions
-  const PPB_NaCl_Private* ppb_nacl = reinterpret_cast<const PPB_NaCl_Private*>(
-      get_browser_interface(PPB_NACL_PRIVATE_INTERFACE));
-  if (ppb_nacl == NULL) {
-    DebugPrintf("PPP_InitializeModule: NaCl private interface missing!\n");
-    return PP_ERROR_FAILED;
-  }
-  SetPPBGetInterface(get_browser_interface,
-                     plugin_->enable_dev_interfaces(),
-                     !ppb_nacl->Are3DInterfacesDisabled());
-  PPBGetInterfaces();
-
-  SetBrowserPppForInstance(plugin_->pp_instance(), this);
-  CHECK(main_channel_ != NULL);
-  nacl::scoped_ptr<nacl::DescWrapper> wrapper(
-      BrowserUpcall::Start(&upcall_thread_, main_channel_));
-  if (wrapper.get() == NULL)
-    return PP_ERROR_FAILED;
-  // Set up the callbacks allowed on the main channel.
-  NaClSrpcService* service = reinterpret_cast<NaClSrpcService*>(
-      calloc(1, sizeof(*service)));
-  if (NULL == service) {
-    DebugPrintf("PPP_InitializeModule: "
-                "could not create callback services.\n");
-    return PP_ERROR_FAILED;
-  }
-  if (!NaClSrpcServiceHandlerCtor(service, PpbRpcs::srpc_methods)) {
-    DebugPrintf("PPP_InitializeModule: "
-                "could not construct callback services.\n");
-    free(service);
-    return PP_ERROR_FAILED;
-  }
-  // Export the service on the channel.
-  main_channel_->server = service;
-  char* service_string = const_cast<char*>(service->service_string);
-  SetModuleIdForSrpcChannel(main_channel_, module_id);
-  SetInstanceIdForSrpcChannel(main_channel_, plugin_->pp_instance());
-  // Do the RPC.
-  int32_t pp_error;
-  NaClSrpcError srpc_result =
-      PppRpcClient::PPP_InitializeModule(main_channel_,
-                                         module_id,
-                                         wrapper->desc(),
-                                         service_string,
-                                         &pp_error);
-  DebugPrintf("PPP_InitializeModule: %s\n", NaClSrpcErrorString(srpc_result));
-  is_nexe_alive_ = (srpc_result != NACL_SRPC_RESULT_INTERNAL);
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    return PP_ERROR_FAILED;
-  DebugPrintf("PPP_InitializeModule: pp_error=%"NACL_PRId32"\n", pp_error);
-  if (pp_error != PP_OK)
-    return pp_error;
-  const void* ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE);
-  DebugPrintf("PPP_InitializeModule: ppp_instance=%p\n", ppp_instance);
-  ppp_instance_interface_ = reinterpret_cast<const PPP_Instance*>(ppp_instance);
-  if (ppp_instance_interface_ == NULL)  // PPP_Instance is required.
-    return PP_ERROR_NOINTERFACE;
-  // PPB_Messaging and PPP_InputEvent are optional, so it's OK for them to
-  // return NULL.
-  ppp_messaging_interface_ = reinterpret_cast<const PPP_Messaging*>(
-        GetPluginInterface(PPP_MESSAGING_INTERFACE));
-  ppp_input_event_interface_ = reinterpret_cast<const PPP_InputEvent*>(
-        GetPluginInterface(PPP_INPUT_EVENT_INTERFACE));
-  if (!is_valid())  // Nexe died in PPP_GetInterface.
-    return PP_ERROR_FAILED;
-  return PP_OK;
-}
-
-void BrowserPpp::ShutdownModule() {
-  DebugPrintf("PPP_Shutdown: main_channel=%p\n",
-              static_cast<void*>(main_channel_));
-  if (main_channel_ == NULL) {
-    CHECK(!is_nexe_alive_);
-    return;  // The proxy has already been shut down.
-  }
-  if (is_nexe_alive_) {
-    NaClSrpcError srpc_result =
-      PppRpcClient::PPP_ShutdownModule(main_channel_);
-    DebugPrintf("PPP_ShutdownModule: %s\n", NaClSrpcErrorString(srpc_result));
-  }
-  NaClThreadJoin(&upcall_thread_);
-  UnsetBrowserPppForInstance(plugin_->pp_instance());
-  UnsetModuleIdForSrpcChannel(main_channel_);
-  UnsetInstanceIdForSrpcChannel(main_channel_);
-  main_channel_ = NULL;
-  is_nexe_alive_ = false;
-  DebugPrintf("PPP_Shutdown: main_channel=NULL\n");
-}
-
-const void* BrowserPpp::GetPluginInterface(const char* interface_name) {
-  DebugPrintf("PPP_GetInterface('%s')\n", interface_name);
-  if (!is_valid())
-    return NULL;
-  int32_t exports_interface_name;
-  NaClSrpcError srpc_result =
-      PppRpcClient::PPP_GetInterface(main_channel_,
-                                     const_cast<char*>(interface_name),
-                                     &exports_interface_name);
-  DebugPrintf("PPP_GetInterface('%s'): %s\n",
-              interface_name, NaClSrpcErrorString(srpc_result));
-  is_nexe_alive_ = (srpc_result != NACL_SRPC_RESULT_INTERNAL);
-
-  // Special case PPP_Instance versioning. The plugin side of the proxy
-  // converts Instance 1.1 to Instance 1.0 as needed, so we want to say here
-  // in the browser side that any time either 1.0 or 1.1 is supported, that
-  // we'll support 1.1.
-  if (srpc_result == NACL_SRPC_RESULT_OK && !exports_interface_name &&
-      strcmp(interface_name, PPP_INSTANCE_INTERFACE_1_1) == 0) {
-    srpc_result =
-        PppRpcClient::PPP_GetInterface(main_channel_,
-            const_cast<char *>(PPP_INSTANCE_INTERFACE_1_0),
-            &exports_interface_name);
-  }
-
-  const void* ppp_interface = NULL;
-  if (srpc_result != NACL_SRPC_RESULT_OK || !exports_interface_name) {
-    ppp_interface = NULL;
-  } else if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0) {
-    ppp_interface =
-       reinterpret_cast<const void*>(BrowserInstance::GetInterface());
-  } else if (strcmp(interface_name, PPP_MESSAGING_INTERFACE) == 0) {
-    ppp_interface =
-        reinterpret_cast<const void*>(BrowserMessaging::GetInterface());
-  } else if (strcmp(interface_name, PPP_MOUSELOCK_INTERFACE) == 0) {
-    ppp_interface =
-       reinterpret_cast<const void*>(BrowserMouseLock::GetInterface());
-  } else if (strcmp(interface_name, PPP_INPUT_EVENT_INTERFACE) == 0) {
-    ppp_interface =
-       reinterpret_cast<const void*>(BrowserInputEvent::GetInterface());
-  } else if (strcmp(interface_name, PPP_FIND_DEV_INTERFACE) == 0) {
-    ppp_interface =
-       reinterpret_cast<const void*>(BrowserFind::GetInterface());
-  } else if (strcmp(interface_name, PPP_PRINTING_DEV_INTERFACE) == 0) {
-    ppp_interface =
-       reinterpret_cast<const void*>(BrowserPrinting::GetInterface());
-  } else if (strcmp(interface_name, PPP_SELECTION_DEV_INTERFACE) == 0) {
-    ppp_interface =
-       reinterpret_cast<const void*>(BrowserSelection::GetInterface());
-  } else if (strcmp(interface_name, PPP_ZOOM_DEV_INTERFACE) == 0) {
-    ppp_interface =
-       reinterpret_cast<const void*>(BrowserZoom::GetInterface());
-  }
-  // TODO(sehr): other interfaces go here.
-  DebugPrintf("PPP_GetInterface('%s'): %p\n", interface_name, ppp_interface);
-  return ppp_interface;
-}
-
-const void* BrowserPpp::GetPluginInterfaceSafe(const char* interface_name) {
-  const void* ppp_interface = GetPluginInterface(interface_name);
-  if (ppp_interface == NULL)
-    DebugPrintf("PPB_GetInterface: %s not found\n", interface_name);
-  CHECK(ppp_interface != NULL);
-  return ppp_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.h
deleted file mode 100644
index f5212cb..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.h
+++ /dev/null
@@ -1,98 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_H_
-
-#include <stdarg.h>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "native_client/src/shared/platform/nacl_threads.h"
-#include "native_client/src/trusted/desc/nacl_desc_invalid.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/ppp.h"
-#include "ppapi/c/ppp_input_event.h"
-#include "ppapi/c/ppp_instance.h"
-#include "ppapi/c/ppp_messaging.h"
-
-namespace plugin {
-class Plugin;
-}
-
-namespace ppapi_proxy {
-
-class BrowserPpp {
- public:
-  BrowserPpp(NaClSrpcChannel* main_channel, plugin::Plugin* plugin)
-      : main_channel_(main_channel),
-        is_nexe_alive_(true),
-        plugin_(plugin),
-        ppp_instance_interface_(NULL),
-        ppp_messaging_interface_(NULL),
-        ppp_input_event_interface_(NULL) {
-    CHECK(main_channel_ != NULL);
-    upcall_thread_.tid = 0;
-  }
-
-  ~BrowserPpp() {}
-
-  int32_t InitializeModule(PP_Module module_id,
-                           PPB_GetInterface get_browser_interface);
-
-  // Joins upcall thread, drops references to channel (owned by plugin),
-  // calls plugin side shutdown, but not user's PPP_ShutdownModule.
-  void ShutdownModule();
-  // Returns an interface pointer or NULL.
-  const void* GetPluginInterface(const char* interface_name);
-  // Returns an interface pointer or fails on a NULL CHECK.
-  const void* GetPluginInterfaceSafe(const char* interface_name);
-
-  // Guaranteed to be non-NULL if module initialization succeeded.
-  // Use this instead of GetPluginInterface for PPP_INSTANCE_INTERFACE.
-  const PPP_Instance* ppp_instance_interface() const {
-    return ppp_instance_interface_;
-  }
-
-  const PPP_Messaging* ppp_messaging_interface() const {
-    return ppp_messaging_interface_;
-  }
-
-  const PPP_InputEvent* ppp_input_event_interface() const {
-    return ppp_input_event_interface_;
-  }
-
-  bool is_valid() const { return is_nexe_alive_; }
-  static bool is_valid(BrowserPpp* proxy) {
-    return (proxy != NULL && proxy->is_valid());
-  }
-
-  NaClSrpcChannel* main_channel() const { return main_channel_; }
-  plugin::Plugin* plugin() { return plugin_; }
-
-  void ReportDeadNexe() { is_nexe_alive_ = false; }
-
- private:
-  // The "main" SRPC channel used to communicate with the plugin.
-  // NULL if proxy has been shut down.
-  NaClSrpcChannel* main_channel_;
-  bool is_nexe_alive_;
-  // Plugin that owns this proxy.
-  plugin::Plugin* plugin_;
-
-  // Set on module initialization.
-  const PPP_Instance* ppp_instance_interface_;
-  const PPP_Messaging* ppp_messaging_interface_;
-  const PPP_InputEvent* ppp_input_event_interface_;
-
-  // The thread used to handle calls on other than the main thread.
-  struct NaClThread upcall_thread_;
-  NACL_DISALLOW_COPY_AND_ASSIGN(BrowserPpp);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_find.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_find.cc
deleted file mode 100644
index 0f6aebc..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_find.cc
+++ /dev/null
@@ -1,77 +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 "native_client/src/shared/ppapi_proxy/browser_ppp_find.h"
-
-#include <string.h>
-
-// Include file order cannot be observed because ppp_instance declares a
-// structure return type that causes an error on Windows.
-// TODO(sehr, brettw): fix the return types and include order in PPAPI.
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_resource.h"
-#include "srpcgen/ppp_rpc.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Bool StartFind(PP_Instance instance,
-                  const char* text,
-                  PP_Bool case_sensitive) {
-  DebugPrintf("PPP_Find::StartFind: instance=%"NACL_PRId32"\n", instance);
-
-  int32_t supports_find = 0;
-  nacl_abi_size_t text_bytes = static_cast<nacl_abi_size_t>(strlen(text)) + 1;
-  NaClSrpcError srpc_result = PppFindRpcClient::PPP_Find_StartFind(
-      GetMainSrpcChannel(instance),
-      instance,
-      text_bytes, const_cast<char*>(text),
-      static_cast<int32_t>(case_sensitive),
-      &supports_find);
-
-  DebugPrintf("PPP_Find::StartFind: %s\n", NaClSrpcErrorString(srpc_result));
-  return PP_FromBool(supports_find);
-}
-
-void SelectFindResult(PP_Instance instance,
-                      PP_Bool forward) {
-  DebugPrintf("PPP_Find::SelectFindResult: "
-              "instance=%"NACL_PRId32"\n", instance);
-
-  NaClSrpcError srpc_result = PppFindRpcClient::PPP_Find_SelectFindResult(
-      GetMainSrpcChannel(instance),
-      instance,
-      static_cast<int32_t>(forward));
-
-  DebugPrintf("PPP_Find::SelectFindResult: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-void StopFind(PP_Instance instance) {
-  DebugPrintf("PPP_Find::StopFind: instance=%"NACL_PRId32"\n", instance);
-
-  NaClSrpcError srpc_result = PppFindRpcClient::PPP_Find_StopFind(
-      GetMainSrpcChannel(instance),
-      instance);
-
-  DebugPrintf("PPP_Find::StopFind: %s\n", NaClSrpcErrorString(srpc_result));
-}
-
-}  // namespace
-
-const PPP_Find_Dev* BrowserFind::GetInterface() {
-  static const PPP_Find_Dev find_interface = {
-    StartFind,
-    SelectFindResult,
-    StopFind
-  };
-  return &find_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_find.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_find.h
deleted file mode 100644
index adaf3db..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_find.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_FIND_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_FIND_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/dev/ppp_find_dev.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_var.h"
-
-namespace ppapi_proxy {
-
-// Implements the trusted side of the PPP_Find_Dev interface.
-class BrowserFind {
- public:
-  static const PPP_Find_Dev* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(BrowserFind);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_FIND_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.cc
deleted file mode 100644
index 65856a4..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.cc
+++ /dev/null
@@ -1,132 +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 "native_client/src/shared/ppapi_proxy/browser_ppp_input_event.h"
-
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp.h"
-#include "native_client/src/shared/ppapi_proxy/input_event_data.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/ppp_input_event.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Bool HandleInputEvent(PP_Instance instance, PP_Resource input_event) {
-  DebugPrintf("PPP_InputEvent::HandleInputEvent: instance=%"NACL_PRId32", "
-              "input_event = %"NACL_PRId32"\n",
-              instance, input_event);
-
-  PP_Var character_text = PP_MakeUndefined();
-  InputEventData data;
-  data.event_type = PPBInputEventInterface()->GetType(input_event);
-  data.event_time_stamp = PPBInputEventInterface()->GetTimeStamp(input_event);
-  data.event_modifiers = PPBInputEventInterface()->GetModifiers(input_event);
-
-  switch (data.event_type) {
-    // These events all use the PPB_MouseInputEvent interface.
-    case PP_INPUTEVENT_TYPE_MOUSEDOWN:
-    case PP_INPUTEVENT_TYPE_MOUSEUP:
-    case PP_INPUTEVENT_TYPE_MOUSEENTER:
-    case PP_INPUTEVENT_TYPE_MOUSELEAVE:
-    case PP_INPUTEVENT_TYPE_MOUSEMOVE:
-    case PP_INPUTEVENT_TYPE_CONTEXTMENU:
-      data.mouse_button =
-          PPBMouseInputEventInterface()->GetButton(input_event);
-      data.mouse_position =
-          PPBMouseInputEventInterface()->GetPosition(input_event);
-      data.mouse_click_count =
-          PPBMouseInputEventInterface()->GetClickCount(input_event);
-      data.mouse_movement =
-          PPBMouseInputEventInterface()->GetMovement(input_event);
-      break;
-    // This event uses the PPB_WheelInputEvent interface.
-    case PP_INPUTEVENT_TYPE_WHEEL:
-      data.wheel_delta =
-          PPBWheelInputEventInterface()->GetDelta(input_event);
-      data.wheel_ticks =
-          PPBWheelInputEventInterface()->GetTicks(input_event);
-      data.wheel_scroll_by_page =
-          PPBWheelInputEventInterface()->GetScrollByPage(input_event);
-      break;
-    // These events all use the PPB_KeyInputEvent interface.
-    case PP_INPUTEVENT_TYPE_RAWKEYDOWN:
-    case PP_INPUTEVENT_TYPE_KEYDOWN:
-    case PP_INPUTEVENT_TYPE_KEYUP:
-    case PP_INPUTEVENT_TYPE_CHAR:
-      data.key_code =
-          PPBKeyboardInputEventInterface()->GetKeyCode(input_event);
-      character_text =
-          PPBKeyboardInputEventInterface()->GetCharacterText(input_event);
-      break;
-    case PP_INPUTEVENT_TYPE_UNDEFINED:
-      return PP_FALSE;
-    // TODO(nfullagar): Implement support for event types below.
-    case PP_INPUTEVENT_TYPE_IME_COMPOSITION_START:
-    case PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE:
-    case PP_INPUTEVENT_TYPE_IME_COMPOSITION_END:
-    case PP_INPUTEVENT_TYPE_IME_TEXT:
-      DebugPrintf("   No implementation for event type %d\n",
-          data.event_type);
-      return PP_FALSE;
-    case PP_INPUTEVENT_TYPE_TOUCHSTART:
-    case PP_INPUTEVENT_TYPE_TOUCHMOVE:
-    case PP_INPUTEVENT_TYPE_TOUCHEND:
-    case PP_INPUTEVENT_TYPE_TOUCHCANCEL:
-      DebugPrintf("   No implementation for event type %d\n",
-          data.event_type);
-      return PP_FALSE;
-    // No default case; if any new types are added we should get a compile
-    // warning.
-  }
-  // Now data and character_text have all the data we want to send to the
-  // untrusted side.
-
-  // character_text should either be undefined or a string type.
-  DCHECK((character_text.type == PP_VARTYPE_UNDEFINED) ||
-         (character_text.type == PP_VARTYPE_STRING));
-  // Serialize the character_text Var.
-  uint32_t text_size = 0;
-  nacl::scoped_array<char> text_bytes(Serialize(&character_text, 1,
-                                                &text_size));
-  int32_t handled;
-  NaClSrpcError srpc_result =
-      PppInputEventRpcClient::PPP_InputEvent_HandleInputEvent(
-          GetMainSrpcChannel(instance),
-          instance,
-          input_event,
-          sizeof(data),
-          reinterpret_cast<char*>(&data),
-          text_size,
-          text_bytes.get(),
-          &handled);
-  DebugPrintf("PPP_Instance::HandleInputEvent: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (srpc_result != NACL_SRPC_RESULT_OK) {
-    return PP_FALSE;
-  }
-  // The 'handled' int should only ever have a value matching one of PP_FALSE
-  // or PP_TRUE. Otherwise, there's an error in the proxy.
-  DCHECK((handled == static_cast<int32_t>(PP_FALSE) ||
-         (handled == static_cast<int32_t>(PP_TRUE))));
-  PP_Bool handled_bool = PP_FromBool(handled);
-  return handled_bool;
-}
-
-}  // namespace
-
-const PPP_InputEvent* BrowserInputEvent::GetInterface() {
-  static const PPP_InputEvent input_event_interface = {
-    HandleInputEvent
-  };
-  return &input_event_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.h
deleted file mode 100644
index 63f35c6..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.h
+++ /dev/null
@@ -1,30 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_INPUT_EVENT_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_INPUT_EVENT_H_
-
-#include <map>
-
-#include "native_client/src/include/nacl_macros.h"
-// Needed because ppp_instance.h does not include everything it needs.
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/ppb_input_event.h"
-#include "ppapi/c/ppp_input_event.h"
-
-namespace ppapi_proxy {
-
-// Implements the trusted side of the PPP_InputEvent interface.
-class BrowserInputEvent {
- public:
-  static const PPP_InputEvent* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(BrowserInputEvent);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_INPUT_EVENT_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_instance.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_instance.cc
deleted file mode 100644
index 3f568f7..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_instance.cc
+++ /dev/null
@@ -1,170 +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 "native_client/src/shared/ppapi_proxy/browser_ppp_instance.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <limits>
-
-#include "native_client/src/include/checked_cast.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp.h"
-#include "native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/ppapi_proxy/view_data.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_var.h"
-#include "ppapi/c/ppp_instance.h"
-#include "ppapi/c/ppb_view.h"
-
-using nacl::scoped_array;
-using ppapi_proxy::ViewData;
-
-namespace ppapi_proxy {
-
-namespace {
-
-char* ArgArraySerialize(int argc,
-                        const char* array[],
-                        uint32_t* serial_size) {
-  uint32_t used = 0;
-  for (int i = 0; i < argc; ++i) {
-    // Note that strlen() cannot ever return SIZE_T_MAX, since that would imply
-    // that there were no nulls anywhere in memory, which would lead to
-    // strlen() never terminating. So this assignment is safe.
-    size_t len = strlen(array[i]) + 1;
-    if (len > std::numeric_limits<uint32_t>::max()) {
-      // Overflow, input string is too long.
-      return NULL;
-    }
-    if (used > std::numeric_limits<uint32_t>::max() - len) {
-      // Overflow, output string is too long.
-      return NULL;
-    }
-    used += static_cast<uint32_t>(len);
-  }
-  // Note that there is a check against numeric_limits<uint32_t> in the code
-  // above, which is why this cast is safe.
-  *serial_size = used;
-  char* serial_array = new char[used];
-
-  size_t pos = 0;
-  for (int i = 0; i < argc; ++i) {
-    size_t len = strlen(array[i]) + 1;
-    strncpy(serial_array + pos, array[i], len);
-    pos += len;
-  }
-  return serial_array;
-}
-
-PP_Bool DidCreate(PP_Instance instance,
-                  uint32_t argc,
-                  const char* argn[],
-                  const char* argv[]) {
-  DebugPrintf("PPP_Instance::DidCreate: instance=%"NACL_PRId32"\n", instance);
-  uint32_t argn_size;
-  scoped_array<char> argn_serial(ArgArraySerialize(argc, argn, &argn_size));
-  if (argn_serial.get() == NULL) {
-    return PP_FALSE;
-  }
-  uint32_t argv_size;
-  scoped_array<char> argv_serial(ArgArraySerialize(argc, argv, &argv_size));
-  if (argv_serial.get() == NULL) {
-    return PP_FALSE;
-  }
-  int32_t int_argc = static_cast<int32_t>(argc);
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PppInstanceRpcClient::PPP_Instance_DidCreate(GetMainSrpcChannel(instance),
-                                                   instance,
-                                                   int_argc,
-                                                   argn_size,
-                                                   argn_serial.get(),
-                                                   argv_size,
-                                                   argv_serial.get(),
-                                                   &success);
-  DebugPrintf("PPP_Instance::DidCreate: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (srpc_result != NACL_SRPC_RESULT_OK) {
-    return PP_FALSE;
-  }
-  return PP_FromBool(success);
-}
-
-void DidDestroy(PP_Instance instance) {
-  DebugPrintf("PPP_Instance::DidDestroy: instance=%"NACL_PRId32"\n", instance);
-  NaClSrpcError srpc_result = PppInstanceRpcClient::PPP_Instance_DidDestroy(
-      GetMainSrpcChannel(instance), instance);
-  DebugPrintf("PPP_Instance::DidDestroy: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-void DidChangeView(PP_Instance instance, PP_Resource view) {
-  DebugPrintf("PPP_Instance::DidChangeView: instance=%"NACL_PRId32"\n",
-              instance);
-  ViewData view_data;
-
-  const PPB_View* view_interface = PPBViewInterface();
-  view_interface->GetRect(view, &view_data.viewport_rect);
-  view_data.is_fullscreen = view_interface->IsFullscreen(view);
-  view_data.is_page_visible = view_interface->IsPageVisible(view);
-  view_interface->GetClipRect(view, &view_data.clip_rect);
-
-  NaClSrpcError srpc_result = PppInstanceRpcClient::PPP_Instance_DidChangeView(
-      GetMainSrpcChannel(instance),
-      instance,
-      view,
-      sizeof(ViewData),
-      reinterpret_cast<char*>(&view_data));
-  DebugPrintf("PPP_Instance::DidChangeView: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) {
-  DebugPrintf("PPP_Instance::DidChangeFocus: instance=%"NACL_PRId32", "
-              "has_focus = %d\n", instance, has_focus);
-  NaClSrpcError srpc_result = PppInstanceRpcClient::PPP_Instance_DidChangeFocus(
-      GetMainSrpcChannel(instance),
-      instance,
-      PP_ToBool(has_focus));
-  DebugPrintf("PPP_Instance::DidChangeFocus: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader) {
-  DebugPrintf("PPP_Instance::HandleDocumentLoad: instance=%"NACL_PRId32", "
-              "url_loader=%"NACL_PRId32"\n", instance, url_loader);
-
-  int32_t result = 0;
-  NaClSrpcError srpc_result =
-      PppInstanceRpcClient::PPP_Instance_HandleDocumentLoad(
-          GetMainSrpcChannel(instance),
-          instance,
-          url_loader,
-          &result);
-
-  DebugPrintf("PPP_Instance::HandleDocumentLoad: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_OK && result)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-}  // namespace
-
-const PPP_Instance* BrowserInstance::GetInterface() {
-  static const PPP_Instance instance_interface = {
-    DidCreate,
-    DidDestroy,
-    DidChangeView,
-    DidChangeFocus,
-    HandleDocumentLoad
-  };
-  return &instance_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_instance.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_instance.h
deleted file mode 100644
index ccfd25f..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_instance.h
+++ /dev/null
@@ -1,27 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_INSTANCE_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_INSTANCE_H_
-
-#include "native_client/src/include/nacl_macros.h"
-// Needed because ppp_instance.h does not include everything it needs.
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_var.h"
-#include "ppapi/c/ppp_instance.h"
-
-namespace ppapi_proxy {
-
-// Implements the trusted side of the PPP_Instance interface.
-class BrowserInstance {
- public:
-  static const PPP_Instance* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(BrowserInstance);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_INSTANCE_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_messaging.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_messaging.cc
deleted file mode 100644
index 771c919..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_messaging.cc
+++ /dev/null
@@ -1,45 +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 "native_client/src/shared/ppapi_proxy/browser_ppp_messaging.h"
-
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_var.h"
-#include "srpcgen/ppp_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-void HandleMessage(PP_Instance instance, struct PP_Var message) {
-  DebugPrintf("PPP_Messaging::HandleMessage: instance=%"NACL_PRId32"\n",
-              instance);
-  uint32_t message_length = 0;
-  nacl::scoped_array<char> message_bytes(Serialize(&message, 1,
-                                                   &message_length));
-  NaClSrpcError srpc_result =
-      PppMessagingRpcClient::PPP_Messaging_HandleMessage(
-          GetMainSrpcChannel(instance),
-          instance,
-          message_length,
-          message_bytes.get());
-
-  DebugPrintf("PPP_Messaging::HandleMessage: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-}  // namespace
-
-const PPP_Messaging* BrowserMessaging::GetInterface() {
-  static const PPP_Messaging messaging_interface = {
-    HandleMessage
-  };
-  return &messaging_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_messaging.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_messaging.h
deleted file mode 100644
index 221a909..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_messaging.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_MESSAGING_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_MESSAGING_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppp_messaging.h"
-
-namespace ppapi_proxy {
-
-// Implements the trusted side of the PPP_Messaging interface.
-class BrowserMessaging {
- public:
-  static const PPP_Messaging* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(BrowserMessaging);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_MESSAGING_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.cc
deleted file mode 100644
index 0716061..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.cc
+++ /dev/null
@@ -1,39 +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 "native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.h"
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_instance.h"
-#include "srpcgen/ppp_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-void MouseLockLost(PP_Instance instance) {
-  DebugPrintf("PPP_MouseLock::MouseLockLost: instance=%"NACL_PRId32"\n",
-              instance);
-
-  NaClSrpcError srpc_result =
-      PppMouseLockRpcClient::PPP_MouseLock_MouseLockLost(
-          GetMainSrpcChannel(instance),
-          instance);
-
-  DebugPrintf("PPP_MouseLock::MouseLockLost: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-}  // namespace
-
-const PPP_MouseLock* BrowserMouseLock::GetInterface() {
-  static const PPP_MouseLock mouse_lock_interface = {
-    MouseLockLost
-  };
-  return &mouse_lock_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.h
deleted file mode 100644
index c5abff7..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_MOUSE_LOCK_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_MOUSE_LOCK_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppp_mouse_lock.h"
-
-namespace ppapi_proxy {
-
-// Implements the trusted side of the PPP_MouseLock interface.
-class BrowserMouseLock {
- public:
-  static const PPP_MouseLock* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(BrowserMouseLock);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_MOUSE_LOCK_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_printing.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_printing.cc
deleted file mode 100644
index cd64237..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_printing.cc
+++ /dev/null
@@ -1,121 +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 "native_client/src/shared/ppapi_proxy/browser_ppp_printing.h"
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp.h"
-#include "native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_resource.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-const nacl_abi_size_t kPPPrintSettingsBytes =
-    static_cast<nacl_abi_size_t>(sizeof(struct PP_PrintSettings_Dev));
-const nacl_abi_size_t kPPPrintPageNumberRangeBytes =
-    static_cast<nacl_abi_size_t>(sizeof(struct PP_PrintPageNumberRange_Dev));
-
-uint32_t QuerySupportedFormats(PP_Instance instance) {
-  DebugPrintf("PPP_Printing_Dev::QuerySupportedFormats: "
-              "instance=%"NACL_PRId32"\n", instance);
-
-  int32_t formats = 0;
-  NaClSrpcError srpc_result =
-      PppPrintingRpcClient::PPP_Printing_QuerySupportedFormats(
-          GetMainSrpcChannel(instance),
-          instance,
-          &formats);
-
-  DebugPrintf("PPP_Printing_Dev::QuerySupportedFormats: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  return static_cast<uint32_t>(formats);
-}
-
-int32_t Begin(PP_Instance instance,
-              const struct PP_PrintSettings_Dev* print_settings) {
-  DebugPrintf("PPP_Printing_Dev::Begin: instance=%"NACL_PRId32"\n", instance);
-
-  int32_t pages_required = 0;
-  NaClSrpcError srpc_result =
-      PppPrintingRpcClient::PPP_Printing_Begin(
-          GetMainSrpcChannel(instance),
-          instance,
-          kPPPrintSettingsBytes,
-          reinterpret_cast<char*>(
-              const_cast<PP_PrintSettings_Dev*>(print_settings)),
-          &pages_required);
-
-  DebugPrintf("PPP_Printing_Dev::Begin: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  return pages_required;
-}
-
-PP_Resource PrintPages(PP_Instance instance,
-                       const struct PP_PrintPageNumberRange_Dev* page_ranges,
-                       uint32_t page_range_count) {
-  DebugPrintf("PPP_Printing_Dev::PrintPages: "
-              "instance=%"NACL_PRId32"\n", instance);
-
-  PP_Resource image_data = kInvalidResourceId;
-  NaClSrpcError srpc_result =
-      PppPrintingRpcClient::PPP_Printing_PrintPages(
-          GetMainSrpcChannel(instance),
-          instance,
-          page_range_count * kPPPrintPageNumberRangeBytes,
-          reinterpret_cast<char*>(
-              const_cast<PP_PrintPageNumberRange_Dev*>(page_ranges)),
-          page_range_count,
-          &image_data);
-
-  DebugPrintf("PPP_Printing_Dev::PrintPages: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  return image_data;
-}
-
-void End(PP_Instance instance) {
-  DebugPrintf("PPP_Printing_Dev::End: instance=%"NACL_PRId32"\n", instance);
-
-  NaClSrpcError srpc_result =
-      PppPrintingRpcClient::PPP_Printing_End(GetMainSrpcChannel(instance),
-                                             instance);
-
-  DebugPrintf("PPP_Printing_Dev::End: %s\n", NaClSrpcErrorString(srpc_result));
-}
-
-PP_Bool IsScalingDisabled(PP_Instance instance) {
-  DebugPrintf("PPP_Printing_Dev::IsScalingDisabled: "
-              "instance=%"NACL_PRId32"\n", instance);
-
-  int32_t scaling_disabled = 0;
-  NaClSrpcError srpc_result =
-      PppPrintingRpcClient::PPP_Printing_IsScalingDisabled(
-          GetMainSrpcChannel(instance),
-          instance,
-          &scaling_disabled);
-
-  DebugPrintf("PPP_Printing_Dev::IsScalingDisabled: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  return PP_FromBool(scaling_disabled);
-}
-
-}  // namespace
-
-const PPP_Printing_Dev* BrowserPrinting::GetInterface() {
-  static const PPP_Printing_Dev printing_interface = {
-    QuerySupportedFormats,
-    Begin,
-    PrintPages,
-    End,
-    IsScalingDisabled
-  };
-  return &printing_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_printing.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_printing.h
deleted file mode 100644
index ba10290..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_printing.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_PRINTING_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_PRINTING_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/dev/ppp_printing_dev.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_var.h"
-
-namespace ppapi_proxy {
-
-// Implements the trusted side of the PPP_Printing_Dev interface.
-class BrowserPrinting {
- public:
-  static const PPP_Printing_Dev* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(BrowserPrinting);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_PRINTING_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_selection.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_selection.cc
deleted file mode 100644
index a7204cb..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_selection.cc
+++ /dev/null
@@ -1,58 +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 "native_client/src/shared/ppapi_proxy/browser_ppp_selection.h"
-
-// Include file order cannot be observed because ppp_instance declares a
-// structure return type that causes an error on Windows.
-// TODO(sehr, brettw): fix the return types and include order in PPAPI.
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_rect.h"
-#include "ppapi/c/pp_resource.h"
-#include "srpcgen/ppp_rpc.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-struct PP_Var GetSelectedText(PP_Instance instance, PP_Bool html) {
-  DebugPrintf("PPP_Selection_Dev::GetSelectedText: "
-              "instance=%"NACL_PRId32"\n", instance);
-  NaClSrpcChannel* channel = GetMainSrpcChannel(instance);
-  nacl_abi_size_t text_size = kMaxReturnVarSize;
-  nacl::scoped_array<char> text_bytes(new char[text_size]);
-  NaClSrpcError srpc_result =
-      PppSelectionRpcClient::PPP_Selection_GetSelectedText(
-          channel,
-          instance,
-          static_cast<int32_t>(html),
-          &text_size,
-          text_bytes.get());
-
-  DebugPrintf("PPP_Selection_Dev::GetSelectedText: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  PP_Var selected_text = PP_MakeUndefined();
-  if (srpc_result == NACL_SRPC_RESULT_OK) {
-    (void) DeserializeTo(text_bytes.get(), text_size, 1, &selected_text);
-  }
-  return selected_text;
-}
-
-}  // namespace
-
-const PPP_Selection_Dev* BrowserSelection::GetInterface() {
-  static const PPP_Selection_Dev selection_interface = {
-    GetSelectedText
-  };
-  return &selection_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_selection.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_selection.h
deleted file mode 100644
index 2d1aa37..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_selection.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_SELECTION_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_SELECTION_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/dev/ppp_selection_dev.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_var.h"
-
-namespace ppapi_proxy {
-
-// Implements the trusted side of the PPP_Selection_Dev interface.
-class BrowserSelection {
- public:
-  static const PPP_Selection_Dev* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(BrowserSelection);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_SELECTION_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_zoom.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_zoom.cc
deleted file mode 100644
index bc48eb4..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_zoom.cc
+++ /dev/null
@@ -1,45 +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 "native_client/src/shared/ppapi_proxy/browser_ppp_zoom.h"
-
-// Include file order cannot be observed because ppp_instance declares a
-// structure return type that causes an error on Windows.
-// TODO(sehr, brettw): fix the return types and include order in PPAPI.
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_resource.h"
-#include "srpcgen/ppp_rpc.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-void Zoom(PP_Instance instance,
-          double factor,
-          PP_Bool text_only) {
-  DebugPrintf("PPP_Zoom::Zoom: instance=%"NACL_PRId32"\n", instance);
-
-  NaClSrpcError srpc_result = PppZoomRpcClient::PPP_Zoom_Zoom(
-      GetMainSrpcChannel(instance),
-      instance,
-      factor,
-      static_cast<int32_t>(text_only));
-
-  DebugPrintf("PPP_Zoom::Zoom: %s\n", NaClSrpcErrorString(srpc_result));
-}
-
-}  // namespace
-
-const PPP_Zoom_Dev* BrowserZoom::GetInterface() {
-  static const PPP_Zoom_Dev zoom_interface = {
-    Zoom
-  };
-  return &zoom_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_zoom.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_zoom.h
deleted file mode 100644
index fb4c787..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_zoom.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_ZOOM_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_ZOOM_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/dev/ppp_zoom_dev.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_var.h"
-
-namespace ppapi_proxy {
-
-// Implements the trusted side of the PPP_Zoom_Dev interface.
-class BrowserZoom {
- public:
-  static const PPP_Zoom_Dev* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(BrowserZoom);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_ZOOM_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_upcall.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_upcall.cc
deleted file mode 100644
index 5e9c825..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_upcall.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// This is an early draft of background thread support.
-// Until it is complete, we assume that all functions proxy functions
-// (but CallOnMainThread) are called on the main thread.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// Support for "upcalls" -- RPCs to the browser that are done from other than
-// the main thread.  These calls are synchronized by the ppapi_proxy library
-// at the plugin end.
-
-#include "native_client/src/shared/ppapi_proxy/browser_upcall.h"
-
-#include <new>
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/shared/platform/nacl_threads.h"
-#include "native_client/src/shared/ppapi_proxy/browser_callback.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_core.h"
-#include "srpcgen/upcall.h"
-
-using nacl::DescWrapper;
-using nacl::DescWrapperFactory;
-
-namespace {
-
-// Structure for passing information to the thread.  Shares ownership of
-// the descriptor with the creating routine.  This allows passing ownership
-// to the upcall thread.
-struct UpcallInfo {
-  nacl::scoped_ptr<DescWrapper> wrapper;
-  NaClSrpcChannel* channel;
-};
-
-void WINAPI UpcallThread(void* arg) {
-  // The memory for info was allocated on the creating (browser UI) thread,
-  // but ownership was conferred to the upcall thread for deletion.
-  nacl::scoped_ptr<UpcallInfo> info(reinterpret_cast<UpcallInfo*>(arg));
-  NaClSrpcServerLoop(info->wrapper->desc(),
-                     PpbUpcalls::srpc_methods,
-                     info->channel);
-}
-
-}  // namespace
-
-namespace ppapi_proxy {
-
-DescWrapper* BrowserUpcall::Start(struct NaClThread* nacl_thread,
-                                  NaClSrpcChannel* upcall_channel) {
-  // Create a socket pair for the upcall server.
-  DescWrapperFactory factory;
-  DescWrapper* pair[2] = { NULL, NULL };
-  if (factory.MakeSocketPair(pair)) {
-    return NULL;
-  }
-  nacl::scoped_ptr<DescWrapper> browser_end(pair[0]);
-  nacl::scoped_ptr<DescWrapper> plugin_end(pair[1]);
-  // Create an info node to pass to the thread.
-  nacl::scoped_ptr<UpcallInfo> info(new UpcallInfo);
-  info->wrapper.reset(browser_end.get());
-  info->channel = upcall_channel;
-  // On success, info took ownership of browser_end.
-  browser_end.release();
-  // Create a thread and an SRPC "upcall" server.
-  const int kThreadStackSize = 128 * 1024;
-  if (!NaClThreadCreateJoinable(nacl_thread,
-                                UpcallThread,
-                                info.get(),
-                                kThreadStackSize)) {
-    return NULL;
-  }
-  // On successful thread creation, ownership of info passes to the thread.
-  info.release();
-  // On successful return, the caller gets the plugin_end of the socketpair.
-  return plugin_end.release();
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_upcall.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_upcall.h
deleted file mode 100644
index ca5b6b3..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_upcall.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// This is an early draft of background thread support.
-// Until it is complete, we assume that all functions proxy functions
-// (but CallOnMainThread) are called on the main thread.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// Support for "upcalls" -- RPCs to the browser that are done from other than
-// the PPAPI main thread.  These calls are synchronized by the ppapi_proxy
-// library at the plugin end.
-
-#include "native_client/src/include/portability.h"
-
-struct NaClSrpcChannel;
-struct NaClThread;
-
-namespace nacl {
-class DescWrapper;
-}  // namespace nacl
-
-namespace ppapi_proxy {
-
-class BrowserUpcall {
- public:
-  // If successful, creates the listener thread in the browser that will handle
-  // upcalls and returns the plugin end of the upcall channel.  The caller
-  // takes ownership of this descriptor.  If either thread or socket creation
-  // fails, this method returns NULL.
-  // The thread's state is maintained by nacl_thread.  Upcall processing may
-  // cause rpcs to be performed on main_channel (e.g., CallOnMainThread),
-  // so the interface takes main_channel, but the upcall thread does not have
-  // ownership.
-  static nacl::DescWrapper* Start(NaClThread* nacl_thread,
-                                  NaClSrpcChannel* main_channel);
-};
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/command_buffer_nacl.cc b/ppapi/native_client/src/shared/ppapi_proxy/command_buffer_nacl.cc
deleted file mode 100644
index 95b7028..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/command_buffer_nacl.cc
+++ /dev/null
@@ -1,195 +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 "native_client/src/shared/ppapi_proxy/command_buffer_nacl.h"
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include "gpu/command_buffer/common/logging.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/ppb_core.h"
-
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-
-CommandBufferNacl::CommandBufferNacl(PP_Resource graphics_3d,
-                                     const PPB_Core* iface_core)
-    : graphics_3d_(graphics_3d), iface_core_(iface_core) {
-  iface_core_->AddRefResource(graphics_3d_);
-}
-
-CommandBufferNacl::~CommandBufferNacl() {
-  DebugPrintf("CommandBufferNacl::~CommandBufferNacl()\n");
-  iface_core_->ReleaseResource(graphics_3d_);
-}
-
-bool CommandBufferNacl::Initialize() {
-  DebugPrintf("CommandBufferNacl::Initialize\n");
-  int32_t success;
-  NaClSrpcChannel* channel = ppapi_proxy::GetMainSrpcChannel();
-  NaClSrpcError retval =
-      PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_InitCommandBuffer(
-          channel, graphics_3d_, &success);
-  DebugPrintf("CommandBufferNaCl::Initialize returned success=%s\n",
-      (PP_TRUE == success) ? "TRUE" : "FALSE");
-  return NACL_SRPC_RESULT_OK == retval && PP_TRUE == success;
-}
-
-gpu::CommandBuffer::State CommandBufferNacl::GetState() {
-  DebugPrintf("CommandBufferNacl::GetState\n");
-  PP_Graphics3DTrustedState state;
-  nacl_abi_size_t state_size = static_cast<nacl_abi_size_t>(sizeof(state));
-
-  NaClSrpcChannel* channel = ppapi_proxy::GetMainSrpcChannel();
-  NaClSrpcError retval =
-      PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_GetState(
-          channel, graphics_3d_, &state_size, reinterpret_cast<char*>(&state));
-  if (NACL_SRPC_RESULT_OK != retval
-      || state_size != static_cast<nacl_abi_size_t>(sizeof(state))) {
-    return ErrorGpuState();
-  }
-
-  last_state_ = PpapiToGpuState(state);
-  return last_state_;
-}
-
-gpu::CommandBuffer::State CommandBufferNacl::GetLastState() {
-  return last_state_;
-}
-
-void CommandBufferNacl::Flush(int32 put_offset) {
-  DebugPrintf("CommandBufferNacl::Flush\n");
-  NaClSrpcChannel* channel = ppapi_proxy::GetMainSrpcChannel();
-  PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_Flush(
-      channel, graphics_3d_, put_offset);
-}
-
-gpu::CommandBuffer::State CommandBufferNacl::FlushSync(int32 put_offset,
-                                                       int32 last_known_get) {
-  DebugPrintf("CommandBufferNacl::FlushSync\n");
-  PP_Graphics3DTrustedState state;
-  nacl_abi_size_t state_size = static_cast<nacl_abi_size_t>(sizeof(state));
-
-  NaClSrpcChannel* channel = ppapi_proxy::GetMainSrpcChannel();
-  NaClSrpcError retval =
-      PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_FlushSyncFast(
-          channel,
-          graphics_3d_,
-          put_offset,
-          last_known_get,
-          &state_size,
-          reinterpret_cast<char*>(&state));
-  if (NACL_SRPC_RESULT_OK != retval
-      || state_size != static_cast<nacl_abi_size_t>(sizeof(state))) {
-    return ErrorGpuState();
-  }
-
-  last_state_ = PpapiToGpuState(state);
-  return last_state_;
-}
-
-void CommandBufferNacl::SetGetBuffer(int32 transfer_buffer_id) {
-  DebugPrintf("CommandBufferNacl::SetGetBuffer\n");
-  NaClSrpcChannel* channel = ppapi_proxy::GetMainSrpcChannel();
-  PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_SetGetBuffer(
-      channel, graphics_3d_, transfer_buffer_id);
-}
-
-void CommandBufferNacl::SetGetOffset(int32 get_offset) {
-  DebugPrintf("CommandBufferNacl::SetGetOffset\n");
-  // Not implemented by proxy.
-  GPU_NOTREACHED();
-}
-
-int32 CommandBufferNacl::CreateTransferBuffer(size_t size, int32 id_request) {
-  DebugPrintf("CommandBufferNacl::CreateTransferBuffer\n");
-  int32_t id;
-
-  NaClSrpcChannel* channel = ppapi_proxy::GetMainSrpcChannel();
-  NaClSrpcError retval =
-      PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_CreateTransferBuffer(
-          channel, graphics_3d_, size, id_request, &id);
-  if (NACL_SRPC_RESULT_OK != retval)
-    return 0;
-
-  return id;
-}
-
-void CommandBufferNacl::DestroyTransferBuffer(int32 id) {
-  DebugPrintf("CommandBufferNacl::DestroyTransferBuffer\n");
-  NaClSrpcChannel* channel = ppapi_proxy::GetMainSrpcChannel();
-  PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_DestroyTransferBuffer(
-      channel, graphics_3d_, id);
-}
-
-gpu::Buffer CommandBufferNacl::GetTransferBuffer(int32 id) {
-  DebugPrintf("CommandBufferNacl::GetTransferBuffer\n");
-  int shm_handle;
-  int32_t shm_size;
-
-  NaClSrpcChannel* channel = ppapi_proxy::GetMainSrpcChannel();
-  NaClSrpcError retval =
-      PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_GetTransferBuffer(
-          channel, graphics_3d_, id, &shm_handle, &shm_size);
-  if (NACL_SRPC_RESULT_OK != retval) {
-    return BufferFromShm(-1, 0);
-  }
-  return BufferFromShm(shm_handle, shm_size);
-}
-
-void CommandBufferNacl::SetToken(int32 token) {
-  DebugPrintf("CommandBufferNacl::SetToken\n");
-  // Not implemented by proxy.
-  GPU_NOTREACHED();
-}
-
-void CommandBufferNacl::SetParseError(
-    gpu::error::Error error) {
-  DebugPrintf("CommandBufferNacl::SetParseError\n");
-  // Not implemented by proxy.
-  GPU_NOTREACHED();
-}
-
-void CommandBufferNacl::SetContextLostReason(gpu::error::ContextLostReason) {
-  // Not implemented by proxy.
-  GPU_NOTREACHED();
-}
-
-// static
-gpu::Buffer CommandBufferNacl::BufferFromShm(int shm_handle,
-                                             uint32_t shm_size) {
-  gpu::Buffer buffer;
-  buffer.ptr = mmap(0,
-                    shm_size,
-                    PROT_READ | PROT_WRITE,
-                    MAP_SHARED,
-                    shm_handle,
-                    0);
-  // TODO(neb): Close the fd now that it's mapped.
-  // TODO(neb): Unmap ring & transfer buffers in the destructor.
-  if (NULL != buffer.ptr)
-    buffer.size = shm_size;
-  return buffer;
-}
-
-// static
-gpu::CommandBuffer::State CommandBufferNacl::ErrorGpuState() {
-  gpu::CommandBuffer::State state;
-  state.error = gpu::error::kGenericError;
-  return state;
-}
-
-// static
-gpu::CommandBuffer::State CommandBufferNacl::PpapiToGpuState(
-    PP_Graphics3DTrustedState s) {
-  gpu::CommandBuffer::State state;
-  state.num_entries = s.num_entries;
-  state.get_offset  = s.get_offset;
-  state.put_offset  = s.put_offset;
-  state.token       = s.token;
-  state.error       = static_cast<gpu::error::Error>(s.error);
-  return state;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/command_buffer_nacl.h b/ppapi/native_client/src/shared/ppapi_proxy/command_buffer_nacl.h
deleted file mode 100644
index 8806289..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/command_buffer_nacl.h
+++ /dev/null
@@ -1,55 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_COMMAND_BUFFER_NACL_H
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_COMMAND_BUFFER_NACL_H
-
-#include "gpu/command_buffer/common/command_buffer.h"
-#include "ppapi/c/pp_graphics_3d.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/ppb_core.h"
-#include "ppapi/c/trusted/ppb_graphics_3d_trusted.h"
-
-// A CommandBuffer proxy implementation that uses trusted PPAPI interface to
-// access a CommandBuffer.
-
-class CommandBufferNacl : public gpu::CommandBuffer {
- public:
-  // This class will addref the graphics 3d resource using the core interface.
-  CommandBufferNacl(PP_Resource graphics_3d, const PPB_Core* iface_core);
-  virtual ~CommandBufferNacl();
-
-  // CommandBuffer implementation.
-  virtual bool Initialize();
-  virtual State GetState();
-  virtual State GetLastState();
-  virtual void Flush(int32 put_offset);
-  virtual State FlushSync(int32 put_offset, int32 last_known_get);
-  virtual void SetGetBuffer(int32 transfer_buffer_id);
-  virtual void SetGetOffset(int32 get_offset);
-  virtual int32 CreateTransferBuffer(size_t size, int32 id_request);
-  virtual int32 RegisterTransferBuffer(base::SharedMemory* buffer,
-                                       size_t size,
-                                       int32 id_request) {
-    // TODO(neb): support for nacl if neccessary
-    return -1;
-  }
-  virtual void DestroyTransferBuffer(int32 id);
-  virtual gpu::Buffer GetTransferBuffer(int32 handle);
-  virtual void SetToken(int32 token);
-  virtual void SetParseError(gpu::error::Error error);
-  virtual void SetContextLostReason(gpu::error::ContextLostReason);
-
- private:
-  PP_Resource graphics_3d_;
-  const PPB_Core* iface_core_;
-  gpu::Buffer buffer_;
-  State last_state_;
-
-  static gpu::CommandBuffer::State PpapiToGpuState(PP_Graphics3DTrustedState s);
-  static gpu::CommandBuffer::State ErrorGpuState();
-  static gpu::Buffer BufferFromShm(int shm_handle, uint32_t shm_size);
-};
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_COMMAND_BUFFER_NACL_H
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/completion_callback.srpc b/ppapi/native_client/src/shared/ppapi_proxy/completion_callback.srpc
deleted file mode 100644
index 07cf946..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/completion_callback.srpc
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2010 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC method that supports invocation of plugin-side callbacks from the browser.
-{
- 'name': 'CompletionCallbackRpc',
- 'rpcs': [
-          {'name': 'RunCompletionCallback',
-           'inputs': [['callback_id', 'int32_t'],
-                      ['result', 'int32_t'],
-                      ['read_buffer', 'char[]' ],
-                     ],
-           'outputs': []
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.cc b/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.cc
deleted file mode 100644
index be05a67..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.cc
+++ /dev/null
@@ -1,28 +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 "native_client/src/shared/ppapi_proxy/input_event_data.h"
-
-namespace ppapi_proxy {
-
-InputEventData::InputEventData()
-    : event_type(PP_INPUTEVENT_TYPE_UNDEFINED),
-      event_modifiers(0),
-      event_time_stamp(0.0),
-      mouse_button(PP_INPUTEVENT_MOUSEBUTTON_NONE),
-      mouse_click_count(0),
-      mouse_position(PP_MakePoint(0, 0)),
-      mouse_movement(PP_MakePoint(0, 0)),
-      wheel_delta(PP_MakeFloatPoint(0.0f, 0.0f)),
-      wheel_ticks(PP_MakeFloatPoint(0.0f, 0.0f)),
-      wheel_scroll_by_page(PP_FALSE),
-      key_code(0),
-      usb_key_code(0),
-      unused_padding(0) {
-}
-
-InputEventData::~InputEventData() {
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.h b/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.h
deleted file mode 100644
index 2f0bce2..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.h
+++ /dev/null
@@ -1,54 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_INPUT_EVENT_DATA_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_INPUT_EVENT_DATA_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_macros.h"
-#include "ppapi/c/pp_rect.h"
-#include "ppapi/c/ppb_input_event.h"
-
-namespace ppapi_proxy {
-
-// The data for a single input event.
-struct InputEventData {
-  InputEventData();
-  ~InputEventData();
-
-  PP_InputEvent_Type event_type;
-  uint32_t event_modifiers;
-  PP_TimeTicks event_time_stamp;
-
-  PP_InputEvent_MouseButton mouse_button;
-  int32_t mouse_click_count;
-  PP_Point mouse_position;
-  PP_Point mouse_movement;
-
-  PP_FloatPoint wheel_delta;
-  PP_FloatPoint wheel_ticks;
-  PP_Bool wheel_scroll_by_page;
-
-  uint32_t key_code;
-
-  // A code for identifying the key by a USB Usage Page (upper 16-bits) and
-  // Usage Id (lower 16-bits). See the "Keyboard/Keypad Page (0x07)" of
-  // the "USB HID Usage Tables" document for encoding details.
-  uint32_t usb_key_code;
-
-  // Required for consistent 64-bit alignment on all platforms.
-  uint32_t unused_padding;
-};
-// Make sure that the size is consistent across platforms, so the alignment is
-// consistent. Note the fields above are carefully ordered to make sure it is
-// consistent. New fields may require some adjustment to keep a consistent size
-// and alignment. TODO(dmichael): This is only required because we don't pickle
-// the type. As a short-cut, we memcpy it instead. It would be cleaner to
-// pickle this struct.
-PP_COMPILE_ASSERT_SIZE_IN_BYTES(InputEventData, 72);
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_INPUT_EVENT_DATA_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/object_serialize.cc b/ppapi/native_client/src/shared/ppapi_proxy/object_serialize.cc
deleted file mode 100644
index 6debbe2..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/object_serialize.cc
+++ /dev/null
@@ -1,524 +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 "native_client/src/shared/ppapi_proxy/object_serialize.h"
-
-#include <limits>
-#include <stdio.h>
-#include <string.h>
-
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability_process.h"
-#ifdef __native_client__
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#else
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#endif  // __native_client__
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_var.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-// A serialized string consists of a fixed minimum of 8 bytes.
-static const int kStringFixedBytes = 8;
-// Followed by a varying number of bytes rounded up to the nearest 8 bytes.
-static const uint32_t kStringRoundBase = 8;
-
-}  // namespace
-
-// The basic serialization structure.  Used alone for PP_VARTYPE_VOID,
-// PP_VARTYPE_NULL, and PP_VARTYPE_INT32.
-struct SerializedFixed {
-  uint32_t type;
-  union {
-    // PP_VARTYPE_BOOLEAN uses this.
-    bool boolean_value;
-    // PP_VARTYPE_INT32 uses this.
-    int32_t int32_value;
-    // PP_VARTYPE_STRING and PP_VARTYPE_ARRAY_BUFFER use this.
-    uint32_t string_length;
-  } u;
-  // The size of this structure should be 8 bytes on all platforms.
-};
-
-// The structure used for PP_VARTYPE_DOUBLE.
-struct SerializedDouble {
-  struct SerializedFixed fixed;
-  double double_value;
-};
-
-// The structure used for PP_VARTYPE_STRING and PP_VARTYPE_ARRAYBUFFER.
-struct SerializedString {
-  struct SerializedFixed fixed;
-  char string_bytes[kStringFixedBytes];
-  // Any remaining characters immediately follow, and are padded out to the
-  // nearest multiple of kStringRoundBase bytes.
-};
-
-// TODO(sehr): Add a more general compile time assertion package elsewhere.
-#define ASSERT_TYPE_SIZE(struct_name, struct_size) \
-    int struct_name##_size_should_be_##struct_size[ \
-                    sizeof(struct_name) == struct_size ? 1 : 0]
-
-// Check the wire format sizes for the PP_Var subtypes.
-ASSERT_TYPE_SIZE(SerializedFixed, 8);
-ASSERT_TYPE_SIZE(SerializedDouble, 16);
-ASSERT_TYPE_SIZE(SerializedString, 16);
-// IMPORTANT NOTE: SerializePpVar below assumes these sizes are multiples of 8,
-// otherwise the reinterpret_casts could cause alignment issues. New SerializedX
-// types should also be multiples of 8 bytes, or the SerializePpVar function
-// must be updated to enforce appropriate alignment.
-
-//
-// We currently use offsetof to find the start of string storage.
-// This avoids the (never seen) case where the compiler inserts in
-// padding between the struct SerializedFixed fixed header and the
-// actual payload value in the double, string, and object
-// serialization variants.
-//
-// Untrusted arm toolchain defines an offsetof in stddef.h, so we have
-// to prefix.
-//
-#define NACL_OFFSETOF(pod_t, member) \
-  (static_cast<size_t>(reinterpret_cast<uintptr_t>(&((pod_t *) NULL)->member)))
-
-namespace {
-
-// Adding value1 and value2 would overflow a uint32_t.
-bool AddWouldOverflow(size_t value1, size_t value2) {
-  if (value1 > std::numeric_limits<size_t>::max() - value2) {
-    return true;
-  }
-  uint64_t sum = static_cast<uint64_t>(value1) + value2;
-  return sum > std::numeric_limits<uint32_t>::max();
-}
-
-uint32_t RoundedStringBytes(uint32_t string_length) {
-  // Compute the string length, padded to the nearest multiple of 8.
-  if (AddWouldOverflow(string_length, kStringRoundBase - 1)) {
-    return std::numeric_limits<uint32_t>::max();
-  }
-  return (string_length + (kStringRoundBase - 1)) & ~(kStringRoundBase - 1);
-}
-
-uint32_t PpVarSize(const PP_Var& var) {
-  switch (var.type) {
-    case PP_VARTYPE_UNDEFINED:
-    case PP_VARTYPE_NULL:
-    case PP_VARTYPE_BOOL:
-    case PP_VARTYPE_INT32:
-      return sizeof(SerializedFixed);
-    case PP_VARTYPE_DOUBLE:
-      return sizeof(SerializedDouble);
-    case PP_VARTYPE_STRING: {
-      uint32_t string_length;
-      (void) PPBVarInterface()->VarToUtf8(var, &string_length);
-      string_length = RoundedStringBytes(string_length);
-      if (AddWouldOverflow(string_length,
-                           NACL_OFFSETOF(SerializedString, string_bytes))) {
-        // Adding the length to the fixed portion would overflow.
-        return 0;
-      }
-      return static_cast<uint32_t>(NACL_OFFSETOF(SerializedString, string_bytes)
-                                   + string_length);
-      break;
-    }
-    case PP_VARTYPE_ARRAY_BUFFER: {
-      uint32_t buffer_length = 0;
-      if (!PPBVarArrayBufferInterface()->ByteLength(var, &buffer_length))
-        return 0;
-      buffer_length = RoundedStringBytes(buffer_length);
-      if (AddWouldOverflow(buffer_length,
-                           NACL_OFFSETOF(SerializedString, string_bytes))) {
-        // Adding the length to the fixed portion would overflow.
-        return 0;
-      }
-      return static_cast<uint32_t>(NACL_OFFSETOF(SerializedString, string_bytes)
-                                   + buffer_length);
-      break;
-    }
-    case PP_VARTYPE_OBJECT:
-    case PP_VARTYPE_ARRAY:
-    case PP_VARTYPE_DICTIONARY:
-      NACL_NOTREACHED();
-      break;
-  }
-  // Unrecognized type.
-  return 0;
-}
-
-uint32_t PpVarVectorSize(const PP_Var* vars, uint32_t argc) {
-  size_t size = 0;
-
-  for (uint32_t i = 0; i < argc; ++i) {
-    size_t element_size = PpVarSize(vars[i]);
-
-    if (0 == element_size || AddWouldOverflow(size, element_size)) {
-      // Overflow.
-      return 0;
-    }
-    size += element_size;
-  }
-  return static_cast<uint32_t>(size);
-}
-
-bool SerializePpVar(const PP_Var* vars,
-                    uint32_t argc,
-                    char* bytes,
-                    uint32_t length) {
-  size_t offset = 0;
-
-  for (uint32_t i = 0; i < argc; ++i) {
-    size_t element_size = PpVarSize(vars[i]);
-    if (0 == element_size || AddWouldOverflow(offset, element_size)) {
-      // Overflow.
-      return false;
-    }
-    if (offset + element_size > length) {
-      // Not enough bytes to put the requested number of PP_Vars.
-      return false;
-    }
-
-    char* p = bytes + offset;
-    SerializedFixed* s = reinterpret_cast<SerializedFixed*>(p);
-    s->type = static_cast<uint32_t>(vars[i].type);
-    // Set the rest of SerializedFixed to 0, in case the following serialization
-    // leaves some of it unchanged.
-    s->u.int32_value = 0;
-
-    switch (vars[i].type) {
-      case PP_VARTYPE_UNDEFINED:
-      case PP_VARTYPE_NULL:
-        element_size = sizeof(SerializedFixed);
-        break;
-      case PP_VARTYPE_BOOL:
-        s->u.boolean_value = PP_ToBool(vars[i].value.as_bool);
-        element_size = sizeof(SerializedFixed);
-        break;
-      case PP_VARTYPE_INT32:
-        s->u.int32_value = vars[i].value.as_int;
-        element_size = sizeof(SerializedFixed);
-        break;
-      case PP_VARTYPE_DOUBLE: {
-        SerializedDouble* sd = reinterpret_cast<SerializedDouble*>(p);
-        sd->double_value = vars[i].value.as_double;
-        element_size = sizeof(SerializedDouble);
-        break;
-      }
-      case PP_VARTYPE_STRING: {
-        uint32_t string_length;
-        const char* str = PPBVarInterface()->VarToUtf8(vars[i], &string_length);
-        SerializedString* ss = reinterpret_cast<SerializedString*>(p);
-        ss->fixed.u.string_length = string_length;
-        memcpy(reinterpret_cast<void*>(ss->string_bytes),
-               reinterpret_cast<const void*>(str),
-               string_length);
-        // Fill padding bytes with zeros.
-        memset(reinterpret_cast<void*>(ss->string_bytes + string_length), 0,
-            RoundedStringBytes(string_length) - string_length);
-        element_size = NACL_OFFSETOF(SerializedString, string_bytes)
-            + RoundedStringBytes(string_length);
-        break;
-      }
-      case PP_VARTYPE_ARRAY_BUFFER: {
-        uint32_t buffer_length = 0;
-        PPBVarArrayBufferInterface()->ByteLength(vars[i], &buffer_length);
-        SerializedString* ss = reinterpret_cast<SerializedString*>(p);
-        ss->fixed.u.string_length = buffer_length;
-        memcpy(reinterpret_cast<void*>(ss->string_bytes),
-               PPBVarArrayBufferInterface()->Map(vars[i]),
-               buffer_length);
-        // Fill padding bytes with zeros.
-        memset(reinterpret_cast<void*>(ss->string_bytes + buffer_length), 0,
-               RoundedStringBytes(buffer_length) - buffer_length);
-        element_size = NACL_OFFSETOF(SerializedString, string_bytes)
-            + RoundedStringBytes(buffer_length);
-        break;
-      }
-      case PP_VARTYPE_OBJECT:
-      case PP_VARTYPE_ARRAY:
-      case PP_VARTYPE_DICTIONARY:
-        NACL_NOTREACHED();
-      default:
-        return false;
-    }
-    offset += element_size;
-  }
-  return true;
-}
-
-
-//
-// Compute how many bytes does the string object to be deserialzed use
-// in the serialized format.  On error, return
-// std::numeric_limits<uint32_t>::max().  This means we cannot handle
-// 2**32-1 byte strings.
-//
-uint32_t DeserializeStringSize(char* p, uint32_t length) {
-  // zero length strings are okay... but not shorter
-  if (length < NACL_OFFSETOF(SerializedString, string_bytes)) {
-    return std::numeric_limits<uint32_t>::max();
-  }
-  SerializedString* ss = reinterpret_cast<SerializedString*>(p);
-  if (PP_VARTYPE_STRING != ss->fixed.type &&
-      PP_VARTYPE_ARRAY_BUFFER != ss->fixed.type) {
-    return std::numeric_limits<uint32_t>::max();
-  }
-  uint32_t string_length = ss->fixed.u.string_length;
-  string_length = RoundedStringBytes(string_length);
-  if (std::numeric_limits<uint32_t>::max() == string_length) {
-    return std::numeric_limits<uint32_t>::max();
-  }
-  if (AddWouldOverflow(NACL_OFFSETOF(SerializedString, string_bytes),
-                       string_length)) {
-    return std::numeric_limits<uint32_t>::max();
-  }
-  uint32_t total_bytes = NACL_OFFSETOF(SerializedString, string_bytes)
-      + string_length;
-  if (total_bytes > length) {
-    return std::numeric_limits<uint32_t>::max();
-  }
-  return total_bytes;
-}
-
-
-//
-// Compute the number of bytes that will be consumed by the next
-// object, based on its type.  If there aren't enough bytes,
-// std::numeric_limits<uint32_t>::max() will be returned.
-//
-// If element_type_ptr is non-NULL, then the next element's
-// (purported) type will be filled in.  Whether this occurs when there
-// is an error (e.g., not enough data) is not defined, i.e., only rely
-// on it when there's no error.
-//
-uint32_t DeserializePpVarSize(char* p,
-                              uint32_t length,
-                              PP_VarType* element_type_ptr) {
-  SerializedFixed* sfp;
-  if (length < sizeof *sfp) {
-    return std::numeric_limits<uint32_t>::max();
-  }
-  sfp = reinterpret_cast<SerializedFixed*>(p);
-  uint32_t expected_element_size = 0;
-  //
-  // Setting this to zero handles the "default" case.  That can occur
-  // because sfp->type can originate from untrusted code, and so the
-  // value could actually be outside of the PP_VarType enumeration
-  // range.  If we hit one of the cases below, then
-  // expected_element_size will be bounded away from zero.
-  //
-  switch (static_cast<PP_VarType>(sfp->type)) {
-    case PP_VARTYPE_UNDEFINED:
-    case PP_VARTYPE_NULL:
-    case PP_VARTYPE_BOOL:
-    case PP_VARTYPE_INT32:
-      expected_element_size = sizeof(SerializedFixed);
-      break;
-    case PP_VARTYPE_DOUBLE:
-      expected_element_size = sizeof(SerializedDouble);
-      break;
-    case PP_VARTYPE_STRING:
-      expected_element_size = DeserializeStringSize(p, length);
-      if (std::numeric_limits<uint32_t>::max() == expected_element_size) {
-        return std::numeric_limits<uint32_t>::max();
-      }
-      break;
-    case PP_VARTYPE_ARRAY_BUFFER:
-      expected_element_size = DeserializeStringSize(p, length);
-      if (std::numeric_limits<uint32_t>::max() == expected_element_size) {
-        return std::numeric_limits<uint32_t>::max();
-      }
-      break;
-      // NB: No default case to trigger -Wswitch-enum, so changes to
-      // PP_VarType w/o corresponding changes here will cause a
-      // compile-time error.
-    case PP_VARTYPE_OBJECT:
-    case PP_VARTYPE_ARRAY:
-    case PP_VARTYPE_DICTIONARY:
-      NACL_NOTREACHED();
-      break;
-  }
-  if (length < expected_element_size) {
-    return std::numeric_limits<uint32_t>::max();
-  }
-  if (NULL != element_type_ptr) {
-    *element_type_ptr = static_cast<PP_VarType>(sfp->type);
-  }
-  return expected_element_size;
-}
-
-
-//
-// This should be invoked only if DeserializePpVarSize succeeds, i.e.,
-// there are enough bytes at p.
-//
-bool DeserializeString(char* p,
-                       PP_Var* var) {
-  SerializedString* ss = reinterpret_cast<SerializedString*>(p);
-  uint32_t string_length = ss->fixed.u.string_length;
-  // VarFromUtf8 creates a buffer of size string_length using the browser-side
-  // memory allocation function, and copies string_length bytes from
-  // ss->string_bytes in to that buffer.  The ref count of the returned var is
-  // 1.
-  *var = PPBVarInterface()->VarFromUtf8(ss->string_bytes,
-                                        string_length);
-  return true;
-}
-
-//
-// This should be invoked only if DeserializePpVarSize succeeds, i.e.,
-// there are enough bytes at p.
-//
-bool DeserializeArrayBuffer(char* p,
-                            PP_Var* var) {
-  SerializedString* ss = reinterpret_cast<SerializedString*>(p);
-  uint32_t buffer_length = ss->fixed.u.string_length;
-  // VarFromUtf8 creates a buffer of size string_length using the browser-side
-  // memory allocation function, and copies string_length bytes from
-  // ss->string_bytes in to that buffer.  The ref count of the returned var is
-  // 1.
-  *var = PPBVarArrayBufferInterface()->Create(buffer_length);
-  void* var_buffer = PPBVarArrayBufferInterface()->Map(*var);
-  memcpy(var_buffer, ss->string_bytes, buffer_length);
-  return true;
-}
-
-bool DeserializePpVar(char* bytes,
-                      uint32_t length,
-                      PP_Var* vars,
-                      uint32_t argc) {
-  char* p = bytes;
-
-  for (uint32_t i = 0; i < argc; ++i) {
-    PP_VarType element_type;
-    uint32_t element_size = DeserializePpVarSize(p, length, &element_type);
-    if (std::numeric_limits<uint32_t>::max() == element_size) {
-      return false;
-    }
-    SerializedFixed* s = reinterpret_cast<SerializedFixed*>(p);
-
-    vars[i].type = element_type;
-    switch (element_type) {
-      case PP_VARTYPE_UNDEFINED:
-      case PP_VARTYPE_NULL:
-        break;
-      case PP_VARTYPE_BOOL:
-        vars[i].value.as_bool = PP_FromBool(s->u.boolean_value);
-        break;
-      case PP_VARTYPE_INT32:
-        vars[i].value.as_int = s->u.int32_value;
-        break;
-      case PP_VARTYPE_DOUBLE: {
-        SerializedDouble* sd = reinterpret_cast<SerializedDouble*>(p);
-        vars[i].value.as_double = sd->double_value;
-        break;
-      }
-      case PP_VARTYPE_STRING:
-        if (!DeserializeString(p, &vars[i])) {
-          return false;
-        }
-        break;
-      case PP_VARTYPE_ARRAY_BUFFER:
-        if (!DeserializeArrayBuffer(p, &vars[i])) {
-          return false;
-        }
-        break;
-      case PP_VARTYPE_OBJECT:
-      case PP_VARTYPE_ARRAY:
-      case PP_VARTYPE_DICTIONARY:
-        NACL_NOTREACHED();
-      default:
-        return false;
-    }
-    p += element_size;
-    length -= element_size;
-  }
-  return true;
-}
-
-}  // namespace
-
-bool SerializeTo(const PP_Var* var, char* bytes, uint32_t* length) {
-  if (bytes == NULL || length == NULL) {
-    return false;
-  }
-  // Compute the size of the serialized form.  Zero indicates error.
-  uint32_t tmp_length = PpVarVectorSize(var, 1);
-  if (0 == tmp_length || tmp_length > *length) {
-    return false;
-  }
-  // Serialize the var.
-  if (!SerializePpVar(var, 1, bytes, tmp_length)) {
-    return false;
-  }
-  // Return success.
-  *length = tmp_length;
-  return true;
-}
-
-char* Serialize(const PP_Var* vars, uint32_t argc, uint32_t* length) {
-  // Length needs to be returnable.
-  if (NULL == length) {
-    return NULL;
-  }
-  // No need to do anything if there are no vars to serialize.
-  if (0 == argc) {
-    *length = 0;
-    return NULL;
-  }
-  // Report an error if no vars are passed but argc > 0.
-  if (NULL == vars) {
-    return NULL;
-  }
-  // Compute the size of the buffer.  Zero indicates error.
-  uint32_t tmp_length = PpVarVectorSize(vars, argc);
-  if (0 == tmp_length) {
-    return NULL;
-  }
-  // Allocate the buffer.
-  char* bytes = new char[tmp_length];
-  if (NULL == bytes) {
-    return NULL;
-  }
-  // Serialize the vars.
-  if (!SerializePpVar(vars, argc, bytes, tmp_length)) {
-    delete[] bytes;
-    return NULL;
-  }
-  // Return success.
-  *length = tmp_length;
-  return bytes;
-}
-
-bool DeserializeTo(char* bytes,
-                   uint32_t length,
-                   uint32_t argc,
-                   PP_Var* vars) {
-  // Deserializing a zero-length vector is trivially done.
-  if (0 == argc) {
-    return true;
-  }
-  // Otherwise, there must be some input bytes to get from.
-  if (NULL == bytes || 0 == length) {
-    return false;
-  }
-  // And there has to be a valid address to deserialize to.
-  if (NULL == vars) {
-    return false;
-  }
-  // Read the serialized PP_Vars into the allocated memory.
-  if (!DeserializePpVar(bytes, length, vars, argc)) {
-    return false;
-  }
-  return true;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/object_serialize.h b/ppapi/native_client/src/shared/ppapi_proxy/object_serialize.h
deleted file mode 100644
index 1b57ea0..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/object_serialize.h
+++ /dev/null
@@ -1,39 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_OBJECT_SERIALIZE_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_OBJECT_SERIALIZE_H_
-
-#include "ppapi/c/pp_var.h"
-
-struct NaClSrpcChannel;
-
-namespace ppapi_proxy {
-
-// The maximum size of a pre-allocated return parameter passed to SRPC.
-const uint32_t kMaxReturnVarSize = 64 * 1024;
-
-// Serialize one PP_Var to the location given in "bytes", using no more
-// than "*length" bytes .  If successful, "*length" reflects the number of
-// bytes written and true is returned.  Otherwise returns false.
-bool SerializeTo(const PP_Var* var, char* bytes, uint32_t* length);
-
-// Serialize a vector of "argc" PP_Vars to a buffer to be allocated by new[].
-// If successful, the address of a buffer is returned and "*length" is set
-// to the number of bytes allocated.  Otherwise, NULL is returned.
-char* Serialize(const PP_Var* vars, uint32_t argc, uint32_t* length);
-
-// Deserialize a vector "bytes" of "length" bytes containing "argc" PP_Vars
-// into the vector of PP_Vars pointed to by "vars".  Returns true if
-// successful, or false otherwise.
-bool DeserializeTo(char* bytes,
-                   uint32_t length,
-                   uint32_t argc,
-                   PP_Var* vars);
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_OBJECT_SERIALIZE_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_callback.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_callback.cc
deleted file mode 100644
index 54e8dd3..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_callback.cc
+++ /dev/null
@@ -1,116 +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 "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include <string.h>
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_errors.h"
-#include "srpcgen/ppp_rpc.h"
-
-namespace ppapi_proxy {
-
-int32_t MayForceCallback(PP_CompletionCallback callback, int32_t result) {
-  if (result == PP_OK_COMPLETIONPENDING)
-    return result;
-
-  if (callback.func == NULL ||
-      (callback.flags & PP_COMPLETIONCALLBACK_FLAG_OPTIONAL) != 0)
-    return result;
-
-  PPBCoreInterface()->CallOnMainThread(0, callback, result);
-  return PP_OK_COMPLETIONPENDING;
-}
-
-// Initialize static mutex used as critical section for all callback tables.
-pthread_mutex_t CompletionCallbackTable::mutex_ = PTHREAD_MUTEX_INITIALIZER;
-
-int32_t CompletionCallbackTable::AddCallback(
-    const PP_CompletionCallback& callback,
-    void* read_buffer,
-    PP_Var* read_var) {
-  CallbackTableCriticalSection guard;
-  DCHECK (!read_buffer || !read_var);
-  if (callback.func == NULL) {
-    DebugPrintf("CompletionCallbackTable attempted to add NULL func!!\n");
-    return 0;
-  }
-  int32_t callback_id = next_id_;
-  ++next_id_;
-  CallbackInfo info = { callback, read_buffer, read_var };
-  table_.insert(std::pair<int32_t, CallbackInfo>(callback_id, info));
-  return callback_id;
-}
-
-int32_t CompletionCallbackTable::AddCallback(
-    const PP_CompletionCallback& callback) {
-  return AddCallback(callback, NULL, NULL);
-}
-
-int32_t CompletionCallbackTable::AddCallback(
-    const PP_CompletionCallback& callback,
-    void* read_buffer) {
-  return AddCallback(callback, read_buffer, NULL);
-}
-
-int32_t CompletionCallbackTable::AddCallback(
-    const PP_CompletionCallback& callback,
-    PP_Var* read_var) {
-  return AddCallback(callback, NULL, read_var);
-}
-
-
-PP_CompletionCallback CompletionCallbackTable::RemoveCallback(
-    int32_t callback_id, void** read_buffer, PP_Var** read_var) {
-  CallbackTableCriticalSection guard;
-  CallbackTable::iterator it = table_.find(callback_id);
-  DebugPrintf("CompletionCallbackTable::RemoveCallback id: %"NACL_PRId32"\n",
-      callback_id);
-  if (table_.end() != it) {
-    CallbackInfo info = it->second;
-    table_.erase(it);
-    if (read_buffer != NULL)
-      *read_buffer = info.read_buffer;
-    if (read_var != NULL)
-      *read_var = info.read_var;
-    return info.callback;
-  }
-  *read_buffer = NULL;
-  return PP_BlockUntilComplete();
-}
-
-}  // namespace ppapi_proxy
-
-// SRPC-abstraction wrapper around a PP_CompletionCallback.
-void CompletionCallbackRpcServer::RunCompletionCallback(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    int32_t callback_id,
-    int32_t result,
-    // TODO(polina): use shm for read buffer
-    nacl_abi_size_t read_buffer_size, char* read_buffer) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-
-  void* user_buffer;
-  PP_Var* user_var;
-  PP_CompletionCallback callback =
-      ppapi_proxy::CompletionCallbackTable::Get()->RemoveCallback(
-          callback_id, &user_buffer, &user_var);
-  if (callback.func == NULL) {
-    ppapi_proxy::DebugPrintf(
-        "CompletionCallbackRpcServer: id of %"NACL_PRId32" is NULL callback!\n",
-        callback_id);
-    return;
-  }
-
-  if (user_buffer != NULL && read_buffer_size > 0)
-    memcpy(user_buffer, read_buffer, read_buffer_size);
-  else if (user_var != NULL && read_buffer_size > 0)
-    ppapi_proxy::DeserializeTo(read_buffer, read_buffer_size, 1, user_var);
-  PP_RunCompletionCallback(&callback, result);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_callback.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_callback.h
deleted file mode 100644
index 72ba082..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_callback.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CALLBACK_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CALLBACK_H_
-
-#include <pthread.h>
-#include <map>
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_var.h"
-
-namespace ppapi_proxy {
-
-// Skips callback invocation and returns |result| if callback function is NULL
-// or PP_COMPLETIONCALLBACK_FLAG_OPTIONAL is set. Otherwise, schedules the
-// callback with |result| as an argument and returns PP_OK_COMPLETIONPENDING.
-int32_t MayForceCallback(PP_CompletionCallback callback, int32_t result);
-
-// Maintains a table of PP_CompletionCallback objects and their respective
-// identifiers that can be used to retrieve the objects.
-class CompletionCallbackTable {
- public:
-  // Return a singleton instance.
-  static CompletionCallbackTable* Get() {
-    static CompletionCallbackTable table;
-    return &table;
-  }
-
-  // Adds the given |callback| and optionally the associated |read_buffer|,
-  // generating and returning an identifier for it.
-  // If |callback| is NULL, then returns 0.
-  int32_t AddCallback(const PP_CompletionCallback& callback);
-  int32_t AddCallback(const PP_CompletionCallback& callback, void* read_buffer);
-  int32_t AddCallback(const PP_CompletionCallback& callback, PP_Var* read_var);
-  // Removes and returns the callback and optionally the associated
-  // |read_buffer| corresponding to the given |callback_id|.
-  // If no callback is found, returns a NULL callback.
-  PP_CompletionCallback RemoveCallback(
-      int32_t callback_id, void** read_buffer, PP_Var** read_var);
-
- private:
-  // Currently implemented as singleton, so use a private constructor.
-  CompletionCallbackTable() : next_id_(1) { }
-  ~CompletionCallbackTable() { }
-
-  int32_t AddCallback(const PP_CompletionCallback& callback,
-                      void* read_buffer,
-                      PP_Var* read_var);
-
-  struct CallbackInfo {
-    PP_CompletionCallback callback;
-    void* read_buffer;  // To be used with callbacks invoked on byte reads.
-    PP_Var* read_var;  // To be used with callbacks invoked on PP_Var reads.
-  };
-
-  typedef std::map<int32_t, CallbackInfo> CallbackTable;
-  CallbackTable table_;
-  int32_t next_id_;
-
-  // Single static mutex used as critical section for all callback tables.
-  static pthread_mutex_t mutex_;
-  class CallbackTableCriticalSection {
-   public:
-    CallbackTableCriticalSection() { pthread_mutex_lock(&mutex_); }
-    ~CallbackTableCriticalSection() { pthread_mutex_unlock(&mutex_); }
-  };
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CALLBACK_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.cc
deleted file mode 100644
index 17aaf5e..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.cc
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_core.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h"
-#include "native_client/src/shared/ppapi_proxy/ppruntime.h"
-#include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-
-
-#define NACL_SEND_FD 6
-
-namespace {
-
-NaClSrpcChannel* main_srpc_channel;
-NaClSrpcChannel* upcall_srpc_channel;
-PP_Module module_id_for_plugin;
-struct PP_ThreadFunctions thread_funcs;
-
-}  // namespace
-
-namespace ppapi_proxy {
-
-const PP_Resource kInvalidResourceId = 0;
-
-NaClSrpcChannel* GetMainSrpcChannel() {
-  return main_srpc_channel;
-}
-
-void SetMainSrpcChannel(NaClSrpcChannel* channel) {
-  main_srpc_channel = channel;
-}
-
-NaClSrpcChannel* GetUpcallSrpcChannel() {
-  return upcall_srpc_channel;
-}
-
-void SetUpcallSrpcChannel(NaClSrpcChannel* channel) {
-  upcall_srpc_channel = channel;
-}
-
-void SetModuleIdForSrpcChannel(NaClSrpcChannel* channel, PP_Module module_id) {
-  module_id_for_plugin = module_id;
-}
-
-void UnsetModuleIdForSrpcChannel(NaClSrpcChannel* channel) {
-  const PP_Module kInvalidModuleId = 0;
-  module_id_for_plugin = kInvalidModuleId;
-}
-
-PP_Module LookupModuleIdForSrpcChannel(NaClSrpcChannel* channel) {
-  return module_id_for_plugin;
-}
-
-const struct PP_ThreadFunctions* GetThreadCreator() {
-  return &thread_funcs;
-}
-
-// Browser interface helpers
-
-const void* GetBrowserInterfaceSafe(const char* interface_name) {
-  const void* ppb_interface = GetBrowserInterface(interface_name);
-  if (ppb_interface == NULL)
-    DebugPrintf("PPB_GetInterface: %s not found\n", interface_name);
-  CHECK(ppb_interface != NULL);
-  return ppb_interface;
-}
-
-const PPB_Core* PPBCoreInterface() {
-  return static_cast<const PPB_Core*>(
-      GetBrowserInterfaceSafe(PPB_CORE_INTERFACE));
-}
-
-const PPB_Memory_Dev* PPBMemoryInterface() {
-  return static_cast<const PPB_Memory_Dev*>(
-      GetBrowserInterfaceSafe(PPB_MEMORY_DEV_INTERFACE));
-}
-
-const PPB_Var* PPBVarInterface() {
-  return static_cast<const PPB_Var*>(
-      GetBrowserInterfaceSafe(PPB_VAR_INTERFACE));
-}
-
-const PPB_VarArrayBuffer* PPBVarArrayBufferInterface() {
-  return static_cast<const PPB_VarArrayBuffer*>(
-      GetBrowserInterfaceSafe(PPB_VAR_ARRAY_BUFFER_INTERFACE));
-}
-
-const PPB_WebSocket* PPBWebSocketInterface() {
-  return static_cast<const PPB_WebSocket*>(
-      GetBrowserInterfaceSafe(PPB_WEBSOCKET_INTERFACE));
-}
-
-// Plugin interface helpers
-
-const void* GetPluginInterface(const char* interface_name) {
-  return ::PPP_GetInterface(interface_name);
-}
-
-const void* GetPluginInterfaceSafe(const char* interface_name) {
-  const void* ppp_interface = GetPluginInterface(interface_name);
-  if (ppp_interface == NULL)
-    DebugPrintf("PPP_GetInterface: %s not found\n", interface_name);
-  CHECK(ppp_interface != NULL);
-  return ppp_interface;
-}
-
-const PPP_Find_Dev* PPPFindInterface() {
-  static const void* ppp = GetPluginInterfaceSafe(PPP_FIND_DEV_INTERFACE);
-  return static_cast<const PPP_Find_Dev*>(ppp);
-}
-
-const PPP_InputEvent* PPPInputEventInterface() {
-  static const void* ppp = GetPluginInterfaceSafe(PPP_INPUT_EVENT_INTERFACE);
-  return static_cast<const PPP_InputEvent*>(ppp);
-}
-
-PPP_Instance_Combined* PPPInstanceInterface() {
-  static PPP_Instance_Combined combined;
-  if (!combined.initialized()) {
-    // Note: don't use "safe" version since that will assert if 1.1 isn't
-    // supported, which isn't required.
-    const void* instance1_1 = GetPluginInterface(
-        PPP_INSTANCE_INTERFACE_1_1);
-    if (instance1_1) {
-      combined.Init1_1(static_cast<const PPP_Instance_1_1*>(instance1_1));
-    } else {
-      combined.Init1_0(static_cast<const PPP_Instance_1_0*>(
-          GetPluginInterfaceSafe(PPP_INSTANCE_INTERFACE_1_0)));
-    }
-  }
-  return &combined;
-}
-
-const PPP_Messaging* PPPMessagingInterface() {
-  static const void* ppp = GetPluginInterfaceSafe(PPP_MESSAGING_INTERFACE);
-  return static_cast<const PPP_Messaging*>(ppp);
-}
-
-const PPP_MouseLock* PPPMouseLockInterface() {
-  static const void* ppp = GetPluginInterfaceSafe(PPP_MOUSELOCK_INTERFACE);
-  return static_cast<const PPP_MouseLock*>(ppp);
-}
-
-const PPP_Printing_Dev* PPPPrintingInterface() {
-  static const void* ppp = GetPluginInterfaceSafe(PPP_PRINTING_DEV_INTERFACE);
-  return static_cast<const PPP_Printing_Dev*>(ppp);
-}
-
-const PPP_Selection_Dev* PPPSelectionInterface() {
-  static const void* ppp = GetPluginInterfaceSafe(PPP_SELECTION_DEV_INTERFACE);
-  return static_cast<const PPP_Selection_Dev*>(ppp);
-}
-
-const PPP_Zoom_Dev* PPPZoomInterface() {
-  static const void* ppp = GetPluginInterfaceSafe(PPP_ZOOM_DEV_INTERFACE);
-  return static_cast<const PPP_Zoom_Dev*>(ppp);
-}
-
-
-}  // namespace ppapi_proxy
-
-void PpapiPluginRegisterThreadCreator(
-    const struct PP_ThreadFunctions* new_funcs) {
-  thread_funcs = *new_funcs;
-}
-
-int IrtInit() {
-  // TODO(halyavin): this is needed for tests without IRT. They do not start
-  // in irt_entry.c where IrtInit is called.
-  static int initialized = 0;
-  if (initialized) {
-    return 0;
-  }
-  if (!NaClSrpcModuleInit()) {
-    return 1;
-  }
-  NaClLogModuleInit();  // Enable NaClLog'ing used by CHECK().
-  initialized = 1;
-  return 0;
-}
-
-int PpapiPluginMain() {
-  IrtInit();
-  // Designate this as the main thread for PPB_Core::IsMainThread().
-  ppapi_proxy::PluginCore::MarkMainThread();
-  if (!NaClSrpcAcceptClientConnection(PppRpcs::srpc_methods)) {
-    return 1;
-  }
-  NaClSrpcModuleFini();
-
-  return 0;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h
deleted file mode 100644
index 85e494b..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h
+++ /dev/null
@@ -1,82 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_GLOBALS_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_GLOBALS_H_
-
-#include "ppapi/c/dev/ppb_memory_dev.h"
-#include "ppapi/c/dev/ppp_find_dev.h"
-#include "ppapi/c/dev/ppp_printing_dev.h"
-#include "ppapi/c/dev/ppp_selection_dev.h"
-#include "ppapi/c/dev/ppp_zoom_dev.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/ppb.h"
-#include "ppapi/c/ppb_core.h"
-#include "ppapi/c/ppb_var.h"
-#include "ppapi/c/ppb_var_array_buffer.h"
-#include "ppapi/c/ppb_websocket.h"
-#include "ppapi/c/ppp_input_event.h"
-#include "ppapi/c/ppp_instance.h"
-#include "ppapi/c/ppp_messaging.h"
-#include "ppapi/c/ppp_mouse_lock.h"
-#include "native_client/src/shared/ppapi_proxy/ppp_instance_combined.h"
-#include "native_client/src/untrusted/irt/irt_ppapi.h"
-
-struct NaClSrpcChannel;
-
-namespace ppapi_proxy {
-
-// The main SRPC channel is that used to handle foreground (main thread)
-// RPC traffic.
-NaClSrpcChannel* GetMainSrpcChannel();
-void SetMainSrpcChannel(NaClSrpcChannel* channel);
-
-// The upcall SRPC channel is that used to handle other threads' RPC traffic.
-NaClSrpcChannel* GetUpcallSrpcChannel();
-void SetUpcallSrpcChannel(NaClSrpcChannel* channel);
-
-// Save the plugin's module_id, which is used for storage allocation tracking.
-void SetModuleIdForSrpcChannel(NaClSrpcChannel* channel, PP_Module module_id);
-// Forget the plugin's module_id.
-void UnsetModuleIdForSrpcChannel(NaClSrpcChannel* channel);
-// Save the plugin's module_id.
-PP_Module LookupModuleIdForSrpcChannel(NaClSrpcChannel* channel);
-
-// Support for getting PPB_ browser interfaces.
-// Safe version CHECK's for NULL.
-const void* GetBrowserInterface(const char* interface_name);
-const void* GetBrowserInterfaceSafe(const char* interface_name);
-// Functions marked "shared" are to be provided by both the browser and the
-// plugin side of the proxy, so they can be used by the shared proxy code
-// under both trusted and untrusted compilation.
-const PPB_Core* PPBCoreInterface();  // shared
-const PPB_Memory_Dev* PPBMemoryInterface();  // shared
-const PPB_Var* PPBVarInterface();  // shared
-const PPB_VarArrayBuffer* PPBVarArrayBufferInterface();  // shared
-const PPB_WebSocket* PPBWebSocketInterface();
-
-// Support for getting PPP_ plugin interfaces.
-// Safe version CHECK's for NULL.
-// Since no PppRpcServer function will be called if the interface is NULL,
-// safe version is used to define interface getters below.
-const void* GetPluginInterface(const char* interface_name);
-const void* GetPluginInterfaceSafe(const char* interface_name);
-const PPP_Find_Dev* PPPFindInterface();
-const PPP_InputEvent* PPPInputEventInterface();
-PPP_Instance_Combined* PPPInstanceInterface();
-const PPP_Messaging* PPPMessagingInterface();
-const PPP_MouseLock* PPPMouseLockInterface();
-const PPP_Printing_Dev* PPPPrintingInterface();
-const PPP_Selection_Dev* PPPSelectionInterface();
-const PPP_Zoom_Dev* PPPZoomInterface();
-
-// Get thread creation/join functions.
-const struct PP_ThreadFunctions* GetThreadCreator();
-
-// PPAPI constants used in the proxy.
-extern const PP_Resource kInvalidResourceId;
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_GLOBALS_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_instance_data.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_instance_data.cc
deleted file mode 100644
index 4764a66..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_instance_data.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2011 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "native_client/src/shared/ppapi_proxy/plugin_instance_data.h"
-
-#include <tr1/unordered_map>
-
-namespace ppapi_proxy {
-
-namespace {
-
-typedef std::tr1::unordered_map<PP_Instance, PluginInstanceData*> InstanceMap;
-
-InstanceMap& GetInstanceMap() {
-  static InstanceMap map;
-  return map;
-}
-
-}  // namespace
-
-// static
-PluginInstanceData* PluginInstanceData::FromPP(PP_Instance id) {
-  InstanceMap& map = GetInstanceMap();
-  InstanceMap::iterator i = map.find(id);
-
-  return map.end() == i ? NULL : i->second;
-}
-
-// static
-void PluginInstanceData::DidCreate(PP_Instance id) {
-  InstanceMap& map = GetInstanceMap();
-  // TODO(neb): figure out how to use CHECK in NaCl land.
-//  CHECK(map.end() == map.find(id));
-  map[id] = new PluginInstanceData(id);
-}
-
-// static
-void PluginInstanceData::DidDestroy(PP_Instance id) {
-  GetInstanceMap().erase(id);
-}
-
-// static
-bool PluginInstanceData::IsFullscreen(PP_Instance id) {
-  PluginInstanceData* instance = FromPP(id);
-  if (instance)
-    return instance->last_view_data_.is_fullscreen;
-  return false;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_instance_data.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_instance_data.h
deleted file mode 100644
index 57bb9af..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_instance_data.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2011 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_INSTANCE_DATA_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_INSTANCE_DATA_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_rect.h"
-#include "ppapi/native_client/src/shared/ppapi_proxy/view_data.h"
-
-namespace ppapi_proxy {
-
-// Per-instance data on the plugin side.
-class PluginInstanceData {
- public:
-  static PluginInstanceData* FromPP(PP_Instance id);
-  static void DidCreate(PP_Instance id);
-  static void DidDestroy(PP_Instance id);
-  static bool IsFullscreen(PP_Instance id);
-
-  PluginInstanceData(PP_Instance id) : id_(id) {
-  }
-  ~PluginInstanceData() {}
-
-  PP_Instance id() { return id_; }
-
-  void set_last_view_data(const ViewData& data) { last_view_data_ = data; }
-  const ViewData& last_view_data() const { return last_view_data_; }
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginInstanceData);
-
-  PP_Instance id_;
-
-  ViewData last_view_data_;
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_INSTANCE_DATA_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_main.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_main.cc
deleted file mode 100644
index d0a9fb0..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_main.cc
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (c) 2011 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "native_client/src/shared/ppapi_proxy/ppruntime.h"
-
-// PPAPI plugins are actually "hosted" by ppruntime.  This is because the
-// library needs to start an SRPC loop to dispatch to the stubs.
-//
-// This definition is weak to allow customers to override it when
-// initialization is needed before the main PPAPI processing happens.
-
-int __attribute__ ((weak)) main(int argc, char* argv[]) {
-  return PpapiPluginMain();
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_opengles.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_opengles.cc
deleted file mode 100644
index d1f41bd..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_opengles.cc
+++ /dev/null
@@ -1,912 +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.
-
-// This file is auto-generated from
-// gpu/command_buffer/build_gles2_cmd_buffer.py
-// DO NOT EDIT!
-
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h"
-
-#include "gpu/command_buffer/client/gles2_implementation.h"
-#include "ppapi/c/ppb_opengles2.h"
-
-using ppapi_proxy::PluginGraphics3D;
-using ppapi_proxy::PluginResource;
-
-namespace {
-
-void ActiveTexture(PP_Resource context, GLenum texture) {
-  PluginGraphics3D::implFromResource(context)->ActiveTexture(texture);
-}
-void AttachShader(PP_Resource context, GLuint program, GLuint shader) {
-  PluginGraphics3D::implFromResource(context)->AttachShader(program, shader);
-}
-void BindAttribLocation(
-    PP_Resource context, GLuint program, GLuint index, const char* name) {
-  PluginGraphics3D::implFromResource(
-      context)->BindAttribLocation(program, index, name);
-}
-void BindBuffer(PP_Resource context, GLenum target, GLuint buffer) {
-  PluginGraphics3D::implFromResource(context)->BindBuffer(target, buffer);
-}
-void BindFramebuffer(PP_Resource context, GLenum target, GLuint framebuffer) {
-  PluginGraphics3D::implFromResource(
-      context)->BindFramebuffer(target, framebuffer);
-}
-void BindRenderbuffer(
-    PP_Resource context, GLenum target, GLuint renderbuffer) {
-  PluginGraphics3D::implFromResource(
-      context)->BindRenderbuffer(target, renderbuffer);
-}
-void BindTexture(PP_Resource context, GLenum target, GLuint texture) {
-  PluginGraphics3D::implFromResource(context)->BindTexture(target, texture);
-}
-void BlendColor(
-    PP_Resource context, GLclampf red, GLclampf green, GLclampf blue,
-    GLclampf alpha) {
-  PluginGraphics3D::implFromResource(
-      context)->BlendColor(red, green, blue, alpha);
-}
-void BlendEquation(PP_Resource context, GLenum mode) {
-  PluginGraphics3D::implFromResource(context)->BlendEquation(mode);
-}
-void BlendEquationSeparate(
-    PP_Resource context, GLenum modeRGB, GLenum modeAlpha) {
-  PluginGraphics3D::implFromResource(
-      context)->BlendEquationSeparate(modeRGB, modeAlpha);
-}
-void BlendFunc(PP_Resource context, GLenum sfactor, GLenum dfactor) {
-  PluginGraphics3D::implFromResource(context)->BlendFunc(sfactor, dfactor);
-}
-void BlendFuncSeparate(
-    PP_Resource context, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha,
-    GLenum dstAlpha) {
-  PluginGraphics3D::implFromResource(
-      context)->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-void BufferData(
-    PP_Resource context, GLenum target, GLsizeiptr size, const void* data,
-    GLenum usage) {
-  PluginGraphics3D::implFromResource(
-      context)->BufferData(target, size, data, usage);
-}
-void BufferSubData(
-    PP_Resource context, GLenum target, GLintptr offset, GLsizeiptr size,
-    const void* data) {
-  PluginGraphics3D::implFromResource(
-      context)->BufferSubData(target, offset, size, data);
-}
-GLenum CheckFramebufferStatus(PP_Resource context, GLenum target) {
-  return PluginGraphics3D::implFromResource(
-      context)->CheckFramebufferStatus(target);
-}
-void Clear(PP_Resource context, GLbitfield mask) {
-  PluginGraphics3D::implFromResource(context)->Clear(mask);
-}
-void ClearColor(
-    PP_Resource context, GLclampf red, GLclampf green, GLclampf blue,
-    GLclampf alpha) {
-  PluginGraphics3D::implFromResource(
-      context)->ClearColor(red, green, blue, alpha);
-}
-void ClearDepthf(PP_Resource context, GLclampf depth) {
-  PluginGraphics3D::implFromResource(context)->ClearDepthf(depth);
-}
-void ClearStencil(PP_Resource context, GLint s) {
-  PluginGraphics3D::implFromResource(context)->ClearStencil(s);
-}
-void ColorMask(
-    PP_Resource context, GLboolean red, GLboolean green, GLboolean blue,
-    GLboolean alpha) {
-  PluginGraphics3D::implFromResource(
-      context)->ColorMask(red, green, blue, alpha);
-}
-void CompileShader(PP_Resource context, GLuint shader) {
-  PluginGraphics3D::implFromResource(context)->CompileShader(shader);
-}
-void CompressedTexImage2D(
-    PP_Resource context, GLenum target, GLint level, GLenum internalformat,
-    GLsizei width, GLsizei height, GLint border, GLsizei imageSize,
-    const void* data) {
-  PluginGraphics3D::implFromResource(
-      context)->CompressedTexImage2D(
-          target, level, internalformat, width, height, border, imageSize,
-          data);
-}
-void CompressedTexSubImage2D(
-    PP_Resource context, GLenum target, GLint level, GLint xoffset,
-    GLint yoffset, GLsizei width, GLsizei height, GLenum format,
-    GLsizei imageSize, const void* data) {
-  PluginGraphics3D::implFromResource(
-      context)->CompressedTexSubImage2D(
-          target, level, xoffset, yoffset, width, height, format, imageSize,
-          data);
-}
-void CopyTexImage2D(
-    PP_Resource context, GLenum target, GLint level, GLenum internalformat,
-    GLint x, GLint y, GLsizei width, GLsizei height, GLint border) {
-  PluginGraphics3D::implFromResource(
-      context)->CopyTexImage2D(
-          target, level, internalformat, x, y, width, height, border);
-}
-void CopyTexSubImage2D(
-    PP_Resource context, GLenum target, GLint level, GLint xoffset,
-    GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
-  PluginGraphics3D::implFromResource(
-      context)->CopyTexSubImage2D(
-          target, level, xoffset, yoffset, x, y, width, height);
-}
-GLuint CreateProgram(PP_Resource context) {
-  return PluginGraphics3D::implFromResource(context)->CreateProgram();
-}
-GLuint CreateShader(PP_Resource context, GLenum type) {
-  return PluginGraphics3D::implFromResource(context)->CreateShader(type);
-}
-void CullFace(PP_Resource context, GLenum mode) {
-  PluginGraphics3D::implFromResource(context)->CullFace(mode);
-}
-void DeleteBuffers(PP_Resource context, GLsizei n, const GLuint* buffers) {
-  PluginGraphics3D::implFromResource(context)->DeleteBuffers(n, buffers);
-}
-void DeleteFramebuffers(
-    PP_Resource context, GLsizei n, const GLuint* framebuffers) {
-  PluginGraphics3D::implFromResource(
-      context)->DeleteFramebuffers(n, framebuffers);
-}
-void DeleteProgram(PP_Resource context, GLuint program) {
-  PluginGraphics3D::implFromResource(context)->DeleteProgram(program);
-}
-void DeleteRenderbuffers(
-    PP_Resource context, GLsizei n, const GLuint* renderbuffers) {
-  PluginGraphics3D::implFromResource(
-      context)->DeleteRenderbuffers(n, renderbuffers);
-}
-void DeleteShader(PP_Resource context, GLuint shader) {
-  PluginGraphics3D::implFromResource(context)->DeleteShader(shader);
-}
-void DeleteTextures(PP_Resource context, GLsizei n, const GLuint* textures) {
-  PluginGraphics3D::implFromResource(context)->DeleteTextures(n, textures);
-}
-void DepthFunc(PP_Resource context, GLenum func) {
-  PluginGraphics3D::implFromResource(context)->DepthFunc(func);
-}
-void DepthMask(PP_Resource context, GLboolean flag) {
-  PluginGraphics3D::implFromResource(context)->DepthMask(flag);
-}
-void DepthRangef(PP_Resource context, GLclampf zNear, GLclampf zFar) {
-  PluginGraphics3D::implFromResource(context)->DepthRangef(zNear, zFar);
-}
-void DetachShader(PP_Resource context, GLuint program, GLuint shader) {
-  PluginGraphics3D::implFromResource(context)->DetachShader(program, shader);
-}
-void Disable(PP_Resource context, GLenum cap) {
-  PluginGraphics3D::implFromResource(context)->Disable(cap);
-}
-void DisableVertexAttribArray(PP_Resource context, GLuint index) {
-  PluginGraphics3D::implFromResource(context)->DisableVertexAttribArray(index);
-}
-void DrawArrays(PP_Resource context, GLenum mode, GLint first, GLsizei count) {
-  PluginGraphics3D::implFromResource(context)->DrawArrays(mode, first, count);
-}
-void DrawElements(
-    PP_Resource context, GLenum mode, GLsizei count, GLenum type,
-    const void* indices) {
-  PluginGraphics3D::implFromResource(
-      context)->DrawElements(mode, count, type, indices);
-}
-void Enable(PP_Resource context, GLenum cap) {
-  PluginGraphics3D::implFromResource(context)->Enable(cap);
-}
-void EnableVertexAttribArray(PP_Resource context, GLuint index) {
-  PluginGraphics3D::implFromResource(context)->EnableVertexAttribArray(index);
-}
-void Finish(PP_Resource context) {
-  PluginGraphics3D::implFromResource(context)->Finish();
-}
-void Flush(PP_Resource context) {
-  PluginGraphics3D::implFromResource(context)->Flush();
-}
-void FramebufferRenderbuffer(
-    PP_Resource context, GLenum target, GLenum attachment,
-    GLenum renderbuffertarget, GLuint renderbuffer) {
-  PluginGraphics3D::implFromResource(
-      context)->FramebufferRenderbuffer(
-          target, attachment, renderbuffertarget, renderbuffer);
-}
-void FramebufferTexture2D(
-    PP_Resource context, GLenum target, GLenum attachment, GLenum textarget,
-    GLuint texture, GLint level) {
-  PluginGraphics3D::implFromResource(
-      context)->FramebufferTexture2D(
-          target, attachment, textarget, texture, level);
-}
-void FrontFace(PP_Resource context, GLenum mode) {
-  PluginGraphics3D::implFromResource(context)->FrontFace(mode);
-}
-void GenBuffers(PP_Resource context, GLsizei n, GLuint* buffers) {
-  PluginGraphics3D::implFromResource(context)->GenBuffers(n, buffers);
-}
-void GenerateMipmap(PP_Resource context, GLenum target) {
-  PluginGraphics3D::implFromResource(context)->GenerateMipmap(target);
-}
-void GenFramebuffers(PP_Resource context, GLsizei n, GLuint* framebuffers) {
-  PluginGraphics3D::implFromResource(
-      context)->GenFramebuffers(n, framebuffers);
-}
-void GenRenderbuffers(PP_Resource context, GLsizei n, GLuint* renderbuffers) {
-  PluginGraphics3D::implFromResource(
-      context)->GenRenderbuffers(n, renderbuffers);
-}
-void GenTextures(PP_Resource context, GLsizei n, GLuint* textures) {
-  PluginGraphics3D::implFromResource(context)->GenTextures(n, textures);
-}
-void GetActiveAttrib(
-    PP_Resource context, GLuint program, GLuint index, GLsizei bufsize,
-    GLsizei* length, GLint* size, GLenum* type, char* name) {
-  PluginGraphics3D::implFromResource(
-      context)->GetActiveAttrib(
-          program, index, bufsize, length, size, type, name);
-}
-void GetActiveUniform(
-    PP_Resource context, GLuint program, GLuint index, GLsizei bufsize,
-    GLsizei* length, GLint* size, GLenum* type, char* name) {
-  PluginGraphics3D::implFromResource(
-      context)->GetActiveUniform(
-          program, index, bufsize, length, size, type, name);
-}
-void GetAttachedShaders(
-    PP_Resource context, GLuint program, GLsizei maxcount, GLsizei* count,
-    GLuint* shaders) {
-  PluginGraphics3D::implFromResource(
-      context)->GetAttachedShaders(program, maxcount, count, shaders);
-}
-GLint GetAttribLocation(
-    PP_Resource context, GLuint program, const char* name) {
-  return PluginGraphics3D::implFromResource(
-      context)->GetAttribLocation(program, name);
-}
-void GetBooleanv(PP_Resource context, GLenum pname, GLboolean* params) {
-  PluginGraphics3D::implFromResource(context)->GetBooleanv(pname, params);
-}
-void GetBufferParameteriv(
-    PP_Resource context, GLenum target, GLenum pname, GLint* params) {
-  PluginGraphics3D::implFromResource(
-      context)->GetBufferParameteriv(target, pname, params);
-}
-GLenum GetError(PP_Resource context) {
-  return PluginGraphics3D::implFromResource(context)->GetError();
-}
-void GetFloatv(PP_Resource context, GLenum pname, GLfloat* params) {
-  PluginGraphics3D::implFromResource(context)->GetFloatv(pname, params);
-}
-void GetFramebufferAttachmentParameteriv(
-    PP_Resource context, GLenum target, GLenum attachment, GLenum pname,
-    GLint* params) {
-  PluginGraphics3D::implFromResource(
-      context)->GetFramebufferAttachmentParameteriv(
-          target, attachment, pname, params);
-}
-void GetIntegerv(PP_Resource context, GLenum pname, GLint* params) {
-  PluginGraphics3D::implFromResource(context)->GetIntegerv(pname, params);
-}
-void GetProgramiv(
-    PP_Resource context, GLuint program, GLenum pname, GLint* params) {
-  PluginGraphics3D::implFromResource(
-      context)->GetProgramiv(program, pname, params);
-}
-void GetProgramInfoLog(
-    PP_Resource context, GLuint program, GLsizei bufsize, GLsizei* length,
-    char* infolog) {
-  PluginGraphics3D::implFromResource(
-      context)->GetProgramInfoLog(program, bufsize, length, infolog);
-}
-void GetRenderbufferParameteriv(
-    PP_Resource context, GLenum target, GLenum pname, GLint* params) {
-  PluginGraphics3D::implFromResource(
-      context)->GetRenderbufferParameteriv(target, pname, params);
-}
-void GetShaderiv(
-    PP_Resource context, GLuint shader, GLenum pname, GLint* params) {
-  PluginGraphics3D::implFromResource(
-      context)->GetShaderiv(shader, pname, params);
-}
-void GetShaderInfoLog(
-    PP_Resource context, GLuint shader, GLsizei bufsize, GLsizei* length,
-    char* infolog) {
-  PluginGraphics3D::implFromResource(
-      context)->GetShaderInfoLog(shader, bufsize, length, infolog);
-}
-void GetShaderPrecisionFormat(
-    PP_Resource context, GLenum shadertype, GLenum precisiontype, GLint* range,
-    GLint* precision) {
-  PluginGraphics3D::implFromResource(
-      context)->GetShaderPrecisionFormat(
-          shadertype, precisiontype, range, precision);
-}
-void GetShaderSource(
-    PP_Resource context, GLuint shader, GLsizei bufsize, GLsizei* length,
-    char* source) {
-  PluginGraphics3D::implFromResource(
-      context)->GetShaderSource(shader, bufsize, length, source);
-}
-const GLubyte* GetString(PP_Resource context, GLenum name) {
-  return PluginGraphics3D::implFromResource(context)->GetString(name);
-}
-void GetTexParameterfv(
-    PP_Resource context, GLenum target, GLenum pname, GLfloat* params) {
-  PluginGraphics3D::implFromResource(
-      context)->GetTexParameterfv(target, pname, params);
-}
-void GetTexParameteriv(
-    PP_Resource context, GLenum target, GLenum pname, GLint* params) {
-  PluginGraphics3D::implFromResource(
-      context)->GetTexParameteriv(target, pname, params);
-}
-void GetUniformfv(
-    PP_Resource context, GLuint program, GLint location, GLfloat* params) {
-  PluginGraphics3D::implFromResource(
-      context)->GetUniformfv(program, location, params);
-}
-void GetUniformiv(
-    PP_Resource context, GLuint program, GLint location, GLint* params) {
-  PluginGraphics3D::implFromResource(
-      context)->GetUniformiv(program, location, params);
-}
-GLint GetUniformLocation(
-    PP_Resource context, GLuint program, const char* name) {
-  return PluginGraphics3D::implFromResource(
-      context)->GetUniformLocation(program, name);
-}
-void GetVertexAttribfv(
-    PP_Resource context, GLuint index, GLenum pname, GLfloat* params) {
-  PluginGraphics3D::implFromResource(
-      context)->GetVertexAttribfv(index, pname, params);
-}
-void GetVertexAttribiv(
-    PP_Resource context, GLuint index, GLenum pname, GLint* params) {
-  PluginGraphics3D::implFromResource(
-      context)->GetVertexAttribiv(index, pname, params);
-}
-void GetVertexAttribPointerv(
-    PP_Resource context, GLuint index, GLenum pname, void** pointer) {
-  PluginGraphics3D::implFromResource(
-      context)->GetVertexAttribPointerv(index, pname, pointer);
-}
-void Hint(PP_Resource context, GLenum target, GLenum mode) {
-  PluginGraphics3D::implFromResource(context)->Hint(target, mode);
-}
-GLboolean IsBuffer(PP_Resource context, GLuint buffer) {
-  return PluginGraphics3D::implFromResource(context)->IsBuffer(buffer);
-}
-GLboolean IsEnabled(PP_Resource context, GLenum cap) {
-  return PluginGraphics3D::implFromResource(context)->IsEnabled(cap);
-}
-GLboolean IsFramebuffer(PP_Resource context, GLuint framebuffer) {
-  return PluginGraphics3D::implFromResource(
-      context)->IsFramebuffer(framebuffer);
-}
-GLboolean IsProgram(PP_Resource context, GLuint program) {
-  return PluginGraphics3D::implFromResource(context)->IsProgram(program);
-}
-GLboolean IsRenderbuffer(PP_Resource context, GLuint renderbuffer) {
-  return PluginGraphics3D::implFromResource(
-      context)->IsRenderbuffer(renderbuffer);
-}
-GLboolean IsShader(PP_Resource context, GLuint shader) {
-  return PluginGraphics3D::implFromResource(context)->IsShader(shader);
-}
-GLboolean IsTexture(PP_Resource context, GLuint texture) {
-  return PluginGraphics3D::implFromResource(context)->IsTexture(texture);
-}
-void LineWidth(PP_Resource context, GLfloat width) {
-  PluginGraphics3D::implFromResource(context)->LineWidth(width);
-}
-void LinkProgram(PP_Resource context, GLuint program) {
-  PluginGraphics3D::implFromResource(context)->LinkProgram(program);
-}
-void PixelStorei(PP_Resource context, GLenum pname, GLint param) {
-  PluginGraphics3D::implFromResource(context)->PixelStorei(pname, param);
-}
-void PolygonOffset(PP_Resource context, GLfloat factor, GLfloat units) {
-  PluginGraphics3D::implFromResource(context)->PolygonOffset(factor, units);
-}
-void ReadPixels(
-    PP_Resource context, GLint x, GLint y, GLsizei width, GLsizei height,
-    GLenum format, GLenum type, void* pixels) {
-  PluginGraphics3D::implFromResource(
-      context)->ReadPixels(x, y, width, height, format, type, pixels);
-}
-void ReleaseShaderCompiler(PP_Resource context) {
-  PluginGraphics3D::implFromResource(context)->ReleaseShaderCompiler();
-}
-void RenderbufferStorage(
-    PP_Resource context, GLenum target, GLenum internalformat, GLsizei width,
-    GLsizei height) {
-  PluginGraphics3D::implFromResource(
-      context)->RenderbufferStorage(target, internalformat, width, height);
-}
-void SampleCoverage(PP_Resource context, GLclampf value, GLboolean invert) {
-  PluginGraphics3D::implFromResource(context)->SampleCoverage(value, invert);
-}
-void Scissor(
-    PP_Resource context, GLint x, GLint y, GLsizei width, GLsizei height) {
-  PluginGraphics3D::implFromResource(context)->Scissor(x, y, width, height);
-}
-void ShaderBinary(
-    PP_Resource context, GLsizei n, const GLuint* shaders, GLenum binaryformat,
-    const void* binary, GLsizei length) {
-  PluginGraphics3D::implFromResource(
-      context)->ShaderBinary(n, shaders, binaryformat, binary, length);
-}
-void ShaderSource(
-    PP_Resource context, GLuint shader, GLsizei count, const char** str,
-    const GLint* length) {
-  PluginGraphics3D::implFromResource(
-      context)->ShaderSource(shader, count, str, length);
-}
-void StencilFunc(PP_Resource context, GLenum func, GLint ref, GLuint mask) {
-  PluginGraphics3D::implFromResource(context)->StencilFunc(func, ref, mask);
-}
-void StencilFuncSeparate(
-    PP_Resource context, GLenum face, GLenum func, GLint ref, GLuint mask) {
-  PluginGraphics3D::implFromResource(
-      context)->StencilFuncSeparate(face, func, ref, mask);
-}
-void StencilMask(PP_Resource context, GLuint mask) {
-  PluginGraphics3D::implFromResource(context)->StencilMask(mask);
-}
-void StencilMaskSeparate(PP_Resource context, GLenum face, GLuint mask) {
-  PluginGraphics3D::implFromResource(context)->StencilMaskSeparate(face, mask);
-}
-void StencilOp(PP_Resource context, GLenum fail, GLenum zfail, GLenum zpass) {
-  PluginGraphics3D::implFromResource(context)->StencilOp(fail, zfail, zpass);
-}
-void StencilOpSeparate(
-    PP_Resource context, GLenum face, GLenum fail, GLenum zfail,
-    GLenum zpass) {
-  PluginGraphics3D::implFromResource(
-      context)->StencilOpSeparate(face, fail, zfail, zpass);
-}
-void TexImage2D(
-    PP_Resource context, GLenum target, GLint level, GLint internalformat,
-    GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type,
-    const void* pixels) {
-  PluginGraphics3D::implFromResource(
-      context)->TexImage2D(
-          target, level, internalformat, width, height, border, format, type,
-          pixels);
-}
-void TexParameterf(
-    PP_Resource context, GLenum target, GLenum pname, GLfloat param) {
-  PluginGraphics3D::implFromResource(
-      context)->TexParameterf(target, pname, param);
-}
-void TexParameterfv(
-    PP_Resource context, GLenum target, GLenum pname, const GLfloat* params) {
-  PluginGraphics3D::implFromResource(
-      context)->TexParameterfv(target, pname, params);
-}
-void TexParameteri(
-    PP_Resource context, GLenum target, GLenum pname, GLint param) {
-  PluginGraphics3D::implFromResource(
-      context)->TexParameteri(target, pname, param);
-}
-void TexParameteriv(
-    PP_Resource context, GLenum target, GLenum pname, const GLint* params) {
-  PluginGraphics3D::implFromResource(
-      context)->TexParameteriv(target, pname, params);
-}
-void TexSubImage2D(
-    PP_Resource context, GLenum target, GLint level, GLint xoffset,
-    GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type,
-    const void* pixels) {
-  PluginGraphics3D::implFromResource(
-      context)->TexSubImage2D(
-          target, level, xoffset, yoffset, width, height, format, type,
-          pixels);
-}
-void Uniform1f(PP_Resource context, GLint location, GLfloat x) {
-  PluginGraphics3D::implFromResource(context)->Uniform1f(location, x);
-}
-void Uniform1fv(
-    PP_Resource context, GLint location, GLsizei count, const GLfloat* v) {
-  PluginGraphics3D::implFromResource(context)->Uniform1fv(location, count, v);
-}
-void Uniform1i(PP_Resource context, GLint location, GLint x) {
-  PluginGraphics3D::implFromResource(context)->Uniform1i(location, x);
-}
-void Uniform1iv(
-    PP_Resource context, GLint location, GLsizei count, const GLint* v) {
-  PluginGraphics3D::implFromResource(context)->Uniform1iv(location, count, v);
-}
-void Uniform2f(PP_Resource context, GLint location, GLfloat x, GLfloat y) {
-  PluginGraphics3D::implFromResource(context)->Uniform2f(location, x, y);
-}
-void Uniform2fv(
-    PP_Resource context, GLint location, GLsizei count, const GLfloat* v) {
-  PluginGraphics3D::implFromResource(context)->Uniform2fv(location, count, v);
-}
-void Uniform2i(PP_Resource context, GLint location, GLint x, GLint y) {
-  PluginGraphics3D::implFromResource(context)->Uniform2i(location, x, y);
-}
-void Uniform2iv(
-    PP_Resource context, GLint location, GLsizei count, const GLint* v) {
-  PluginGraphics3D::implFromResource(context)->Uniform2iv(location, count, v);
-}
-void Uniform3f(
-    PP_Resource context, GLint location, GLfloat x, GLfloat y, GLfloat z) {
-  PluginGraphics3D::implFromResource(context)->Uniform3f(location, x, y, z);
-}
-void Uniform3fv(
-    PP_Resource context, GLint location, GLsizei count, const GLfloat* v) {
-  PluginGraphics3D::implFromResource(context)->Uniform3fv(location, count, v);
-}
-void Uniform3i(
-    PP_Resource context, GLint location, GLint x, GLint y, GLint z) {
-  PluginGraphics3D::implFromResource(context)->Uniform3i(location, x, y, z);
-}
-void Uniform3iv(
-    PP_Resource context, GLint location, GLsizei count, const GLint* v) {
-  PluginGraphics3D::implFromResource(context)->Uniform3iv(location, count, v);
-}
-void Uniform4f(
-    PP_Resource context, GLint location, GLfloat x, GLfloat y, GLfloat z,
-    GLfloat w) {
-  PluginGraphics3D::implFromResource(context)->Uniform4f(location, x, y, z, w);
-}
-void Uniform4fv(
-    PP_Resource context, GLint location, GLsizei count, const GLfloat* v) {
-  PluginGraphics3D::implFromResource(context)->Uniform4fv(location, count, v);
-}
-void Uniform4i(
-    PP_Resource context, GLint location, GLint x, GLint y, GLint z, GLint w) {
-  PluginGraphics3D::implFromResource(context)->Uniform4i(location, x, y, z, w);
-}
-void Uniform4iv(
-    PP_Resource context, GLint location, GLsizei count, const GLint* v) {
-  PluginGraphics3D::implFromResource(context)->Uniform4iv(location, count, v);
-}
-void UniformMatrix2fv(
-    PP_Resource context, GLint location, GLsizei count, GLboolean transpose,
-    const GLfloat* value) {
-  PluginGraphics3D::implFromResource(
-      context)->UniformMatrix2fv(location, count, transpose, value);
-}
-void UniformMatrix3fv(
-    PP_Resource context, GLint location, GLsizei count, GLboolean transpose,
-    const GLfloat* value) {
-  PluginGraphics3D::implFromResource(
-      context)->UniformMatrix3fv(location, count, transpose, value);
-}
-void UniformMatrix4fv(
-    PP_Resource context, GLint location, GLsizei count, GLboolean transpose,
-    const GLfloat* value) {
-  PluginGraphics3D::implFromResource(
-      context)->UniformMatrix4fv(location, count, transpose, value);
-}
-void UseProgram(PP_Resource context, GLuint program) {
-  PluginGraphics3D::implFromResource(context)->UseProgram(program);
-}
-void ValidateProgram(PP_Resource context, GLuint program) {
-  PluginGraphics3D::implFromResource(context)->ValidateProgram(program);
-}
-void VertexAttrib1f(PP_Resource context, GLuint indx, GLfloat x) {
-  PluginGraphics3D::implFromResource(context)->VertexAttrib1f(indx, x);
-}
-void VertexAttrib1fv(PP_Resource context, GLuint indx, const GLfloat* values) {
-  PluginGraphics3D::implFromResource(context)->VertexAttrib1fv(indx, values);
-}
-void VertexAttrib2f(PP_Resource context, GLuint indx, GLfloat x, GLfloat y) {
-  PluginGraphics3D::implFromResource(context)->VertexAttrib2f(indx, x, y);
-}
-void VertexAttrib2fv(PP_Resource context, GLuint indx, const GLfloat* values) {
-  PluginGraphics3D::implFromResource(context)->VertexAttrib2fv(indx, values);
-}
-void VertexAttrib3f(
-    PP_Resource context, GLuint indx, GLfloat x, GLfloat y, GLfloat z) {
-  PluginGraphics3D::implFromResource(context)->VertexAttrib3f(indx, x, y, z);
-}
-void VertexAttrib3fv(PP_Resource context, GLuint indx, const GLfloat* values) {
-  PluginGraphics3D::implFromResource(context)->VertexAttrib3fv(indx, values);
-}
-void VertexAttrib4f(
-    PP_Resource context, GLuint indx, GLfloat x, GLfloat y, GLfloat z,
-    GLfloat w) {
-  PluginGraphics3D::implFromResource(
-      context)->VertexAttrib4f(indx, x, y, z, w);
-}
-void VertexAttrib4fv(PP_Resource context, GLuint indx, const GLfloat* values) {
-  PluginGraphics3D::implFromResource(context)->VertexAttrib4fv(indx, values);
-}
-void VertexAttribPointer(
-    PP_Resource context, GLuint indx, GLint size, GLenum type,
-    GLboolean normalized, GLsizei stride, const void* ptr) {
-  PluginGraphics3D::implFromResource(
-      context)->VertexAttribPointer(indx, size, type, normalized, stride, ptr);
-}
-void Viewport(
-    PP_Resource context, GLint x, GLint y, GLsizei width, GLsizei height) {
-  PluginGraphics3D::implFromResource(context)->Viewport(x, y, width, height);
-}
-void BlitFramebufferEXT(
-    PP_Resource context, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
-    GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask,
-    GLenum filter) {
-  PluginGraphics3D::implFromResource(
-      context)->BlitFramebufferEXT(
-          srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
-          filter);
-}
-void RenderbufferStorageMultisampleEXT(
-    PP_Resource context, GLenum target, GLsizei samples, GLenum internalformat,
-    GLsizei width, GLsizei height) {
-  PluginGraphics3D::implFromResource(
-      context)->RenderbufferStorageMultisampleEXT(
-          target, samples, internalformat, width, height);
-}
-void GenQueriesEXT(PP_Resource context, GLsizei n, GLuint* queries) {
-  PluginGraphics3D::implFromResource(context)->GenQueriesEXT(n, queries);
-}
-void DeleteQueriesEXT(PP_Resource context, GLsizei n, const GLuint* queries) {
-  PluginGraphics3D::implFromResource(context)->DeleteQueriesEXT(n, queries);
-}
-GLboolean IsQueryEXT(PP_Resource context, GLuint id) {
-  return PluginGraphics3D::implFromResource(context)->IsQueryEXT(id);
-}
-void BeginQueryEXT(PP_Resource context, GLenum target, GLuint id) {
-  PluginGraphics3D::implFromResource(context)->BeginQueryEXT(target, id);
-}
-void EndQueryEXT(PP_Resource context, GLenum target) {
-  PluginGraphics3D::implFromResource(context)->EndQueryEXT(target);
-}
-void GetQueryivEXT(
-    PP_Resource context, GLenum target, GLenum pname, GLint* params) {
-  PluginGraphics3D::implFromResource(
-      context)->GetQueryivEXT(target, pname, params);
-}
-void GetQueryObjectuivEXT(
-    PP_Resource context, GLuint id, GLenum pname, GLuint* params) {
-  PluginGraphics3D::implFromResource(
-      context)->GetQueryObjectuivEXT(id, pname, params);
-}
-GLboolean EnableFeatureCHROMIUM(PP_Resource context, const char* feature) {
-  return PluginGraphics3D::implFromResource(
-      context)->EnableFeatureCHROMIUM(feature);
-}
-void* MapBufferSubDataCHROMIUM(
-    PP_Resource context, GLuint target, GLintptr offset, GLsizeiptr size,
-    GLenum access) {
-  return PluginGraphics3D::implFromResource(
-      context)->MapBufferSubDataCHROMIUM(target, offset, size, access);
-}
-void UnmapBufferSubDataCHROMIUM(PP_Resource context, const void* mem) {
-  PluginGraphics3D::implFromResource(context)->UnmapBufferSubDataCHROMIUM(mem);
-}
-void* MapTexSubImage2DCHROMIUM(
-    PP_Resource context, GLenum target, GLint level, GLint xoffset,
-    GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type,
-    GLenum access) {
-  return PluginGraphics3D::implFromResource(
-      context)->MapTexSubImage2DCHROMIUM(
-          target, level, xoffset, yoffset, width, height, format, type,
-          access);
-}
-void UnmapTexSubImage2DCHROMIUM(PP_Resource context, const void* mem) {
-  PluginGraphics3D::implFromResource(context)->UnmapTexSubImage2DCHROMIUM(mem);
-}
-void DrawArraysInstancedANGLE(
-    PP_Resource context, GLenum mode, GLint first, GLsizei count,
-    GLsizei primcount) {
-  PluginGraphics3D::implFromResource(
-      context)->DrawArraysInstancedANGLE(mode, first, count, primcount);
-}
-void DrawElementsInstancedANGLE(
-    PP_Resource context, GLenum mode, GLsizei count, GLenum type,
-    const void* indices, GLsizei primcount) {
-  PluginGraphics3D::implFromResource(
-      context)->DrawElementsInstancedANGLE(
-          mode, count, type, indices, primcount);
-}
-void VertexAttribDivisorANGLE(
-    PP_Resource context, GLuint index, GLuint divisor) {
-  PluginGraphics3D::implFromResource(
-      context)->VertexAttribDivisorANGLE(index, divisor);
-}
-
-} // namespace
-
-const PPB_OpenGLES2* PluginGraphics3D::GetOpenGLESInterface() {
-  const static struct PPB_OpenGLES2 ppb_opengles = {
-    &ActiveTexture,
-    &AttachShader,
-    &BindAttribLocation,
-    &BindBuffer,
-    &BindFramebuffer,
-    &BindRenderbuffer,
-    &BindTexture,
-    &BlendColor,
-    &BlendEquation,
-    &BlendEquationSeparate,
-    &BlendFunc,
-    &BlendFuncSeparate,
-    &BufferData,
-    &BufferSubData,
-    &CheckFramebufferStatus,
-    &Clear,
-    &ClearColor,
-    &ClearDepthf,
-    &ClearStencil,
-    &ColorMask,
-    &CompileShader,
-    &CompressedTexImage2D,
-    &CompressedTexSubImage2D,
-    &CopyTexImage2D,
-    &CopyTexSubImage2D,
-    &CreateProgram,
-    &CreateShader,
-    &CullFace,
-    &DeleteBuffers,
-    &DeleteFramebuffers,
-    &DeleteProgram,
-    &DeleteRenderbuffers,
-    &DeleteShader,
-    &DeleteTextures,
-    &DepthFunc,
-    &DepthMask,
-    &DepthRangef,
-    &DetachShader,
-    &Disable,
-    &DisableVertexAttribArray,
-    &DrawArrays,
-    &DrawElements,
-    &Enable,
-    &EnableVertexAttribArray,
-    &Finish,
-    &Flush,
-    &FramebufferRenderbuffer,
-    &FramebufferTexture2D,
-    &FrontFace,
-    &GenBuffers,
-    &GenerateMipmap,
-    &GenFramebuffers,
-    &GenRenderbuffers,
-    &GenTextures,
-    &GetActiveAttrib,
-    &GetActiveUniform,
-    &GetAttachedShaders,
-    &GetAttribLocation,
-    &GetBooleanv,
-    &GetBufferParameteriv,
-    &GetError,
-    &GetFloatv,
-    &GetFramebufferAttachmentParameteriv,
-    &GetIntegerv,
-    &GetProgramiv,
-    &GetProgramInfoLog,
-    &GetRenderbufferParameteriv,
-    &GetShaderiv,
-    &GetShaderInfoLog,
-    &GetShaderPrecisionFormat,
-    &GetShaderSource,
-    &GetString,
-    &GetTexParameterfv,
-    &GetTexParameteriv,
-    &GetUniformfv,
-    &GetUniformiv,
-    &GetUniformLocation,
-    &GetVertexAttribfv,
-    &GetVertexAttribiv,
-    &GetVertexAttribPointerv,
-    &Hint,
-    &IsBuffer,
-    &IsEnabled,
-    &IsFramebuffer,
-    &IsProgram,
-    &IsRenderbuffer,
-    &IsShader,
-    &IsTexture,
-    &LineWidth,
-    &LinkProgram,
-    &PixelStorei,
-    &PolygonOffset,
-    &ReadPixels,
-    &ReleaseShaderCompiler,
-    &RenderbufferStorage,
-    &SampleCoverage,
-    &Scissor,
-    &ShaderBinary,
-    &ShaderSource,
-    &StencilFunc,
-    &StencilFuncSeparate,
-    &StencilMask,
-    &StencilMaskSeparate,
-    &StencilOp,
-    &StencilOpSeparate,
-    &TexImage2D,
-    &TexParameterf,
-    &TexParameterfv,
-    &TexParameteri,
-    &TexParameteriv,
-    &TexSubImage2D,
-    &Uniform1f,
-    &Uniform1fv,
-    &Uniform1i,
-    &Uniform1iv,
-    &Uniform2f,
-    &Uniform2fv,
-    &Uniform2i,
-    &Uniform2iv,
-    &Uniform3f,
-    &Uniform3fv,
-    &Uniform3i,
-    &Uniform3iv,
-    &Uniform4f,
-    &Uniform4fv,
-    &Uniform4i,
-    &Uniform4iv,
-    &UniformMatrix2fv,
-    &UniformMatrix3fv,
-    &UniformMatrix4fv,
-    &UseProgram,
-    &ValidateProgram,
-    &VertexAttrib1f,
-    &VertexAttrib1fv,
-    &VertexAttrib2f,
-    &VertexAttrib2fv,
-    &VertexAttrib3f,
-    &VertexAttrib3fv,
-    &VertexAttrib4f,
-    &VertexAttrib4fv,
-    &VertexAttribPointer,
-    &Viewport
-  };
-  return &ppb_opengles;
-}
-const PPB_OpenGLES2InstancedArrays* PluginGraphics3D::GetOpenGLESInstancedArraysInterface() {  // NOLINT
-  const static struct PPB_OpenGLES2InstancedArrays ppb_opengles = {
-    &DrawArraysInstancedANGLE,
-    &DrawElementsInstancedANGLE,
-    &VertexAttribDivisorANGLE
-  };
-  return &ppb_opengles;
-}
-const PPB_OpenGLES2FramebufferBlit* PluginGraphics3D::GetOpenGLESFramebufferBlitInterface() {  // NOLINT
-  const static struct PPB_OpenGLES2FramebufferBlit ppb_opengles = {
-    &BlitFramebufferEXT
-  };
-  return &ppb_opengles;
-}
-const PPB_OpenGLES2FramebufferMultisample* PluginGraphics3D::GetOpenGLESFramebufferMultisampleInterface() {  // NOLINT
-  const static struct PPB_OpenGLES2FramebufferMultisample ppb_opengles = {
-    &RenderbufferStorageMultisampleEXT
-  };
-  return &ppb_opengles;
-}
-const PPB_OpenGLES2ChromiumEnableFeature* PluginGraphics3D::GetOpenGLESChromiumEnableFeatureInterface() {  // NOLINT
-  const static struct PPB_OpenGLES2ChromiumEnableFeature ppb_opengles = {
-    &EnableFeatureCHROMIUM
-  };
-  return &ppb_opengles;
-}
-const PPB_OpenGLES2ChromiumMapSub* PluginGraphics3D::GetOpenGLESChromiumMapSubInterface() {  // NOLINT
-  const static struct PPB_OpenGLES2ChromiumMapSub ppb_opengles = {
-    &MapBufferSubDataCHROMIUM,
-    &UnmapBufferSubDataCHROMIUM,
-    &MapTexSubImage2DCHROMIUM,
-    &UnmapTexSubImage2DCHROMIUM
-  };
-  return &ppb_opengles;
-}
-const PPB_OpenGLES2Query* PluginGraphics3D::GetOpenGLESQueryInterface() {
-  const static struct PPB_OpenGLES2Query ppb_opengles = {
-    &GenQueriesEXT,
-    &DeleteQueriesEXT,
-    &IsQueryEXT,
-    &BeginQueryEXT,
-    &EndQueryEXT,
-    &GetQueryivEXT,
-    &GetQueryObjectuivEXT
-  };
-  return &ppb_opengles;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc
deleted file mode 100644
index cb2f837..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc
+++ /dev/null
@@ -1,194 +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.
-//
-// Implements the untrusted side of the PPB_GetInterface method.
-
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include <stdlib.h>
-#include <string.h>
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_audio.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_audio_config.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_buffer.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_core.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_file_ref.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_find.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_font.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_fullscreen.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_host_resolver_private.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_image_data.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_instance.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_memory.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_net_address_private.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_network_list_private.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_network_monitor_private.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_server_socket_private.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_socket_private.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_testing.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_udp_socket_private.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_request_info.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_response_info.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_view.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_websocket.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_zoom.h"
-#include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-struct InterfaceMapElement {
-  const char* name;
-  const void* ppb_interface;
-  bool needs_browser_check;
-};
-
-// List of interfaces that have at least partial proxy support.
-InterfaceMapElement interface_map[] = {
-  { PPB_AUDIO_INTERFACE, PluginAudio::GetInterface(), true },
-  { PPB_AUDIO_CONFIG_INTERFACE, PluginAudioConfig::GetInterface(), true },
-  { PPB_AUDIO_CONFIG_INTERFACE_1_0, PluginAudioConfig::GetInterface1_0(),
-    true },
-  { PPB_CORE_INTERFACE, PluginCore::GetInterface(), true },
-  { PPB_MOUSECURSOR_INTERFACE_1_0, PluginMouseCursor::GetInterface(),
-    true },
-  { PPB_FILEIO_INTERFACE, PluginFileIO::GetInterface(), true },
-  { PPB_FILEREF_INTERFACE, PluginFileRef::GetInterface(), true },
-  { PPB_FILESYSTEM_INTERFACE, PluginFileSystem::GetInterface(), true },
-  { PPB_FIND_DEV_INTERFACE, PluginFind::GetInterface(), true },
-  { PPB_FONT_DEV_INTERFACE, PluginFont::GetInterface(), true },
-  { PPB_FULLSCREEN_INTERFACE, PluginFullscreen::GetInterface(), true },
-  { PPB_GAMEPAD_INTERFACE, PluginGamepad::GetInterface(), true },
-  { PPB_GRAPHICS_2D_INTERFACE, PluginGraphics2D::GetInterface(), true },
-  { PPB_GRAPHICS_3D_INTERFACE, PluginGraphics3D::GetInterface(), true },
-  { PPB_HOSTRESOLVER_PRIVATE_INTERFACE,
-    PluginHostResolverPrivate::GetInterface(), true },
-  { PPB_IMAGEDATA_INTERFACE, PluginImageData::GetInterface(), true },
-  { PPB_INPUT_EVENT_INTERFACE, PluginInputEvent::GetInterface(), true },
-  { PPB_INSTANCE_INTERFACE, PluginInstance::GetInterface(), true },
-  { PPB_KEYBOARD_INPUT_EVENT_INTERFACE,
-    PluginInputEvent::GetKeyboardInterface(), true },
-  { PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE,
-    PluginInputEvent::GetKeyboardInterface_Dev(), true },
-  { PPB_MEMORY_DEV_INTERFACE, PluginMemory::GetInterface(), true },
-  { PPB_MESSAGING_INTERFACE, PluginMessaging::GetInterface(), true },
-  { PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0,
-    PluginInputEvent::GetMouseInterface1_0(), true },
-  { PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1,
-    PluginInputEvent::GetMouseInterface1_1(), true },
-  { PPB_MOUSELOCK_INTERFACE, PluginMouseLock::GetInterface(), true },
-  { PPB_NETADDRESS_PRIVATE_INTERFACE_0_1,
-    PluginNetAddressPrivate::GetInterface0_1(), true },
-  { PPB_NETADDRESS_PRIVATE_INTERFACE_1_0,
-    PluginNetAddressPrivate::GetInterface1_0(), true },
-  { PPB_NETADDRESS_PRIVATE_INTERFACE_1_1,
-    PluginNetAddressPrivate::GetInterface1_1(), true },
-  { PPB_NETWORKLIST_PRIVATE_INTERFACE, PluginNetworkListPrivate::GetInterface(),
-    true },
-  { PPB_NETWORKMONITOR_PRIVATE_INTERFACE,
-    PluginNetworkMonitorPrivate::GetInterface(), true },
-  { PPB_OPENGLES2_INTERFACE_1_0, PluginGraphics3D::GetOpenGLESInterface(),
-    true },
-  { PPB_OPENGLES2_INSTANCEDARRAYS_INTERFACE_1_0,
-    PluginGraphics3D::GetOpenGLESInstancedArraysInterface(),
-    true },
-  { PPB_OPENGLES2_FRAMEBUFFERBLIT_INTERFACE_1_0,
-    PluginGraphics3D::GetOpenGLESFramebufferBlitInterface(),
-    true },
-  { PPB_OPENGLES2_FRAMEBUFFERMULTISAMPLE_INTERFACE_1_0,
-    PluginGraphics3D::GetOpenGLESFramebufferMultisampleInterface(),
-    true },
-  { PPB_OPENGLES2_CHROMIUMENABLEFEATURE_INTERFACE_1_0,
-    PluginGraphics3D::GetOpenGLESChromiumEnableFeatureInterface(),
-    true },
-  { PPB_OPENGLES2_CHROMIUMMAPSUB_INTERFACE_1_0,
-    PluginGraphics3D::GetOpenGLESChromiumMapSubInterface(),
-    true },
-  { PPB_OPENGLES2_QUERY_INTERFACE_1_0,
-    PluginGraphics3D::GetOpenGLESQueryInterface(),
-    true },
-  { PPB_TCPSERVERSOCKET_PRIVATE_INTERFACE,
-    PluginTCPServerSocketPrivate::GetInterface(),
-    true },
-  { PPB_TCPSOCKET_PRIVATE_INTERFACE_0_4,
-    PluginTCPSocketPrivate::GetInterface0_4(), true },
-  { PPB_TCPSOCKET_PRIVATE_INTERFACE_0_3,
-    PluginTCPSocketPrivate::GetInterface0_3(), true },
-  { PPB_TESTING_DEV_INTERFACE_0_9, PluginTesting::GetInterface(), true },
-  { PPB_TESTING_DEV_INTERFACE, PluginTesting::GetInterface(), true },
-  { PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2,
-    PluginUDPSocketPrivate::GetInterface0_2(), true },
-  { PPB_UDPSOCKET_PRIVATE_INTERFACE_0_3,
-    PluginUDPSocketPrivate::GetInterface0_3(), true },
-  { PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4,
-    PluginUDPSocketPrivate::GetInterface0_4(), true },
-  { PPB_URLLOADER_INTERFACE, PluginURLLoader::GetInterface(), true },
-  { PPB_URLREQUESTINFO_INTERFACE, PluginURLRequestInfo::GetInterface(), true },
-  { PPB_URLRESPONSEINFO_INTERFACE, PluginURLResponseInfo::GetInterface(),
-    true },
-  { PPB_VAR_ARRAY_BUFFER_INTERFACE, PluginVar::GetArrayBufferInterface(),
-    true },
-  { PPB_VAR_INTERFACE, PluginVar::GetInterface(), true },
-  { PPB_VAR_INTERFACE_1_0, PluginVar::GetInterface1_0(), true },
-  { PPB_VIEW_INTERFACE, PluginView::GetInterface(), true },
-  { PPB_WEBSOCKET_INTERFACE, PluginWebSocket::GetInterface(),
-    true },
-  { PPB_WHEEL_INPUT_EVENT_INTERFACE, PluginInputEvent::GetWheelInterface(),
-    true },
-  { PPB_ZOOM_DEV_INTERFACE, PluginZoom::GetInterface(), true },
-};
-
-}  // namespace
-
-// Returns the pointer to the interface proxy or NULL if not yet supported.
-// On the first invocation for a given interface that has proxy support,
-// also confirms over RPC that the browser indeed exports this interface.
-// Returns NULL otherwise.
-const void* GetBrowserInterface(const char* interface_name) {
-  DebugPrintf("PPB_GetInterface('%s')\n", interface_name);
-  const void* ppb_interface = NULL;
-  int index = -1;
-  // The interface map is so small that anything but a linear search would be an
-  // overkill, especially since the keys are macros and might not sort in any
-  // obvious order relative to the name.
-  for (size_t i = 0; i < NACL_ARRAY_SIZE(interface_map); ++i) {
-    if (strcmp(interface_name, interface_map[i].name) == 0) {
-      ppb_interface = interface_map[i].ppb_interface;
-      index = i;
-      break;
-    }
-  }
-  DebugPrintf("PPB_GetInterface('%s'): %p\n", interface_name, ppb_interface);
-  if (index == -1 || ppb_interface == NULL)
-    return NULL;
-  if (!interface_map[index].needs_browser_check)
-    return ppb_interface;
-
-  int32_t browser_exports_interface;
-  NaClSrpcError srpc_result =
-      PpbRpcClient::PPB_GetInterface(GetMainSrpcChannel(),
-                                     const_cast<char*>(interface_name),
-                                     &browser_exports_interface);
-  DebugPrintf("PPB_GetInterface('%s'): %s\n",
-              interface_name, NaClSrpcErrorString(srpc_result));
-  if (srpc_result != NACL_SRPC_RESULT_OK || !browser_exports_interface) {
-    interface_map[index].ppb_interface = NULL;
-    ppb_interface = NULL;
-  }
-  interface_map[index].needs_browser_check = false;
-  return ppb_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.cc
deleted file mode 100644
index d041b29..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.cc
+++ /dev/null
@@ -1,358 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_audio.h"
-
-#include <pthread.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/errno.h>
-#include <sys/mman.h>
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_audio_config.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "media/audio/shared_memory_util.h"
-#include "ppapi/c/ppb_audio.h"
-#include "ppapi/c/ppb_audio_config.h"
-#include "ppapi/cpp/module_impl.h"
-#include "srpcgen/ppb_rpc.h"
-#include "srpcgen/ppp_rpc.h"
-
-namespace ppapi_proxy {
-namespace {
-
-// Round size up to next 64k; required for NaCl's version of mmap().
-size_t ceil64k(size_t n) {
-  return (n + 0xFFFF) & (~0xFFFF);
-}
-
-// Hard coded values from PepperPlatformAudioOutputImpl.
-// TODO(dalecurtis): PPAPI shouldn't hard code these values for all clients.
-enum { kChannels = 2, kBytesPerSample = 2 };
-
-}  // namespace
-
-PluginAudio::PluginAudio() :
-    resource_(kInvalidResourceId),
-    socket_(-1),
-    shm_(-1),
-    shm_size_(0),
-    shm_buffer_(NULL),
-    state_(AUDIO_INCOMPLETE),
-    thread_id_(),
-    thread_active_(false),
-    user_callback_(NULL),
-    user_data_(NULL),
-    client_buffer_size_bytes_(0) {
-  DebugPrintf("PluginAudio::PluginAudio\n");
-}
-
-PluginAudio::~PluginAudio() {
-  DebugPrintf("PluginAudio::~PluginAudio\n");
-  // Ensure audio thread is not active.
-  if (resource_ != kInvalidResourceId)
-    GetInterface()->StopPlayback(resource_);
-  // Unmap the shared memory buffer, if present.
-  if (shm_buffer_) {
-    audio_bus_.reset();
-    client_buffer_.reset();
-    munmap(shm_buffer_,
-           ceil64k(media::TotalSharedMemorySizeInBytes(shm_size_)));
-    shm_buffer_ = NULL;
-    shm_size_ = 0;
-    client_buffer_size_bytes_ = 0;
-  }
-  // Close the handles.
-  if (shm_ != -1) {
-    close(shm_);
-    shm_ = -1;
-  }
-  if (socket_ != -1) {
-    close(socket_);
-    socket_ = -1;
-  }
-}
-
-bool PluginAudio::InitFromBrowserResource(PP_Resource resource) {
-  DebugPrintf("PluginAudio::InitFromBrowserResource: resource=%"NACL_PRId32"\n",
-              resource);
-  resource_ = resource;
-  return true;
-}
-
-void PluginAudio::AudioThread(void* self) {
-  PluginAudio* audio = static_cast<PluginAudio*>(self);
-  DebugPrintf("PluginAudio::AudioThread: self=%p\n", self);
-  const int bytes_per_frame =
-      sizeof(*(audio->audio_bus_->channel(0))) * audio->audio_bus_->channels();
-  while (true) {
-    int32_t sync_value;
-    // Block on socket read.
-    ssize_t r = read(audio->socket_, &sync_value, sizeof(sync_value));
-    // StopPlayback() will send a value of -1 over the sync_socket.
-    if ((sizeof(sync_value) != r) || (-1 == sync_value))
-      break;
-    // Invoke user callback, get next buffer of audio data.
-    audio->user_callback_(audio->client_buffer_.get(),
-                          audio->client_buffer_size_bytes_,
-                          audio->user_data_);
-
-    // Deinterleave the audio data into the shared memory as float.
-    audio->audio_bus_->FromInterleaved(
-        audio->client_buffer_.get(), audio->audio_bus_->frames(),
-        kBytesPerSample);
-
-    // Signal audio backend by writing buffer length at end of buffer.
-    // (Note: NaCl applications will always write the entire buffer.)
-    // TODO(dalecurtis): Technically this is not the exact size.  Due to channel
-    // padding for alignment, there may be more data available than this.  We're
-    // relying on AudioSyncReader::Read() to parse this with that in mind.
-    // Rename these methods to Set/GetActualFrameCount().
-    media::SetActualDataSizeInBytes(
-        audio->shm_buffer_, audio->shm_size_,
-        audio->audio_bus_->frames() * bytes_per_frame);
-  }
-}
-
-void PluginAudio::StreamCreated(NaClSrpcImcDescType socket,
-      NaClSrpcImcDescType shm, size_t shm_size) {
-  DebugPrintf("PluginAudio::StreamCreated: shm=%"NACL_PRIu32""
-              " shm_size=%"NACL_PRIuS"\n", shm, shm_size);
-  socket_ = socket;
-  shm_ = shm;
-  shm_size_ = shm_size;
-  shm_buffer_ = mmap(NULL,
-                     ceil64k(media::TotalSharedMemorySizeInBytes(shm_size)),
-                     PROT_READ | PROT_WRITE,
-                     MAP_SHARED,
-                     shm,
-                     0);
-  if (MAP_FAILED != shm_buffer_) {
-    PP_Resource ac = GetInterface()->GetCurrentConfig(resource_);
-    int frames = PluginAudioConfig::GetInterface()->GetSampleFrameCount(ac);
-
-    audio_bus_ = media::AudioBus::WrapMemory(kChannels, frames, shm_buffer_);
-    // Setup integer audio buffer for user audio data.
-    client_buffer_size_bytes_ =
-        audio_bus_->frames() * audio_bus_->channels() * kBytesPerSample;
-    client_buffer_.reset(new uint8_t[client_buffer_size_bytes_]);
-
-    if (state() == AUDIO_PENDING) {
-      StartAudioThread();
-    } else {
-      set_state(AUDIO_READY);
-    }
-  } else {
-    shm_buffer_ = NULL;
-  }
-}
-
-bool PluginAudio::StartAudioThread() {
-  // clear contents of shm buffer before spinning up audio thread
-  DebugPrintf("PluginAudio::StartAudioThread\n");
-  memset(shm_buffer_, 0, shm_size_);
-  memset(client_buffer_.get(), 0, client_buffer_size_bytes_);
-  const struct PP_ThreadFunctions* thread_funcs = GetThreadCreator();
-  if (NULL == thread_funcs->thread_create ||
-      NULL == thread_funcs->thread_join) {
-    return false;
-  }
-  int ret = thread_funcs->thread_create(&thread_id_, AudioThread, this);
-  if (0 == ret) {
-    thread_active_ = true;
-    set_state(AUDIO_PLAYING);
-    return true;
-  }
-  return false;
-}
-
-bool PluginAudio::StopAudioThread() {
-  DebugPrintf("PluginAudio::StopAudioThread\n");
-  if (thread_active_) {
-    int ret = GetThreadCreator()->thread_join(thread_id_);
-    if (0 == ret) {
-      thread_active_ = false;
-      set_state(AUDIO_READY);
-      return true;
-    }
-  }
-  return false;
-}
-
-// Start of untrusted PPB_Audio functions
-namespace {
-
-PP_Resource Create(PP_Instance instance,
-                   PP_Resource config,
-                   PPB_Audio_Callback user_callback,
-                   void* user_data) {
-  DebugPrintf("PPB_Audio::Create: instance=%"NACL_PRId32" config=%"NACL_PRId32
-              " user_callback=%p user_data=%p\n",
-              instance, config, user_callback, user_data);
-  if (NULL == user_callback) {
-    return kInvalidResourceId;
-  }
-  PP_Resource audio_resource;
-  // Proxy to browser Create, get audio PP_Resource
-  NaClSrpcError srpc_result = PpbAudioRpcClient::PPB_Audio_Create(
-      GetMainSrpcChannel(),
-      instance,
-      config,
-      &audio_resource);
-  DebugPrintf("PPB_Audio::Create: %s\n", NaClSrpcErrorString(srpc_result));
-  if (NACL_SRPC_RESULT_OK != srpc_result) {
-    return kInvalidResourceId;
-  }
-  if (kInvalidResourceId == audio_resource) {
-    return kInvalidResourceId;
-  }
-  scoped_refptr<PluginAudio> audio =
-      PluginResource::AdoptAs<PluginAudio>(audio_resource);
-  if (audio.get()) {
-    audio->set_callback(user_callback, user_data);
-    return audio_resource;
-  }
-  return kInvalidResourceId;
-}
-
-PP_Bool IsAudio(PP_Resource resource) {
-  int32_t success;
-  DebugPrintf("PPB_Audio::IsAudio: resource=%"NACL_PRId32"\n", resource);
-  NaClSrpcError srpc_result =
-      PpbAudioRpcClient::PPB_Audio_IsAudio(
-          GetMainSrpcChannel(),
-          resource,
-          &success);
-  DebugPrintf("PPB_Audio::IsAudio: %s\n", NaClSrpcErrorString(srpc_result));
-  if (NACL_SRPC_RESULT_OK != srpc_result) {
-    return PP_FALSE;
-  }
-  return PP_FromBool(success);
-}
-
-PP_Resource GetCurrentConfig(PP_Resource audio) {
-  DebugPrintf("PPB_Audio::GetCurrentConfig: audio=%"NACL_PRId32"\n", audio);
-  PP_Resource config_resource;
-  NaClSrpcError srpc_result =
-      PpbAudioRpcClient::PPB_Audio_GetCurrentConfig(
-          GetMainSrpcChannel(),
-          audio,
-          &config_resource);
-  DebugPrintf("PPB_Audio::GetCurrentConfig: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (NACL_SRPC_RESULT_OK != srpc_result) {
-    return kInvalidResourceId;
-  }
-  return config_resource;
-}
-
-PP_Bool StartPlayback(PP_Resource audio_resource) {
-  DebugPrintf("PPB_Audio::StartPlayback: audio_resource=%"NACL_PRId32"\n",
-              audio_resource);
-  scoped_refptr<PluginAudio> audio =
-      PluginResource::GetAs<PluginAudio>(audio_resource);
-  if (NULL == audio.get()) {
-    return PP_FALSE;
-  }
-  if (audio->state() == AUDIO_INCOMPLETE) {
-    audio->set_state(AUDIO_PENDING);
-  }
-  if (audio->state() == AUDIO_READY) {
-    if (!audio->StartAudioThread()) {
-      return PP_FALSE;
-    }
-  }
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbAudioRpcClient::PPB_Audio_StartPlayback(
-          GetMainSrpcChannel(),
-          audio_resource,
-          &success);
-  DebugPrintf("PPB_Audio::StartPlayback: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (NACL_SRPC_RESULT_OK != srpc_result || !success) {
-    return PP_FALSE;
-  }
-  return PP_TRUE;
-}
-
-PP_Bool StopPlayback(PP_Resource audio_resource) {
-  DebugPrintf("PPB_Audio::StopPlayback: audio_resource=%"NACL_PRId32"\n",
-              audio_resource);
-  scoped_refptr<PluginAudio> audio =
-      PluginResource::GetAs<PluginAudio>(audio_resource);
-  if (NULL == audio.get()) {
-    return PP_FALSE;
-  }
-  if (audio->state() == AUDIO_PENDING) {
-    // audio is pending to start, but StreamCreated() hasn't occurred yet...
-    audio->set_state(AUDIO_INCOMPLETE);
-  }
-  // RPC to trusted side
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbAudioRpcClient::PPB_Audio_StopPlayback(
-          GetMainSrpcChannel(),
-          audio_resource,
-          &success);
-  DebugPrintf("PPB_Audio::StopPlayback: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (NACL_SRPC_RESULT_OK != srpc_result) {
-    return PP_FALSE;
-  }
-  if (audio->state() != AUDIO_PLAYING) {
-    return PP_FromBool(success);
-  }
-  // stop and join the audio thread
-  return PP_FromBool(audio->StopAudioThread());
-}
-}  // namespace
-
-const PPB_Audio* PluginAudio::GetInterface() {
-  DebugPrintf("PluginAudio::GetInterface\n");
-  static const PPB_Audio audio_interface = {
-    Create,
-    IsAudio,
-    GetCurrentConfig,
-    StartPlayback,
-    StopPlayback,
-  };
-  return &audio_interface;
-}
-}  // namespace ppapi_proxy
-
-using ppapi_proxy::DebugPrintf;
-
-// PppAudioRpcServer::PPP_Audio_StreamCreated() must be in global
-// namespace.  This function receives handles for the socket and shared
-// memory, provided by the trusted audio implementation.
-void PppAudioRpcServer::PPP_Audio_StreamCreated(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource audio_resource,
-    NaClSrpcImcDescType shm,
-    int32_t shm_size,
-    NaClSrpcImcDescType sync_socket) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  DebugPrintf("PPP_Audio::StreamCreated: audio_resource=%"NACL_PRId32
-              " shm=%"NACL_PRIx32" shm_size=%"NACL_PRIuS
-              " sync_socket=%"NACL_PRIx32"\n",
-              audio_resource, shm, shm_size, sync_socket);
-  scoped_refptr<ppapi_proxy::PluginAudio> audio =
-      ppapi_proxy::PluginResource::
-      GetAs<ppapi_proxy::PluginAudio>(audio_resource);
-  if (NULL == audio.get()) {
-    // Ignore if no audio_resource -> audio_instance mapping exists,
-    // the app may have shutdown audio before StreamCreated() invoked.
-    rpc->result = NACL_SRPC_RESULT_OK;
-    return;
-  }
-  audio->StreamCreated(sync_socket, shm, shm_size);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.h
deleted file mode 100644
index 28713d0..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.h
+++ /dev/null
@@ -1,75 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_AUDIO_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_AUDIO_H_
-
-#include <pthread.h>
-#include "native_client/src/include/nacl_base.h"
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/include/ref_counted.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "media/base/audio_bus.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/ppb_audio.h"
-
-namespace ppapi_proxy {
-
-enum PluginAudioState {
-  AUDIO_INCOMPLETE = 0,  // StreamCreated not yet invoked
-  AUDIO_PENDING,         // Incomplete and app requested StartPlayback
-  AUDIO_READY,           // StreamCreated invoked, ready for playback
-  AUDIO_PLAYING          // Audio in playback
-};
-
-// Implements the untrusted side of the PPB_Audio interface.
-// All methods in PluginAudio class will be invoked on the main thread.
-// The only exception is AudioThread(), which will invoke the application
-// supplied callback to periodically obtain more audio data.
-class PluginAudio : public PluginResource {
- public:
-  PluginAudio();
-  void StreamCreated(NaClSrpcImcDescType socket,
-      NaClSrpcImcDescType shm, size_t shm_size);
-  void set_state(PluginAudioState state) { state_ = state; }
-  void set_callback(PPB_Audio_Callback user_callback, void* user_data) {
-      user_callback_ = user_callback;
-      user_data_ = user_data;
-  }
-  PluginAudioState state() { return state_; }
-  bool StartAudioThread();
-  bool StopAudioThread();
-  static void AudioThread(void* self);
-  static const PPB_Audio* GetInterface();
-  virtual bool InitFromBrowserResource(PP_Resource resource);
-
- protected:
-  virtual ~PluginAudio();
-
- private:
-  PP_Resource resource_;
-  NaClSrpcImcDescType socket_;
-  NaClSrpcImcDescType shm_;
-  size_t shm_size_;
-  void *shm_buffer_;
-  PluginAudioState state_;
-  uintptr_t thread_id_;
-  bool thread_active_;
-  PPB_Audio_Callback user_callback_;
-  void* user_data_;
-  // AudioBus for shuttling data across the shared memory.
-  scoped_ptr<media::AudioBus> audio_bus_;
-  // Internal buffer for client's integer audio data.
-  int client_buffer_size_bytes_;
-  scoped_array<uint8_t> client_buffer_;
-
-  IMPLEMENT_RESOURCE(PluginAudio);
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginAudio);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_AUDIO_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio_config.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio_config.cc
deleted file mode 100644
index 5fa5188..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio_config.cc
+++ /dev/null
@@ -1,171 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_audio_config.h"
-
-#include <stdio.h>
-#include <string.h>
-#include "srpcgen/ppb_rpc.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/ppb_audio_config.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_AudioSampleRate GetSampleRate(PP_Resource config) {
-  DebugPrintf("PPB_AudioConfig::GetSampleRate: config=%"NACL_PRId32"\n",
-              config);
-  int32_t sample_rate;
-  NaClSrpcError srpc_result =
-      PpbAudioConfigRpcClient::PPB_AudioConfig_GetSampleRate(
-          GetMainSrpcChannel(),
-          config,
-          &sample_rate);
-  DebugPrintf("PPB_AudioConfig::GetSampleRate: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (NACL_SRPC_RESULT_OK == srpc_result) {
-    return static_cast<PP_AudioSampleRate>(sample_rate);
-  }
-  return PP_AUDIOSAMPLERATE_NONE;
-}
-
-uint32_t GetSampleFrameCount(PP_Resource config) {
-  DebugPrintf("PPB_AudioConfig::GetSampleFrameCount: config=%"NACL_PRId32"\n",
-              config);
-  int32_t sample_frame_count;
-  NaClSrpcError srpc_result =
-      PpbAudioConfigRpcClient::PPB_AudioConfig_GetSampleFrameCount(
-          GetMainSrpcChannel(),
-          config,
-          &sample_frame_count);
-  DebugPrintf("PPB_AudioConfig::GetSampleFrameCount: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (NACL_SRPC_RESULT_OK == srpc_result) {
-    return static_cast<uint32_t>(sample_frame_count);
-  }
-  return 0;
-}
-
-uint32_t RecommendSampleFrameCount_1_0(PP_AudioSampleRate sample_rate,
-                                       uint32_t request_sample_frame_count) {
-  DebugPrintf("PPB_AudioConfig::RecommendSampleFrameCount_1_0");
-  int32_t out_sample_frame_count;
-  NaClSrpcError srpc_result =
-      PpbAudioConfigRpcClient::PPB_AudioConfig_RecommendSampleFrameCount_1_0(
-          GetMainSrpcChannel(),
-          static_cast<int32_t>(sample_rate),
-          static_cast<int32_t>(request_sample_frame_count),
-          &out_sample_frame_count);
-  DebugPrintf("PPB_AudioConfig::RecommendSampleFrameCount_1_0: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (NACL_SRPC_RESULT_OK == srpc_result) {
-    return static_cast<uint32_t>(out_sample_frame_count);
-  }
-  return 0;
-}
-
-uint32_t RecommendSampleFrameCount(PP_Instance instance,
-                                   PP_AudioSampleRate sample_rate,
-                                   uint32_t request_sample_frame_count) {
-  DebugPrintf("PPB_AudioConfig::RecommendSampleFrameCount");
-  int32_t out_sample_frame_count;
-  NaClSrpcError srpc_result =
-      PpbAudioConfigRpcClient::PPB_AudioConfig_RecommendSampleFrameCount(
-          GetMainSrpcChannel(),
-          instance,
-          static_cast<int32_t>(sample_rate),
-          static_cast<int32_t>(request_sample_frame_count),
-          &out_sample_frame_count);
-  DebugPrintf("PPB_AudioConfig::RecommendSampleFrameCount: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (NACL_SRPC_RESULT_OK == srpc_result) {
-    return static_cast<uint32_t>(out_sample_frame_count);
-  }
-  return 0;
-}
-
-PP_Bool IsAudioConfig(PP_Resource resource) {
-  DebugPrintf("PPB_AudioConfig::IsAudioConfig: resource=%"NACL_PRId32"\n",
-              resource);
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbAudioConfigRpcClient::PPB_AudioConfig_IsAudioConfig(
-          GetMainSrpcChannel(),
-          resource,
-          &success);
-  DebugPrintf("PPB_AudioConfig::IsAudioConfig: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (NACL_SRPC_RESULT_OK == srpc_result && success) {
-    return PP_TRUE;
-  }
-  return PP_FALSE;
-}
-
-PP_Resource CreateStereo16Bit(PP_Instance instance,
-                              PP_AudioSampleRate sample_rate,
-                              uint32_t sample_frame_count) {
-  DebugPrintf("PPB_AudioConfig::CreateStereo16Bit: instance=%"NACL_PRId32"\n",
-              instance);
-  PP_Resource resource;
-  NaClSrpcError srpc_result =
-      PpbAudioConfigRpcClient::PPB_AudioConfig_CreateStereo16Bit(
-          GetMainSrpcChannel(),
-          instance,
-          static_cast<int32_t>(sample_rate),
-          static_cast<int32_t>(sample_frame_count),
-          &resource);
-  DebugPrintf("PPB_AudioConfig::CreateStereo16Bit: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (NACL_SRPC_RESULT_OK == srpc_result) {
-    return resource;
-  }
-  return kInvalidResourceId;
-}
-
-PP_AudioSampleRate RecommendSampleRate(PP_Instance instance) {
-  DebugPrintf("PPB_AudioConfig::RecommendSampleRate");
-  int32_t out_sample_rate;
-  NaClSrpcError srpc_result =
-      PpbAudioConfigRpcClient::PPB_AudioConfig_RecommendSampleRate(
-          GetMainSrpcChannel(),
-          instance,
-          &out_sample_rate);
-  DebugPrintf("PPB_AudioConfig::RecommendSampleRate: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (NACL_SRPC_RESULT_OK == srpc_result) {
-    return static_cast<PP_AudioSampleRate>(out_sample_rate);
-  }
-  return PP_AUDIOSAMPLERATE_NONE;
-}
-
-}  // namespace
-
-const PPB_AudioConfig* PluginAudioConfig::GetInterface() {
-  static const PPB_AudioConfig audio_config_interface = {
-    CreateStereo16Bit,
-    RecommendSampleFrameCount,
-    IsAudioConfig,
-    GetSampleRate,
-    GetSampleFrameCount,
-    RecommendSampleRate
-  };
-  return &audio_config_interface;
-}
-
-const PPB_AudioConfig_1_0* PluginAudioConfig::GetInterface1_0() {
-  static const PPB_AudioConfig_1_0 audio_config_interface = {
-    CreateStereo16Bit,
-    RecommendSampleFrameCount_1_0,
-    IsAudioConfig,
-    GetSampleRate,
-    GetSampleFrameCount
-  };
-  return &audio_config_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio_config.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio_config.h
deleted file mode 100644
index 5f9af58..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio_config.h
+++ /dev/null
@@ -1,30 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_AUDIO_CONFIG_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_AUDIO_CONFIG_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "ppapi/c/ppb_audio_config.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_AudioConfig interface.
-class PluginAudioConfig : public PluginResource {
- public:
-  static const PPB_AudioConfig* GetInterface();
-  // Returns the 1.0 interface to support backwards-compatibility.
-  static const PPB_AudioConfig_1_0* GetInterface1_0();
-
- protected:
-  virtual ~PluginAudioConfig() {}
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginAudioConfig);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_AUDIO_CONFIG_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_buffer.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_buffer.cc
deleted file mode 100644
index 67c91f2..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_buffer.cc
+++ /dev/null
@@ -1,56 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_buffer.h"
-
-#include <stdio.h>
-#include <string.h>
-#include "srpcgen/ppb_rpc.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/dev/ppb_buffer_dev.h"
-
-namespace ppapi_proxy {
-
-namespace {
-PP_Resource Create(PP_Module module, uint32_t size_in_bytes) {
-  UNREFERENCED_PARAMETER(module);
-  UNREFERENCED_PARAMETER(size_in_bytes);
-  return kInvalidResourceId;
-}
-
-PP_Bool IsBuffer(PP_Resource resource) {
-  return PP_FromBool(PluginResource::GetAs<PluginBuffer>(resource).get());
-}
-
-PP_Bool Describe(PP_Resource resource, uint32_t* size_in_bytes) {
-  UNREFERENCED_PARAMETER(resource);
-  UNREFERENCED_PARAMETER(size_in_bytes);
-  return PP_FALSE;
-}
-
-void* Map(PP_Resource resource) {
-  UNREFERENCED_PARAMETER(resource);
-  return NULL;
-}
-
-void Unmap(PP_Resource resource) {
-  UNREFERENCED_PARAMETER(resource);
-}
-}  // namespace
-
-const PPB_Buffer_Dev* PluginBuffer::GetInterface() {
-  static const PPB_Buffer_Dev buffer_interface = {
-    Create,
-    IsBuffer,
-    Describe,
-    Map,
-    Unmap,
-  };
-  return &buffer_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_buffer.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_buffer.h
deleted file mode 100644
index b0fce42..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_buffer.h
+++ /dev/null
@@ -1,29 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_BUFFER_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_BUFFER_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "ppapi/c/dev/ppb_buffer_dev.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_Buffer interface.
-class PluginBuffer : public PluginResource {
- public:
-  static const PPB_Buffer_Dev* GetInterface();
-
- protected:
-  virtual ~PluginBuffer() {}
-
- private:
-  IMPLEMENT_RESOURCE(PluginBuffer);
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginBuffer);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_BUFFER_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_core.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_core.cc
deleted file mode 100644
index c86cbb3..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_core.cc
+++ /dev/null
@@ -1,146 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_core.h"
-#include <stdio.h>
-#include <map>
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource_tracker.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_upcall.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/ppb_core.h"
-#include "srpcgen/ppb_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::GetMainSrpcChannel;
-
-// All of the methods here are invoked from the plugin's main (UI) thread,
-// so no locking is done.
-
-namespace {
-
-__thread bool is_main_thread = false;
-bool main_thread_marked = false;
-
-// Increment the reference count for a specified resource.  This only takes
-// care of the plugin's reference count - the Resource should obtain the
-// browser reference when it stores the browser's Resource id. When the
-// Resource's reference count goes to zero, the destructor should make sure
-// the browser reference is returned.
-void AddRefResource(PP_Resource resource) {
-  DebugPrintf("PPB_Core::AddRefResource: resource=%"NACL_PRId32"\n",
-              resource);
-  if (!ppapi_proxy::PluginResourceTracker::Get()->AddRefResource(resource)) {
-    DebugPrintf("PPB_Core::AddRefResource: not tracked locally\n");
-    NaClSrpcError srpc_result = PpbCoreRpcClient::PPB_Core_AddRefResource(
-        GetMainSrpcChannel(), resource);
-    DebugPrintf("PPB_Core::AddRefResource: %s\n",
-                NaClSrpcErrorString(srpc_result));
-
-  }
-}
-
-void ReleaseResource(PP_Resource resource) {
-  DebugPrintf("PPB_Core::ReleaseResource: resource=%"NACL_PRId32"\n",
-              resource);
-  if (!ppapi_proxy::PluginResourceTracker::Get()->UnrefResource(resource)) {
-    DebugPrintf("PPB_Core::ReleaseResource: not tracked locally\n");
-    NaClSrpcError srpc_result = PpbCoreRpcClient::PPB_Core_ReleaseResource(
-        GetMainSrpcChannel(), resource);
-    DebugPrintf("PPB_Core::ReleaseResource: %s\n",
-                NaClSrpcErrorString(srpc_result));
-  }
-}
-
-PP_TimeTicks GetTime() {
-  DebugPrintf("PPB_Core::GetTime\n");
-  double time;
-  NaClSrpcError srpc_result = PpbCoreRpcClient::PPB_Core_GetTime(
-      GetMainSrpcChannel(), &time);
-  DebugPrintf("PPB_Core::GetTime: %s\n", NaClSrpcErrorString(srpc_result));
-  if (srpc_result != NACL_SRPC_RESULT_OK) {
-    return static_cast<PP_Time>(-1.0);
-  } else {
-    return static_cast<PP_Time>(time);
-  }
-}
-
-PP_TimeTicks GetTimeTicks() {
-  DebugPrintf("PPB_Core::GetTimeTicks\n");
-  double time_ticks;
-  NaClSrpcError srpc_result = PpbCoreRpcClient::PPB_Core_GetTimeTicks(
-      GetMainSrpcChannel(), &time_ticks);
-  DebugPrintf("PPB_Core::GetTimeTicks: %s\n", NaClSrpcErrorString(srpc_result));
-  if (srpc_result != NACL_SRPC_RESULT_OK) {
-    return static_cast<PP_TimeTicks>(-1.0);
-  } else {
-    return static_cast<PP_TimeTicks>(time_ticks);
-  }
-}
-
-PP_Bool IsMainThread() {
-  DebugPrintf("PPB_Core::IsMainThread\n");
-  return PP_FromBool(is_main_thread);
-}
-
-void CallOnMainThread(int32_t delay_in_milliseconds,
-                      PP_CompletionCallback callback,
-                      int32_t result) {
-  if (!IsMainThread()) {
-    ppapi_proxy::PluginUpcallCoreCallOnMainThread(
-        delay_in_milliseconds, callback, result);
-    return;
-  }
-
-  int32_t callback_id =
-      ppapi_proxy::CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)
-    return;
-
-  NaClSrpcError srpc_result =
-      PpbCoreRpcClient::PPB_Core_CallOnMainThread(
-          ppapi_proxy::GetMainSrpcChannel(),
-          delay_in_milliseconds,
-          callback_id,
-          result);
-  DebugPrintf("PPB_Core::CallOnMainThread: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-}  // namespace
-
-namespace ppapi_proxy {
-
-const PPB_Core* PluginCore::GetInterface() {
-  static const PPB_Core core_interface = {
-    AddRefResource,
-    ReleaseResource,
-    GetTime,
-    GetTimeTicks,
-    CallOnMainThread,
-    IsMainThread
-  };
-  return &core_interface;
-}
-
-void PluginCore::MarkMainThread() {
-  if (main_thread_marked) {
-    // A main thread was already designated.  Fail.
-    NACL_NOTREACHED();
-  } else {
-    is_main_thread = true;
-    // Setting this once works because the main thread will call this function
-    // before calling any pthread_creates.  Hence the result is already
-    // published before other threads might attempt to call it.
-    main_thread_marked = true;
-  }
-}
-
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_core.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_core.h
deleted file mode 100644
index c3f1a19..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_core.h
+++ /dev/null
@@ -1,29 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppb_core.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_Core interface.
-// We will also need an rpc service to implement the trusted side, which is a
-// very thin wrapper around the PPB_Core interface returned from the browser.
-class PluginCore {
- public:
-  // Return an interface pointer usable by PPAPI plugins.
-  static const PPB_Core* GetInterface();
-  // Mark the calling thread as the main thread for IsMainThread.
-  static void MarkMainThread();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginCore);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.cc
deleted file mode 100644
index 1cdfe7a..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.cc
+++ /dev/null
@@ -1,303 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.h"
-
-#include <string.h>
-#include <cmath>
-
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_file_info.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_file_io.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Resource Create(PP_Instance instance) {
-  DebugPrintf("PPB_FileIO::Create: instance=%"NACL_PRId32"\n", instance);
-  PP_Resource resource = kInvalidResourceId;
-  NaClSrpcError srpc_result =
-      PpbFileIORpcClient::PPB_FileIO_Create(
-          GetMainSrpcChannel(),
-          instance,
-          &resource);
-
-  DebugPrintf("PPB_FileIO::Create: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return resource;
-  return kInvalidResourceId;
-}
-
-PP_Bool IsFileIO(PP_Resource resource) {
-  DebugPrintf("PPB_FileIO::IsFileIO: resource=%"NACL_PRId32"\n", resource);
-
-  int32_t is_fileio = 0;
-  NaClSrpcError srpc_result =
-      PpbFileIORpcClient::PPB_FileIO_IsFileIO(
-          GetMainSrpcChannel(),
-          resource,
-          &is_fileio);
-
-  DebugPrintf("PPB_FileIO::IsFileIO: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && is_fileio)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-int32_t Open(PP_Resource file_io,
-             PP_Resource file_ref,
-             int32_t open_flags,
-             struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_FileIO::Open: file_io=%"NACL_PRId32", "
-              "file_ref=%"NACL_PRId32", open_flags=%"NACL_PRId32"\n", file_io,
-              file_ref, open_flags);
-
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error;
-  NaClSrpcError srpc_result =
-      PpbFileIORpcClient::PPB_FileIO_Open(
-          GetMainSrpcChannel(),
-          file_io,
-          file_ref,
-          open_flags,
-          callback_id,
-          &pp_error);
-
-  DebugPrintf("PPB_FileIO::Open: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-int32_t Query(PP_Resource file_io,
-              PP_FileInfo* info,
-              struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_FileIO::Query: file_io=%"NACL_PRId32"\n", file_io);
-  if (callback.func == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(
-      callback, reinterpret_cast<char*>(info));
-
-  nacl_abi_size_t info_size = 0;
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result =
-      PpbFileIORpcClient::PPB_FileIO_Query(
-          GetMainSrpcChannel(),
-          file_io,
-          sizeof(PP_FileInfo),
-          callback_id,
-          &info_size,
-          reinterpret_cast<char*>(info),
-          &pp_error);
-
-  DebugPrintf("PPB_FileIO::Query: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-int32_t Touch(PP_Resource file_io,
-              PP_Time last_access_time,
-              PP_Time last_modified_time,
-              struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_FileIO::Touch: file_io=%"NACL_PRId32", "
-              "last_access_time=%ls, last_modified_time=%lf\n", file_io,
-              last_access_time, last_modified_time);
-
-  if (std::isnan(last_access_time) ||
-      std::isnan(last_modified_time)) {
-    return PP_ERROR_BADARGUMENT;
-  }
-
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result = PpbFileIORpcClient::PPB_FileIO_Touch(
-       GetMainSrpcChannel(),
-       file_io,
-       last_access_time,
-       last_modified_time,
-       callback_id,
-       &pp_error);
-
-  DebugPrintf("PPB_FileIO::Touch: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-int32_t Read(PP_Resource file_io,
-             int64_t offset,
-             char* buffer,
-             int32_t bytes_to_read,
-             struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_FileIO::Read: file_io=%"NACL_PRId32", "
-              "offset=%"NACL_PRId64", bytes_to_read=%"NACL_PRId32"\n", file_io,
-              offset, bytes_to_read);
-
-  if (bytes_to_read < 0)
-    return PP_ERROR_FAILED;
-  nacl_abi_size_t buffer_size = static_cast<nacl_abi_size_t>(bytes_to_read);
-
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback, buffer);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error_or_bytes;
-  NaClSrpcError srpc_result =
-      PpbFileIORpcClient::PPB_FileIO_Read(
-          GetMainSrpcChannel(),
-          file_io,
-          offset,
-          bytes_to_read,
-          callback_id,
-          &buffer_size,
-          buffer,
-          &pp_error_or_bytes);
-
-  DebugPrintf("PPB_FileIO::Read: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error_or_bytes = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error_or_bytes);
-}
-
-int32_t Write(PP_Resource file_io,
-              int64_t offset,
-              const char* buffer,
-              int32_t bytes_to_write,
-              struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_FileIO::Write: file_io=%"NACL_PRId32", offset="
-              "%"NACL_PRId64", bytes_to_write=%"NACL_PRId32"\n", file_io,
-              offset, bytes_to_write);
-
-  if (bytes_to_write < 0)
-    return PP_ERROR_FAILED;
-  nacl_abi_size_t buffer_size = static_cast<nacl_abi_size_t>(bytes_to_write);
-
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error_or_bytes = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result = PpbFileIORpcClient::PPB_FileIO_Write(
-      GetMainSrpcChannel(),
-      file_io,
-      offset,
-      buffer_size,
-      const_cast<char*>(buffer),
-      bytes_to_write,
-      callback_id,
-      &pp_error_or_bytes);
-
-  DebugPrintf("PPB_FileIO::Write: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error_or_bytes = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error_or_bytes);
-}
-
-int32_t SetLength(PP_Resource file_io,
-                  int64_t length,
-                  struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_FileIO::SetLength: file_io=%"NACL_PRId32", length="
-              "%"NACL_PRId64"\n", file_io, length);
-
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result = PpbFileIORpcClient::PPB_FileIO_SetLength(
-      GetMainSrpcChannel(),
-      file_io,
-      length,
-      callback_id,
-      &pp_error);
-
-  DebugPrintf("PPB_FileIO::SetLength: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-int32_t Flush(PP_Resource file_io,
-              struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_FileIO::Flush: file_io=%"NACL_PRId32"\n", file_io);
-
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result = PpbFileIORpcClient::PPB_FileIO_Flush(
-      GetMainSrpcChannel(),
-      file_io,
-      callback_id,
-      &pp_error);
-
-  DebugPrintf("PPB_FileIO::Flush: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-void Close(PP_Resource file_io) {
-  DebugPrintf("PPB_FileIO::Close: file_io=%"NACL_PRId32"\n", file_io);
-
-  NaClSrpcError srpc_result = PpbFileIORpcClient::PPB_FileIO_Close(
-      GetMainSrpcChannel(),
-      file_io);
-
-  DebugPrintf("PPB_FileIO::Close: %s\n", NaClSrpcErrorString(srpc_result));
-}
-
-}  // namespace
-
-const PPB_FileIO* PluginFileIO::GetInterface() {
-  static const PPB_FileIO file_io_interface = {
-    Create,
-    IsFileIO,
-    Open,
-    Query,
-    Touch,
-    Read,
-    Write,
-    SetLength,
-    Flush,
-    Close
-  };
-  return &file_io_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.h
deleted file mode 100644
index e80a24f..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_FILE_IO_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_FILE_IO_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppb_file_io.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_FileIO interface.
-class PluginFileIO {
- public:
-  static const PPB_FileIO* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginFileIO);
-};
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_FILE_IO_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_ref.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_ref.cc
deleted file mode 100644
index 72e36ab..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_ref.cc
+++ /dev/null
@@ -1,252 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_file_ref.h"
-
-#include <string.h>
-#include <cmath>
-#include <string>
-
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-bool IsDirectoryTraversal(const std::string& path) {
-  bool is_directory_traversal = true;
-  // TODO(sanga): Do we need to guard against percent encoded strings as well?
-  if (path.find("../") == std::string::npos)
-    is_directory_traversal = false;
-  return is_directory_traversal;
-}
-
-PP_Resource Create(PP_Resource file_system,
-                   const char* path) {
-  DebugPrintf("PPB_FileRef::Create: file_system=%"NACL_PRId32", path=%s\n",
-              file_system, path);
-
-  PP_Resource resource = kInvalidResourceId;
-
-  if (IsDirectoryTraversal(path))
-    return kInvalidResourceId;
-
-  NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_Create(
-      GetMainSrpcChannel(),
-      file_system,
-      strlen(path) + 1,  // Add 1 to preserve terminating '\0'
-      const_cast<char*>(path),
-      &resource);
-  DebugPrintf("PPB_FileRef::Create: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return resource;
-  return kInvalidResourceId;
-}
-
-PP_Bool IsFileRef(PP_Resource file_ref) {
-  DebugPrintf("PPB_FileRef::IsFileRef: file_ref=%"NACL_PRId32"\n", file_ref);
-
-  int32_t is_file_ref = 0;
-  NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_IsFileRef(
-      GetMainSrpcChannel(),
-      file_ref,
-      &is_file_ref);
-  DebugPrintf("PPB_FileRef::IsFileRef: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if ((srpc_result == NACL_SRPC_RESULT_OK) && is_file_ref)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-PP_FileSystemType GetFileSystemType(PP_Resource file_ref) {
-  DebugPrintf("PPB_FileRef::GetFileSystemType: file_ref=%"NACL_PRId32"\n",
-              file_ref);
-
-  int32_t file_system_type = PP_FILESYSTEMTYPE_INVALID;
-  NaClSrpcError srpc_result =
-      PpbFileRefRpcClient::PPB_FileRef_GetFileSystemType(
-          GetMainSrpcChannel(),
-          file_ref,
-          &file_system_type);
-  DebugPrintf("PPB_FileRef::GetFileSystemType: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return static_cast<PP_FileSystemType>(file_system_type);
-  return PP_FILESYSTEMTYPE_INVALID;
-}
-
-PP_Var GetName(PP_Resource file_ref) {
-  DebugPrintf("PPB_FileRef::GetName: file_ref=%"NACL_PRId32"\n", file_ref);
-
-  PP_Var name = PP_MakeUndefined();
-  nacl_abi_size_t length = kMaxReturnVarSize;
-  nacl::scoped_array<char> name_bytes(new char[length]);
-  NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_GetName(
-      GetMainSrpcChannel(),
-      file_ref,
-      &length,
-      name_bytes.get());
-  DebugPrintf("PPB_FileRef::GetName: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK) {
-    if (DeserializeTo(name_bytes.get(), length, 1 /* argc */, &name))
-      return name;
-  }
-  return PP_MakeUndefined();
-}
-
-PP_Var GetPath(PP_Resource file_ref) {
-  DebugPrintf("PPB_FileRef::GetPath: file_ref=%"NACL_PRId32"\n", file_ref);
-
-  PP_Var path = PP_MakeUndefined();
-  nacl_abi_size_t length = kMaxReturnVarSize;
-  nacl::scoped_array<char> path_bytes(new char[length]);
-  NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_GetPath(
-      GetMainSrpcChannel(),
-      file_ref,
-      &length,
-      path_bytes.get());
-  DebugPrintf("PPB_FileRef::GetPath: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK &&
-      DeserializeTo(path_bytes.get(), length, 1 /* argc */, &path)) {
-    return path;
-  }
-  return PP_MakeUndefined();
-}
-
-PP_Resource GetParent(PP_Resource file_ref) {
-  DebugPrintf("PPB_FileRef::GetParent: file_ref=%"NACL_PRId32"\n", file_ref);
-
-  PP_Resource parent = kInvalidResourceId;
-  NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_GetParent(
-      GetMainSrpcChannel(),
-      file_ref,
-      &parent);
-  DebugPrintf("PPB_FileRef::GetParent: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return parent;
-  return kInvalidResourceId;
-}
-
-int32_t MakeDirectory(PP_Resource directory_ref,
-                      PP_Bool make_ancestors,
-                      struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_FileRef::MakeDirectory: directory_ref=%"NACL_PRId32", "
-              "make_ancestors=%s\n", directory_ref,
-              (make_ancestors ? "true" : "false"));
-
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_MakeDirectory(
-      GetMainSrpcChannel(),
-      directory_ref,
-      make_ancestors,
-      callback_id,
-      &pp_error);
-  DebugPrintf("PPB_FileRef::MakeDirectory: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return MayForceCallback(callback, pp_error);
-  return PP_ERROR_FAILED;
-}
-
-int32_t Touch(PP_Resource file_ref,
-              PP_Time last_access_time,
-              PP_Time last_modified_time,
-              struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_FileRef::Touch: file_ref=%"NACL_PRId32", "
-              "last_access_time=%lf, last_modified_time=%lf\n",
-              file_ref, last_access_time, last_modified_time);
-
-  if (std::isnan(last_access_time) ||
-      std::isnan(last_modified_time)) {
-    return PP_ERROR_FAILED;
-  }
-
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_Touch(
-      GetMainSrpcChannel(),
-      file_ref,
-      last_access_time,
-      last_modified_time,
-      callback_id,
-      &pp_error);
-  DebugPrintf("PPB_FileRef::Touch: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return MayForceCallback(callback, pp_error);
-  return PP_ERROR_FAILED;
-}
-
-int32_t Delete(PP_Resource file_ref,
-               struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_FileRef::Delete: file_ref=%"NACL_PRId32"\n", file_ref);
-
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_Delete(
-      GetMainSrpcChannel(),
-      file_ref,
-      callback_id,
-      &pp_error);
-  DebugPrintf("PPB_FileRef::Delete: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return MayForceCallback(callback, pp_error);
-  return PP_ERROR_FAILED;
-}
-
-int32_t Rename(PP_Resource file_ref,
-               PP_Resource new_file_ref,
-               struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_FileRef::Rename: file_ref=%"NACL_PRId32", "
-              "new_file_ref=%"NACL_PRId32"\n", file_ref, new_file_ref);
-
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_Rename(
-      GetMainSrpcChannel(),
-      file_ref,
-      new_file_ref,
-      callback_id,
-      &pp_error);
-  DebugPrintf("PPB_FileRef::Rename: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return MayForceCallback(callback, pp_error);
-  return PP_ERROR_FAILED;
-}
-}  // namespace
-
-const PPB_FileRef* PluginFileRef::GetInterface() {
-  static const PPB_FileRef file_ref_interface = {
-    Create,
-    IsFileRef,
-    GetFileSystemType,
-    GetName,
-    GetPath,
-    GetParent,
-    MakeDirectory,
-    Touch,
-    Delete,
-    Rename
-  };
-  return &file_ref_interface;
-}
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_ref.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_ref.h
deleted file mode 100644
index cf11733..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_ref.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_FILE_REF_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_FILE_REF_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppb_file_ref.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_FileRef interface.
-class PluginFileRef {
- public:
-  static const PPB_FileRef* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginFileRef);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_FILE_REF_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.cc
deleted file mode 100644
index 975eeb3..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.cc
+++ /dev/null
@@ -1,105 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.h"
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Resource Create(PP_Instance instance, PP_FileSystemType type) {
-  DebugPrintf("PPB_FileSystem::Create: instance=%"NACL_PRId32" "
-              "type=%"NACL_PRIu32"\n",
-              instance, type);
-  PP_Resource pp_resource = kInvalidResourceId;
-  NaClSrpcError srpc_result =
-      PpbFileSystemRpcClient::PPB_FileSystem_Create(
-          GetMainSrpcChannel(),
-          instance,
-          type,
-          &pp_resource);
-  DebugPrintf("PPB_FileSystem::Create: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return pp_resource;
-  return kInvalidResourceId;
-}
-
-PP_Bool IsFileSystem(PP_Resource resource) {
-  DebugPrintf("PPB_FileSystem::IsFileSystem: resource=%"NACL_PRId32"\n",
-              resource);
-  int32_t is_file_system = 0;
-  NaClSrpcError srpc_result =
-      PpbFileSystemRpcClient::PPB_FileSystem_IsFileSystem(
-          GetMainSrpcChannel(),
-          resource,
-          &is_file_system);
-  DebugPrintf("PPB_FileSystem::IsFileSystem: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (NACL_SRPC_RESULT_OK != srpc_result) {
-    return PP_FALSE;
-  }
-  return PP_FromBool(is_file_system);
-}
-
-int32_t Open(PP_Resource file_system,
-             int64_t expected_size,
-             struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_FileSystem::Open: file_system=%"NACL_PRId32"\n",
-              file_system);
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error;
-  NaClSrpcError srpc_result =
-      PpbFileSystemRpcClient::PPB_FileSystem_Open(
-          GetMainSrpcChannel(),
-          file_system,
-          expected_size,
-          callback_id,
-          &pp_error);
-  DebugPrintf("PPB_FileSystem::Open: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-PP_FileSystemType GetType(PP_Resource file_system) {
-  DebugPrintf("PPB_FileSystem::GetType: file_system=%"NACL_PRId32"\n",
-              file_system);
-  int32_t type = PP_FILESYSTEMTYPE_INVALID;
-  NaClSrpcError srpc_result =
-      PpbFileSystemRpcClient::PPB_FileSystem_GetType(
-          GetMainSrpcChannel(),
-          file_system,
-          &type);
-  DebugPrintf("PPB_FileSystem::GetType: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return static_cast<PP_FileSystemType>(type);
-  return PP_FILESYSTEMTYPE_INVALID;
-}
-
-}  // namespace
-
-const PPB_FileSystem* PluginFileSystem::GetInterface() {
-  static const PPB_FileSystem file_system_interface = {
-    Create,
-    IsFileSystem,
-    Open,
-    GetType
-  };
-  return &file_system_interface;
-}
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.h
deleted file mode 100644
index 2c5fb70..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_FILE_SYSTEM_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_FILE_SYSTEM_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppb_file_system.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_FileSystem interface.
-class PluginFileSystem {
- public:
-  static const PPB_FileSystem* GetInterface();
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginFileSystem);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_FILE_SYSTEM_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_find.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_find.cc
deleted file mode 100644
index 26faad3..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_find.cc
+++ /dev/null
@@ -1,62 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_find.h"
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/dev/ppb_find_dev.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-void NumberOfFindResultsChanged(PP_Instance instance,
-                                int32_t total,
-                                PP_Bool final_result) {
-  DebugPrintf("PPB_Find::NumberOfFindResultsChanged: "
-              "instance=%"NACL_PRId32"\n", instance);
-
-  NaClSrpcError srpc_result =
-      PpbFindRpcClient::PPB_Find_NumberOfFindResultsChanged(
-          GetMainSrpcChannel(),
-          instance,
-          total,
-          PP_ToBool(final_result));
-
-  DebugPrintf("PPB_Find::NumberOfFindResultsChanged: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-void SelectedFindResultChanged(PP_Instance instance,
-                               int32_t index) {
-  DebugPrintf("PPB_Find::SelectedFindResultChanged: "
-              "instance=%"NACL_PRId32"\n", instance);
-
-  NaClSrpcError srpc_result =
-      PpbFindRpcClient::PPB_Find_SelectedFindResultChanged(
-          GetMainSrpcChannel(),
-          instance,
-          index);
-
-  DebugPrintf("PPB_Find::SelectedFindResultChanged: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-}  // namespace
-
-const PPB_Find_Dev* PluginFind::GetInterface() {
-  static const PPB_Find_Dev find_interface = {
-    NumberOfFindResultsChanged,
-    SelectedFindResultChanged
-  };
-  return &find_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_find.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_find.h
deleted file mode 100644
index d83dad6..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_find.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_FIND_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_FIND_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/dev/ppb_find_dev.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_Find_Dev interface.
-class PluginFind {
- public:
-  PluginFind();
-  static const PPB_Find_Dev* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginFind);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_FIND_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_font.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_font.cc
deleted file mode 100644
index 7fc2a11..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_font.cc
+++ /dev/null
@@ -1,267 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_font.h"
-
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/dev/ppb_font_dev.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_point.h"
-#include "ppapi/c/pp_rect.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-const nacl_abi_size_t kPPPointBytes =
-    static_cast<nacl_abi_size_t>(sizeof(struct PP_Point));
-const nacl_abi_size_t kPPRectBytes =
-    static_cast<nacl_abi_size_t>(sizeof(struct PP_Rect));
-const nacl_abi_size_t kPPTextRunBytes =
-    static_cast<nacl_abi_size_t>(sizeof(struct PP_TextRun_Dev));
-const nacl_abi_size_t kPPFontMetricsBytes =
-    static_cast<nacl_abi_size_t>(sizeof(struct PP_FontMetrics_Dev));
-const nacl_abi_size_t kPPFontDescriptionBytes =
-    static_cast<nacl_abi_size_t>(sizeof(struct PP_FontDescription_Dev));
-const int32_t kInvalidOffset = -1;
-
-PP_Var GetFontFamilies(PP_Instance instance) {
-  DebugPrintf("PPB_Font::GetFontFamilies: instance=%"NACL_PRId32"\n",
-              instance);
-  NaClSrpcChannel* channel = GetMainSrpcChannel();
-
-  PP_Var font_families = PP_MakeUndefined();
-  nacl_abi_size_t var_size = kMaxReturnVarSize;
-  nacl::scoped_array<char> var_bytes(new char[var_size]);
-
-  NaClSrpcError srpc_result =
-      PpbFontRpcClient::PPB_Font_GetFontFamilies(
-          channel,
-          instance,
-          &var_size,
-          var_bytes.get());
-
-  DebugPrintf("PPB_Font::GetFontFamilies: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    (void) DeserializeTo(var_bytes.get(), var_size, 1, &font_families);
-  return font_families;
-}
-
-PP_Resource Create(PP_Instance instance,
-                   const struct PP_FontDescription_Dev* description) {
-  DebugPrintf("PPB_Font::Create: instance=%"NACL_PRId32"\n", instance);
-
-  nacl_abi_size_t face_size = 0;
-  nacl::scoped_array<char> face_bytes(
-      Serialize(&description->face, 1, &face_size));
-
-  PP_Resource resource = kInvalidResourceId;
-  NaClSrpcError srpc_result =
-      PpbFontRpcClient::PPB_Font_Create(
-          GetMainSrpcChannel(),
-          instance,
-          kPPFontDescriptionBytes,
-          reinterpret_cast<char*>(
-              const_cast<struct PP_FontDescription_Dev*>(description)),
-          face_size,
-          face_bytes.get(),
-          &resource);
-
-  DebugPrintf("PPB_Font::Create: %s\n", NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_OK) {
-    scoped_refptr<PluginFont> font =
-        PluginResource::AdoptAs<PluginFont>(resource);
-    if (font.get())
-      return resource;
-  }
-  return kInvalidResourceId;
-}
-
-PP_Bool IsFont(PP_Resource resource) {
-  DebugPrintf("PPB_Font::IsFont: resource=%"NACL_PRId32"\n", resource);
-
-  int32_t is_font = 0;
-  NaClSrpcError srpc_result =
-      PpbFontRpcClient::PPB_Font_IsFont(GetMainSrpcChannel(),
-                                        resource,
-                                        &is_font);
-
-  DebugPrintf("PPB_Font::IsFont: %s\n", NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_OK && is_font)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-PP_Bool Describe(PP_Resource font,
-                 struct PP_FontDescription_Dev* description,
-                 struct PP_FontMetrics_Dev* metrics) {
-  DebugPrintf("PPB_Font::Describe: font=%"NACL_PRId32"\n", font);
-  NaClSrpcChannel* channel = GetMainSrpcChannel();
-
-  int32_t success = 0;
-  nacl_abi_size_t description_size = kPPFontDescriptionBytes;
-  nacl_abi_size_t face_size = kMaxReturnVarSize;
-  nacl::scoped_array<char> face_bytes(new char[face_size]);
-  nacl_abi_size_t metrics_size = kPPFontMetricsBytes;
-  NaClSrpcError srpc_result =
-      PpbFontRpcClient::PPB_Font_Describe(
-          channel,
-          font,
-          &description_size,
-          reinterpret_cast<char*>(description),
-          &face_size,
-          face_bytes.get(),
-          &metrics_size,
-          reinterpret_cast<char*>(metrics),
-          &success);
-
-  DebugPrintf("PPB_Font::Describe: %s\n", NaClSrpcErrorString(srpc_result));
-
-  description->face = PP_MakeUndefined();
-  if (srpc_result == NACL_SRPC_RESULT_OK && success) {
-    (void) DeserializeTo(face_bytes.get(), face_size, 1, &description->face);
-    return PP_TRUE;
-  }
-  return PP_FALSE;
-}
-
-PP_Bool DrawTextAt(PP_Resource font,
-                   PP_Resource image_data,
-                   const struct PP_TextRun_Dev* text_run,
-                   const struct PP_Point* position,
-                   uint32_t color,
-                   const struct PP_Rect* clip,
-                   PP_Bool image_data_is_opaque) {
-  DebugPrintf("PPB_Font::DrawTextAt: font=%"NACL_PRId32"\n", font);
-
-  nacl_abi_size_t text_size = 0;
-  nacl::scoped_array<char> text_bytes(
-      Serialize(&text_run->text, 1, &text_size));
-
-  int32_t success = 0;
-  NaClSrpcError srpc_result =
-      PpbFontRpcClient::PPB_Font_DrawTextAt(
-          GetMainSrpcChannel(),
-          font,
-          image_data,
-          kPPTextRunBytes,
-          reinterpret_cast<char*>(
-              const_cast<struct PP_TextRun_Dev*>(text_run)),
-          text_size,
-          text_bytes.get(),
-          kPPPointBytes,
-          reinterpret_cast<char*>(const_cast<struct PP_Point*>(position)),
-          color,
-          kPPRectBytes,
-          reinterpret_cast<char*>(const_cast<struct PP_Rect*>(clip)),
-          image_data_is_opaque,
-          &success);
-
-  DebugPrintf("PPB_Font::DrawTextAt: %s\n", NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-int32_t MeasureText(PP_Resource font,
-                    const struct PP_TextRun_Dev* text_run) {
-  DebugPrintf("PPB_Font::MeasureText: font=%"NACL_PRId32"\n", font);
-
-  nacl_abi_size_t text_size = 0;
-  nacl::scoped_array<char> text_bytes(
-      Serialize(&text_run->text, 1, &text_size));
-  int32_t width = 0;
-  NaClSrpcError srpc_result =
-      PpbFontRpcClient::PPB_Font_MeasureText(
-          GetMainSrpcChannel(),
-          font,
-          kPPTextRunBytes,
-          reinterpret_cast<char*>(
-              const_cast<struct PP_TextRun_Dev*>(text_run)),
-          text_size,
-          text_bytes.get(),
-          &width);
-
-  DebugPrintf("PPB_Font::MeasureText: %s\n", NaClSrpcErrorString(srpc_result));
-  return width;
-}
-
-uint32_t CharacterOffsetForPixel(PP_Resource font,
-                                 const struct PP_TextRun_Dev* text_run,
-                                 int32_t pixel_position) {
-  DebugPrintf("PPB_Font::CharacterOffsetForPixel: font=%"NACL_PRId32"\n", font);
-
-  nacl_abi_size_t text_size = 0;
-  nacl::scoped_array<char> text_bytes(
-      Serialize(&text_run->text, 1, &text_size));
-  int32_t offset = kInvalidOffset;
-  NaClSrpcError srpc_result =
-      PpbFontRpcClient::PPB_Font_CharacterOffsetForPixel(
-          GetMainSrpcChannel(),
-          font,
-          kPPTextRunBytes,
-          reinterpret_cast<char*>(
-              const_cast<struct PP_TextRun_Dev*>(text_run)),
-          text_size,
-          text_bytes.get(),
-          pixel_position,
-          &offset);
-
-  DebugPrintf("PPB_Font::CharacterOffsetForPixel: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  return offset;
-}
-
-int32_t PixelOffsetForCharacter(PP_Resource font,
-                                const struct PP_TextRun_Dev* text_run,
-                                uint32_t char_offset) {
-  DebugPrintf("PPB_Font::PixelOffsetForCharacter: font=%"NACL_PRId32"\n", font);
-
-  nacl_abi_size_t text_size = 0;
-  nacl::scoped_array<char> text_bytes(
-      Serialize(&text_run->text, 1, &text_size));
-  int32_t offset = kInvalidOffset;
-  NaClSrpcError srpc_result =
-      PpbFontRpcClient::PPB_Font_PixelOffsetForCharacter(
-          GetMainSrpcChannel(),
-          font,
-          kPPTextRunBytes,
-          reinterpret_cast<char*>(
-              const_cast<struct PP_TextRun_Dev*>(text_run)),
-          text_size,
-          text_bytes.get(),
-          char_offset,
-          &offset);
-
-  DebugPrintf("PPB_Font::PixelOffsetForCharacter: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  return offset;
-}
-
-}  // namespace
-
-const PPB_Font_Dev* PluginFont::GetInterface() {
-  static const PPB_Font_Dev font_interface = {
-    GetFontFamilies,
-    Create,
-    IsFont,
-    Describe,
-    DrawTextAt,
-    MeasureText,
-    CharacterOffsetForPixel,
-    PixelOffsetForCharacter
-  };
-  return &font_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_font.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_font.h
deleted file mode 100644
index 733f23d..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_font.h
+++ /dev/null
@@ -1,32 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_FONT_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_FONT_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "ppapi/c/dev/ppb_font_dev.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_Font_Dev interface.
-class PluginFont : public PluginResource {
- public:
-  PluginFont() {}
-  virtual bool InitFromBrowserResource(PP_Resource resource) { return true; }
-
-  static const PPB_Font_Dev* GetInterface();
-
- protected:
-  virtual ~PluginFont() {}
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginFont);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_FONT_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_fullscreen.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_fullscreen.cc
deleted file mode 100644
index f4be062..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_fullscreen.cc
+++ /dev/null
@@ -1,79 +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 "native_client/src/shared/ppapi_proxy/plugin_instance_data.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_fullscreen.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_size.h"
-#include "ppapi/c/ppb_fullscreen.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Bool IsFullscreen(PP_Instance instance) {
-  DebugPrintf("PPB_Fullscreen::IsFullscreen: instance=%"NACL_PRId32"\n",
-              instance);
-  return PP_FromBool(PluginInstanceData::IsFullscreen(instance));
-}
-
-
-PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) {
-  DebugPrintf("PPB_Fullscreen::SetFullscreen: "
-              "instance=%"NACL_PRId32" fullscreen=%d\n", instance, fullscreen);
-
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbFullscreenRpcClient::PPB_Fullscreen_SetFullscreen(
-          GetMainSrpcChannel(),
-          instance,
-          static_cast<int32_t>(fullscreen),
-          &success);
-  DebugPrintf("PPB_Fullscreen::SetFullscreen: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-
-PP_Bool GetScreenSize(PP_Instance instance, struct PP_Size* size) {
-  DebugPrintf("PPB_Fullscreen::GetScreenSize: instance=%"NACL_PRId32"\n",
-              instance);
-  if (size == NULL)
-    return PP_FALSE;
-
-  int32_t success;
-  nacl_abi_size_t size_bytes =
-      static_cast<nacl_abi_size_t>(sizeof(struct PP_Size));
-  NaClSrpcError srpc_result =
-      PpbFullscreenRpcClient::PPB_Fullscreen_GetScreenSize(
-          GetMainSrpcChannel(),
-          instance,
-          &size_bytes,
-          reinterpret_cast<char*>(size),
-          &success);
-  DebugPrintf("PPB_Fullscreen::GetScreenSize: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-}  // namespace
-
-const PPB_Fullscreen* PluginFullscreen::GetInterface() {
-  static const PPB_Fullscreen fullscreen_interface = {
-    IsFullscreen,
-    SetFullscreen,
-    GetScreenSize
-  };
-  return &fullscreen_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_fullscreen.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_fullscreen.h
deleted file mode 100644
index a3e62ab..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_fullscreen.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_FULLSCREEN_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_FULLSCREEN_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppb_fullscreen.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_Fullscreen interface.
-class PluginFullscreen {
- public:
-  static const PPB_Fullscreen* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginFullscreen);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_FULLSCREEN_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.cc
deleted file mode 100644
index 5d15d2b..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.cc
+++ /dev/null
@@ -1,47 +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 "native_client/src/shared/ppapi_proxy/plugin_instance_data.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_size.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-void SampleGamepads(PP_Instance instance,
-                    struct PP_GamepadsSampleData* pads) {
-  DebugPrintf("PPB_Gamepad::SampleGamepads: instance=%"NACL_PRId32"\n",
-              instance);
-  if (pads == NULL)
-    return;
-
-  nacl_abi_size_t pads_bytes =
-      static_cast<nacl_abi_size_t>(sizeof(struct PP_GamepadsSampleData));
-  NaClSrpcError srpc_result =
-      PpbGamepadRpcClient::PPB_Gamepad_Sample(
-          GetMainSrpcChannel(),
-          instance,
-          &pads_bytes,
-          reinterpret_cast<char*>(pads));
-  DebugPrintf("PPB_Gamepad::SampleGamepads: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pads->length = 0;
-}
-
-}  // namespace
-
-const PPB_Gamepad* PluginGamepad::GetInterface() {
-  static const PPB_Gamepad gamepad_interface = {
-    SampleGamepads
-  };
-  return &gamepad_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.h
deleted file mode 100644
index 2085422..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.h
+++ /dev/null
@@ -1,24 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GAMEPAD_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GAMEPAD_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppb_gamepad.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_Gamepad interface.
-class PluginGamepad {
- public:
-  static const PPB_Gamepad* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginGamepad);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GAMEPAD_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.cc
deleted file mode 100644
index c78f071..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.cc
+++ /dev/null
@@ -1,182 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.h"
-
-#include <stdio.h>
-#include <string.h>
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_upcall.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_rect.h"
-#include "ppapi/c/pp_size.h"
-#include "ppapi/c/ppb_graphics_2d.h"
-#include "srpcgen/ppb_rpc.h"
-#include "srpcgen/upcall.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-const nacl_abi_size_t kPPSizeBytes =
-    static_cast<nacl_abi_size_t>(sizeof(struct PP_Size));
-const nacl_abi_size_t kPPPointBytes =
-    static_cast<nacl_abi_size_t>(sizeof(struct PP_Point));
-const nacl_abi_size_t kPPRectBytes =
-    static_cast<nacl_abi_size_t>(sizeof(struct PP_Rect));
-
-PP_Resource Create(PP_Instance instance,
-                   const struct PP_Size* size,
-                   PP_Bool is_always_opaque) {
-  DebugPrintf("PPB_Graphics2D::Create: instance=%"NACL_PRId32"\n", instance);
-  char* size_as_char_ptr =
-      reinterpret_cast<char*>(const_cast<struct PP_Size*>(size));
-  int32_t is_always_opaque_as_int = static_cast<int32_t>(is_always_opaque);
-  PP_Resource resource = kInvalidResourceId;
-  NaClSrpcError srpc_result =
-      PpbGraphics2DRpcClient::PPB_Graphics2D_Create(
-          GetMainSrpcChannel(),
-          instance,
-          kPPSizeBytes,
-          size_as_char_ptr,
-          is_always_opaque_as_int,
-          &resource);
-  DebugPrintf("PPB_Graphics2D::Create: %s\n", NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_OK) {
-    scoped_refptr<PluginGraphics2D> graphics_2d =
-        PluginResource::AdoptAs<PluginGraphics2D>(resource);
-    if (graphics_2d.get()) {
-      return resource;
-    }
-  }
-  return kInvalidResourceId;
-}
-
-PP_Bool IsGraphics2D(PP_Resource resource) {
-  DebugPrintf("PPB_Graphics2D::IsGraphics2D: resource=%"NACL_PRId32"\n",
-              resource);
-  return PP_FromBool(PluginResource::GetAs<PluginGraphics2D>(resource).get());
-}
-
-PP_Bool Describe(PP_Resource graphics_2d,
-                 struct PP_Size* size,
-                 PP_Bool* is_always_opaque) {
-  DebugPrintf("PPB_Graphics2D::Describe: graphics_2d=%"NACL_PRId32"\n",
-              graphics_2d);
-  if (size == NULL || is_always_opaque == NULL) {
-    return PP_FALSE;
-  }
-  int32_t is_always_opaque_as_int;
-  nacl_abi_size_t size_ret = kPPSizeBytes;
-  int32_t result;
-  NaClSrpcError srpc_result =
-      PpbGraphics2DRpcClient::PPB_Graphics2D_Describe(
-          GetMainSrpcChannel(),
-          graphics_2d,
-          &size_ret,
-          reinterpret_cast<char*>(size),
-          &is_always_opaque_as_int,
-          &result);
-  DebugPrintf("PPB_Graphics2D::Describe: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_OK || size_ret != kPPSizeBytes) {
-    *is_always_opaque = PP_FromBool(is_always_opaque_as_int);
-    return PP_FromBool(result);
-  } else {
-    return PP_FALSE;
-  }
-}
-
-void PaintImageData(PP_Resource graphics_2d,
-                    PP_Resource image,
-                    const struct PP_Point* top_left,
-                    const struct PP_Rect* src_rect) {
-  DebugPrintf("PPB_Graphics2D::PaintImageData: graphics_2d=%"NACL_PRId32"\n",
-              graphics_2d);
-  nacl_abi_size_t rect_size = kPPRectBytes;
-  if (src_rect == NULL) {  // Corresponds to the entire image.
-    rect_size = 0;
-  }
-  NaClSrpcError srpc_result =
-      PpbGraphics2DRpcClient::PPB_Graphics2D_PaintImageData(
-          GetMainSrpcChannel(),
-          graphics_2d,
-          image,
-          kPPPointBytes,
-          reinterpret_cast<char*>(const_cast<struct PP_Point*>(top_left)),
-          rect_size,
-          reinterpret_cast<char*>(const_cast<struct PP_Rect*>(src_rect)));
-  DebugPrintf("PPB_Graphics2D::PaintImageData: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-void Scroll(PP_Resource graphics_2d,
-            const struct PP_Rect* clip_rect,
-            const struct PP_Point* amount) {
-  DebugPrintf("PPB_Graphics2D::Scroll: graphics_2d=%"NACL_PRId32"\n",
-              graphics_2d);
-  nacl_abi_size_t rect_size = kPPRectBytes;
-  if (clip_rect == NULL) {  // Corresponds to the entire graphics region.
-    rect_size = 0;
-  }
-  NaClSrpcError srpc_result = PpbGraphics2DRpcClient::PPB_Graphics2D_Scroll(
-      GetMainSrpcChannel(),
-      graphics_2d,
-      rect_size,
-      reinterpret_cast<char*>(const_cast<struct PP_Rect*>(clip_rect)),
-      kPPPointBytes,
-      reinterpret_cast<char*>(const_cast<struct PP_Point*>(amount)));
-  DebugPrintf("PPB_Graphics2D::Scroll: %s\n", NaClSrpcErrorString(srpc_result));
-}
-
-void ReplaceContents(PP_Resource graphics_2d, PP_Resource image) {
-  DebugPrintf("PPB_Graphics2D::ReplaceContents: graphics_2d=%"NACL_PRId32"\n",
-              graphics_2d);
-  NaClSrpcError srpc_result =
-      PpbGraphics2DRpcClient::PPB_Graphics2D_ReplaceContents(
-          GetMainSrpcChannel(), graphics_2d, image);
-  DebugPrintf("PPB_Graphics2D::ReplaceContents: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-int32_t Flush(PP_Resource graphics_2d,
-              struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_Graphics2D::Flush: graphics_2d=%"NACL_PRId32"\n",
-              graphics_2d);
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error;
-  NaClSrpcError srpc_result =
-      PpbGraphics2DRpcClient::PPB_Graphics2D_Flush(
-          GetMainSrpcChannel(), graphics_2d, callback_id, &pp_error);
-  DebugPrintf("PPB_Graphics2D::Flush: %s\n", NaClSrpcErrorString(srpc_result));
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-}  // namespace
-
-const PPB_Graphics2D* PluginGraphics2D::GetInterface() {
-  static const PPB_Graphics2D graphics_2d_interface = {
-    Create,
-    IsGraphics2D,
-    Describe,
-    PaintImageData,
-    Scroll,
-    ReplaceContents,
-    Flush,
-  };
-  return &graphics_2d_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.h
deleted file mode 100644
index accc28e..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.h
+++ /dev/null
@@ -1,32 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_GRAPHICS_2D_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_GRAPHICS_2D_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "ppapi/c/ppb_graphics_2d.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_Graphics2D interface.
-class PluginGraphics2D : public PluginResource {
- public:
-  PluginGraphics2D() {}
-  bool InitFromBrowserResource(PP_Resource resource) { return true; }
-
-  static const PPB_Graphics2D* GetInterface();
-
- protected:
-  virtual ~PluginGraphics2D() {}
-
- private:
-  IMPLEMENT_RESOURCE(PluginGraphics2D);
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginGraphics2D);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_GRAPHICS_2D_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc
deleted file mode 100644
index 33e9725..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc
+++ /dev/null
@@ -1,277 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h"
-
-#include "gpu/command_buffer/client/gles2_implementation.h"
-#include "gpu/command_buffer/client/transfer_buffer.h"
-#include "native_client/src/shared/ppapi_proxy/command_buffer_nacl.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_instance_data.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_core.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_rect.h"
-#include "ppapi/c/pp_var.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-const size_t kRingBufferSize = 4 * 1024 * 1024;
-const size_t kStartTransferBufferSize = 4 * 1024 * 1024;
-const size_t kMinTransferBufferSize = 256 * 1024;
-const size_t kMaxTransferBufferSize = 16 * 1024 * 1024;
-
-int32_t GetNumAttribs(const int32_t attrib_list[]) {
-  int32_t num = 0;
-  if (attrib_list) {
-    // skip over attrib pairs
-    while (attrib_list[num] != PP_GRAPHICS3DATTRIB_NONE)
-      num += 2;
-    // Add one more for PP_GRAPHICS3DATTRIB_NONE.
-    num += 1;
-  }
-  return num;
-}
-
-int32_t GetAttribMaxValue(PP_Instance instance,
-                          int32_t attrib,
-                          int32_t* attrib_value) {
-  DebugPrintf("PPB_Graphics3D::GetAttribMaxValue: instance=%"NACL_PRId32"\n",
-              instance);
-  int32_t pp_error;
-  NaClSrpcError retval =
-      PpbGraphics3DRpcClient::PPB_Graphics3D_GetAttribMaxValue(
-          GetMainSrpcChannel(),
-          instance,
-          attrib,
-          attrib_value,
-          &pp_error);
-  if (retval != NACL_SRPC_RESULT_OK) {
-    return PP_ERROR_BADARGUMENT;
-  }
-  return pp_error;
-}
-
-PP_Resource Create(PP_Instance instance,
-                   PP_Resource share_context,
-                   const int32_t attrib_list[]) {
-  DebugPrintf("PPB_Graphics3D::Create: instance=%"NACL_PRId32"\n", instance);
-  PP_Resource graphics3d_id = kInvalidResourceId;
-  nacl_abi_size_t num_attribs = GetNumAttribs(attrib_list);
-  NaClSrpcError retval =
-      PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_CreateRaw(
-          GetMainSrpcChannel(),
-          instance,
-          share_context,
-          num_attribs, const_cast<int32_t *>(attrib_list),
-          &graphics3d_id);
-  if (retval == NACL_SRPC_RESULT_OK) {
-    scoped_refptr<PluginGraphics3D> graphics_3d =
-        PluginResource::AdoptAs<PluginGraphics3D>(graphics3d_id);
-    if (graphics_3d.get()) {
-      graphics_3d->set_instance_id(instance);
-      return graphics3d_id;
-    }
-  }
-  return kInvalidResourceId;
-}
-
-PP_Bool IsGraphics3D(PP_Resource resource) {
-  DebugPrintf("PPB_Graphics3D::IsGraphics3D: resource=%"NACL_PRId32"\n",
-              resource);
-  return PP_FromBool(PluginResource::GetAs<PluginGraphics3D>(resource).get());
-}
-
-int32_t GetAttribs(PP_Resource graphics3d_id,
-                   int32_t attrib_list[]) {
-  int32_t pp_error;
-  nacl_abi_size_t num_attribs = GetNumAttribs(attrib_list);
-  NaClSrpcError retval =
-      PpbGraphics3DRpcClient::PPB_Graphics3D_GetAttribs(
-          GetMainSrpcChannel(),
-          graphics3d_id,
-          num_attribs, attrib_list,
-          &num_attribs, attrib_list,
-          &pp_error);
-  if (retval != NACL_SRPC_RESULT_OK) {
-    return PP_ERROR_BADARGUMENT;
-  }
-  return pp_error;
-}
-
-int32_t SetAttribs(PP_Resource graphics3d_id,
-                   const int32_t attrib_list[]) {
-  int32_t pp_error;
-  nacl_abi_size_t num_attribs = GetNumAttribs(attrib_list);
-  NaClSrpcError retval =
-      PpbGraphics3DRpcClient::PPB_Graphics3D_SetAttribs(
-          GetMainSrpcChannel(),
-          graphics3d_id,
-          num_attribs, const_cast<int32_t *>(attrib_list),
-          &pp_error);
-  if (retval != NACL_SRPC_RESULT_OK) {
-    return PP_ERROR_BADARGUMENT;
-  }
-  return pp_error;
-}
-
-int32_t GetError(PP_Resource graphics3d_id) {
-  DebugPrintf("PPB_Graphics3D::GetError: graphics3d_id=%"NACL_PRId32"\n",
-              graphics3d_id);
-  int32_t pp_error;
-  NaClSrpcError retval =
-      PpbGraphics3DRpcClient::PPB_Graphics3D_GetError(
-          GetMainSrpcChannel(),
-          graphics3d_id,
-          &pp_error);
-  if (retval != NACL_SRPC_RESULT_OK) {
-    DebugPrintf("PPB_Graphics3D::GetError: retval != NACL_SRPC_RESULT_OK\n");
-    return PP_ERROR_BADARGUMENT;
-  }
-  DebugPrintf("PPB_Graphics3D::GetError: pp_error=%"NACL_PRId32"\n", pp_error);
-  return pp_error;
-}
-
-int32_t ResizeBuffers(PP_Resource graphics3d_id,
-                      int32_t width,
-                      int32_t height) {
-  if ((width < 0) || (height < 0))
-    return PP_ERROR_BADARGUMENT;
-  gpu::gles2::GLES2Implementation* impl =
-      PluginGraphics3D::implFromResource(graphics3d_id);
-  if (impl == NULL)
-    return PP_ERROR_BADRESOURCE;
-  impl->ResizeCHROMIUM(width, height);
-  return PP_OK;
-}
-
-int32_t SwapBuffs(PP_Resource graphics3d_id,
-                  struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_Graphics3D::SwapBuffers: graphics3d_id=%"NACL_PRId32"\n",
-              graphics3d_id);
-
-  scoped_refptr<PluginGraphics3D> graphics3d =
-      PluginResource::GetAs<PluginGraphics3D>(graphics3d_id).get();
-  if (!graphics3d.get())
-    return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
-
-  return MayForceCallback(callback,
-      graphics3d->SwapBuffers(graphics3d_id, callback));
-}
-
-}  // namespace
-
-  // TODO(nfullagar): make cached_* variables TLS once 64bit NaCl TLS is faster,
-  // and the proxy has support for being called off the main thread.
-  // see: http://code.google.com/p/chromium/issues/detail?id=99217
-  PP_Resource PluginGraphics3D::cached_graphics3d_id = 0;
-  gpu::gles2::GLES2Implementation*
-  PluginGraphics3D::cached_implementation = NULL;
-
-PluginGraphics3D::PluginGraphics3D() : instance_id_(0) { }
-
-PluginGraphics3D::~PluginGraphics3D() {
-  DebugPrintf("PluginGraphics3D::~PluginGraphics3D()\n");
-  // Explicitly tear down scopted pointers; ordering below matters.
-  gles2_implementation_.reset();
-  transfer_buffer_.reset();
-  gles2_helper_.reset();
-  command_buffer_.reset();
-  // Invalidate the cache.
-  cached_graphics3d_id = 0;
-  cached_implementation = NULL;
-}
-
-// static
-gpu::gles2::GLES2Implementation* PluginGraphics3D::implFromResourceSlow(
-    PP_Resource graphics3d_id) {
-  DebugPrintf("PluginGraphics3D::implFromResourceSlow: "
-              "resource=%"NACL_PRId32"\n", graphics3d_id);
-
-  // For performance reasons, we don't error-check the context, but crash on
-  // NULL instead.
-  gpu::gles2::GLES2Implementation* impl =
-      PluginResource::GetAs<PluginGraphics3D>(graphics3d_id)->impl();
-  cached_graphics3d_id = graphics3d_id;
-  cached_implementation = impl;
-  return impl;
-}
-
-
-bool PluginGraphics3D::InitFromBrowserResource(PP_Resource res) {
-  DebugPrintf("PluginGraphics3D::InitFromBrowserResource: "
-              "resource=%"NACL_PRId32"\n", res);
-
-  // Create and initialize the objects required to issue GLES2 calls.
-  command_buffer_.reset(new CommandBufferNacl(res, PluginCore::GetInterface()));
-  if (command_buffer_->Initialize()) {
-    gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer_.get()));
-    if (gles2_helper_->Initialize(kRingBufferSize)) {
-      transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get()));
-      gles2_implementation_.reset(new gpu::gles2::GLES2Implementation(
-        gles2_helper_.get(),
-        NULL,
-        transfer_buffer_.get(),
-        false,
-        true));
-      if (gles2_implementation_->Initialize(
-          kStartTransferBufferSize,
-          kMinTransferBufferSize,
-          kMaxTransferBufferSize)) {
-        return true;
-      }
-    }
-  }
-  return false;
-}
-
-int32_t PluginGraphics3D::SwapBuffers(PP_Resource graphics3d_id,
-                                      struct PP_CompletionCallback callback) {
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  impl()->SwapBuffers();
-  int32_t pp_error;
-  NaClSrpcError retval =
-      PpbGraphics3DRpcClient::PPB_Graphics3D_SwapBuffers(
-          GetMainSrpcChannel(),
-          graphics3d_id,
-          callback_id,
-          &pp_error);
-  if (retval != NACL_SRPC_RESULT_OK)
-    return PP_ERROR_FAILED;
-
-  if ((PP_OK_COMPLETIONPENDING != pp_error) && (PP_OK != pp_error))
-    return pp_error;
-
-  return PP_OK_COMPLETIONPENDING;
-}
-
-
-// static
-const PPB_Graphics3D* PluginGraphics3D::GetInterface() {
-  static const PPB_Graphics3D intf = {
-    &GetAttribMaxValue,
-    &Create,
-    &IsGraphics3D,
-    &GetAttribs,
-    &SetAttribs,
-    &GetError,
-    &ResizeBuffers,
-    &SwapBuffs,
-  };
-  return &intf;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h
deleted file mode 100644
index c457e19..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h
+++ /dev/null
@@ -1,94 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_
-
-#include "base/memory/scoped_ptr.h"
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "ppapi/c/pp_graphics_3d.h"
-#include "ppapi/c/ppb_graphics_3d.h"
-#include "ppapi/c/ppb_opengles2.h"
-#include "ppapi/c/dev/ppb_opengles2ext_dev.h"
-#include "ppapi/c/pp_instance.h"
-
-namespace gpu {
-class CommandBuffer;
-class TransferBuffer;
-namespace gles2 {
-class GLES2CmdHelper;
-class GLES2Implementation;
-}  // namespace gles2
-}  // namespace gpu
-
-namespace ppapi_proxy {
-
-// Implements the plugin (i.e., .nexe) side of the PPB_Graphics3D interface.
-class PluginGraphics3D : public PluginResource {
- public:
-  PluginGraphics3D();
-
-  static const PPB_Graphics3D* GetInterface();
-  static const PPB_OpenGLES2* GetOpenGLESInterface();
-  static const PPB_OpenGLES2InstancedArrays*
-      GetOpenGLESInstancedArraysInterface();
-  static const PPB_OpenGLES2FramebufferBlit*
-      GetOpenGLESFramebufferBlitInterface();
-  static const PPB_OpenGLES2FramebufferMultisample*
-      GetOpenGLESFramebufferMultisampleInterface();
-  static const PPB_OpenGLES2ChromiumEnableFeature*
-      GetOpenGLESChromiumEnableFeatureInterface();
-  static const PPB_OpenGLES2ChromiumMapSub*
-      GetOpenGLESChromiumMapSubInterface();
-  static const PPB_OpenGLES2Query*
-      GetOpenGLESQueryInterface();
-
-  virtual bool InitFromBrowserResource(PP_Resource graphics3d_id);
-
-  gpu::gles2::GLES2Implementation* impl() {
-    return gles2_implementation_.get();
-  }
-
-  int32_t SwapBuffers(PP_Resource graphics3d_id,
-                      struct PP_CompletionCallback callback);
-
-  PP_Instance instance_id() { return instance_id_; }
-  void set_instance_id(PP_Instance instance_id) { instance_id_ = instance_id; }
-
-  static inline gpu::gles2::GLES2Implementation* implFromResource(
-      PP_Resource graphics3d_id) {
-    if (cached_graphics3d_id == graphics3d_id && cached_implementation != NULL)
-      return cached_implementation;
-
-    return implFromResourceSlow(graphics3d_id);
-  }
-
- protected:
-  virtual ~PluginGraphics3D();
-
- private:
-  static gpu::gles2::GLES2Implementation* implFromResourceSlow(
-      PP_Resource context);
-
-  // TODO(nfullagar): make cached_* variables TLS once 64bit NaCl is faster,
-  // and the proxy has support for being called off the main thread.
-  // see: http://code.google.com/p/chromium/issues/detail?id=99217
-  static PP_Resource cached_graphics3d_id;
-  static gpu::gles2::GLES2Implementation* cached_implementation;
-
-  // GLES2 Implementation objects.
-  scoped_ptr<gpu::CommandBuffer> command_buffer_;
-  scoped_ptr<gpu::gles2::GLES2Implementation> gles2_implementation_;
-  scoped_ptr<gpu::TransferBuffer> transfer_buffer_;
-  scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_;
-  PP_Instance instance_id_;
-
-  IMPLEMENT_RESOURCE(PluginGraphics3D);
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginGraphics3D);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_host_resolver_private.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_host_resolver_private.cc
deleted file mode 100644
index 393fe5a..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_host_resolver_private.cc
+++ /dev/null
@@ -1,181 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_host_resolver_private.h"
-
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/private/ppb_host_resolver_private.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Resource Create(PP_Instance instance) {
-  DebugPrintf("PPB_HostResolver_Private::Create: " \
-              "instance=%"NACL_PRId32"\n", instance);
-
-  PP_Resource resource;
-  NaClSrpcError srpc_result =
-      PpbHostResolverPrivateRpcClient::PPB_HostResolver_Private_Create(
-          GetMainSrpcChannel(),
-          instance,
-          &resource);
-
-  DebugPrintf("PPB_HostResolver_Private::Create: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    return kInvalidResourceId;
-  return resource;
-}
-
-PP_Bool IsHostResolver(PP_Resource resource) {
-  DebugPrintf("PPB_HostResolver_Private::IsHostResolver: " \
-              "resource=%"NACL_PRId32"\n", resource);
-
-  int32_t is_host_resolver;
-  NaClSrpcError srpc_result =
-      PpbHostResolverPrivateRpcClient::
-      PPB_HostResolver_Private_IsHostResolver(
-          GetMainSrpcChannel(),
-          resource,
-          &is_host_resolver);
-
-  DebugPrintf("PPB_HostResolver_Private::IsHostResolver: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && is_host_resolver)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-int32_t Resolve(PP_Resource host_resolver,
-                const char* host,
-                uint16_t port,
-                const PP_HostResolver_Private_Hint* hint,
-                PP_CompletionCallback callback) {
-  DebugPrintf("PPB_HostResolver_Private::Resolve: " \
-              "resource=%"NACL_PRId32"\n", host_resolver);
-
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result =
-      PpbHostResolverPrivateRpcClient::
-      PPB_HostResolver_Private_Resolve(
-          GetMainSrpcChannel(),
-          host_resolver,
-          host,
-          port,
-          static_cast<nacl_abi_size_t>(sizeof(*hint)),
-          reinterpret_cast<char*>(
-              const_cast<PP_HostResolver_Private_Hint*>(hint)),
-          callback_id,
-          &pp_error);
-
-  DebugPrintf("PPB_HostResolver_Private::Resolve: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-PP_Var GetCanonicalName(PP_Resource host_resolver) {
-  DebugPrintf("PPB_HostResolver_Private::GetCanonicalName: " \
-              "resource=%"NACL_PRId32"\n", host_resolver);
-
-  nacl_abi_size_t canonical_name_size = kMaxReturnVarSize;
-  nacl::scoped_array<char> canonical_name_bytes(new char[canonical_name_size]);
-  NaClSrpcError srpc_result =
-      PpbHostResolverPrivateRpcClient::
-      PPB_HostResolver_Private_GetCanonicalName(
-          GetMainSrpcChannel(),
-          host_resolver,
-          &canonical_name_size, canonical_name_bytes.get());
-
-  DebugPrintf("PPB_HostResolver_Private::GetCanonicalName: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  PP_Var canonical_name = PP_MakeUndefined();
-  if (srpc_result == NACL_SRPC_RESULT_OK) {
-    (void) DeserializeTo(canonical_name_bytes.get(),
-                         canonical_name_size,
-                         1,
-                         &canonical_name);
-  }
-  return canonical_name;
-}
-
-uint32_t GetSize(PP_Resource host_resolver) {
-  DebugPrintf("PPB_HostResolver_Private::GetSize: " \
-              "resource=%"NACL_PRId32"\n", host_resolver);
-
-  int32_t size;
-  NaClSrpcError srpc_result =
-      PpbHostResolverPrivateRpcClient::
-      PPB_HostResolver_Private_GetSize(
-          GetMainSrpcChannel(),
-          host_resolver,
-          &size);
-
-  DebugPrintf("PPB_HostResolver_Private::GetSize: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return static_cast<uint32_t>(size);
-  return 0;
-}
-
-PP_Bool GetNetAddress(PP_Resource host_resolver,
-                      uint32_t index,
-                      PP_NetAddress_Private* addr) {
-  DebugPrintf("PPB_HostResolver_Private::GetNetAddress: " \
-              "resource=%"NACL_PRId32"\n", host_resolver);
-
-  nacl_abi_size_t addr_size = sizeof(*addr);
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbHostResolverPrivateRpcClient::
-      PPB_HostResolver_Private_GetNetAddress(
-          GetMainSrpcChannel(),
-          host_resolver,
-          static_cast<int32_t>(index),
-          &addr_size, reinterpret_cast<char*>(addr),
-          &success);
-
-  DebugPrintf("PPB_HostResolver_Private::GetNetAddress: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success != 0)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-}  // namespace
-
-const PPB_HostResolver_Private*
-  PluginHostResolverPrivate::GetInterface() {
-  static const PPB_HostResolver_Private hostresolver_private_interface = {
-    Create,
-    IsHostResolver,
-    Resolve,
-    GetCanonicalName,
-    GetSize,
-    GetNetAddress
-  };
-  return &hostresolver_private_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_host_resolver_private.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_host_resolver_private.h
deleted file mode 100644
index 351c65b..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_host_resolver_private.h
+++ /dev/null
@@ -1,24 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_HOST_RESOLVER_PRIVATE_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_HOST_RESOLVER_PRIVATE_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/private/ppb_host_resolver_private.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_HostResolver_Private interface.
-class PluginHostResolverPrivate {
- public:
-  static const PPB_HostResolver_Private* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginHostResolverPrivate);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_HOST_RESOLVER_PRIVATE_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_image_data.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_image_data.cc
deleted file mode 100644
index 2bff66d..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_image_data.cc
+++ /dev/null
@@ -1,188 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_image_data.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/mman.h>
-#include "srpcgen/ppb_rpc.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/ppb_image_data.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-// round size up to next 64k
-size_t ceil64k(size_t n) {
-  return (n + 0xFFFF) & (~0xFFFF);
-}
-
-PP_ImageDataFormat GetNativeImageDataFormat() {
-  DebugPrintf("PPB_ImageData::GetNativeImageDataFormat\n");
-  int32_t format;
-  NaClSrpcError srpc_result =
-      PpbImageDataRpcClient::PPB_ImageData_GetNativeImageDataFormat(
-          GetMainSrpcChannel(),
-          &format);
-  DebugPrintf("PPB_ImageData::GetNativeImageDataFormat: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_OK) {
-    return static_cast<PP_ImageDataFormat>(format);
-  } else {
-    return PP_IMAGEDATAFORMAT_BGRA_PREMUL;
-  }
-}
-
-PP_Bool IsImageDataFormatSupported(PP_ImageDataFormat format) {
-  DebugPrintf("PPB_ImageData::IsImageDataFormatSupported: format=%"
-              NACL_PRId32"\n", static_cast<int32_t>(format));
-  int32_t result;
-  NaClSrpcError srpc_result =
-      PpbImageDataRpcClient::PPB_ImageData_IsImageDataFormatSupported(
-          GetMainSrpcChannel(),
-          static_cast<int32_t>(format),
-          &result);
-  DebugPrintf("PPB_ImageData::IsImageDataFormatSupported: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_OK) {
-    return PP_FromBool(result);
-  } else {
-    return PP_FALSE;
-  }
-}
-
-PP_Resource Create(PP_Instance instance,
-                   PP_ImageDataFormat format,
-                   const struct PP_Size* size,
-                   PP_Bool init_to_zero) {
-  DebugPrintf("PPB_ImageData::Create: instance=%"NACL_PRId32"\n", instance);
-  PP_Resource resource;
-  NaClSrpcError srpc_result =
-      PpbImageDataRpcClient::PPB_ImageData_Create(
-          GetMainSrpcChannel(),
-          instance,
-          static_cast<int32_t>(format),
-          static_cast<nacl_abi_size_t>(sizeof(struct PP_Size)),
-          reinterpret_cast<char*>(const_cast<struct PP_Size*>(size)),
-          PP_ToBool(init_to_zero),
-          &resource);
-  DebugPrintf("PPB_ImageData::Create: %s\n", NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_OK) {
-    scoped_refptr<PluginImageData> image_data =
-        PluginResource::AdoptAs<PluginImageData>(resource);
-    if (image_data.get()) {
-      return resource;
-    }
-  }
-  return kInvalidResourceId;
-}
-
-PP_Bool IsImageData(PP_Resource resource) {
-  DebugPrintf("PPB_ImageData::IsImageData: resource=%"NACL_PRId32"\n",
-              resource);
-  return PP_FromBool(PluginResource::GetAs<PluginImageData>(resource).get());
-}
-
-PP_Bool Describe(PP_Resource resource,
-                 struct PP_ImageDataDesc* desc) {
-  DebugPrintf("PPB_ImageData::Describe: resource=%"NACL_PRId32"\n",
-              resource);
-  scoped_refptr<PluginImageData> imagedata =
-      PluginResource::GetAs<PluginImageData>(resource);
-  if (!imagedata.get()) {
-    return PP_FALSE;
-  }
-
-  *desc = imagedata->desc();
-  return PP_TRUE;
-}
-
-void* DoMap(PP_Resource resource) {
-  DebugPrintf("PPB_ImageData::DoMap: resource=%"NACL_PRId32"\n", resource);
-  scoped_refptr<PluginImageData> imagedata =
-      PluginResource::GetAs<PluginImageData>(resource);
-
-  return imagedata.get() ? imagedata->Map() : NULL;
-}
-
-void DoUnmap(PP_Resource resource) {
-  DebugPrintf("PPB_ImageData::DoUnmap: resource=%"NACL_PRId32"\n", resource);
-  scoped_refptr<PluginImageData> imagedata =
-      PluginResource::GetAs<PluginImageData>(resource);
-  if (imagedata.get())
-    imagedata->Unmap();
-}
-
-}  // namespace
-
-const PPB_ImageData* PluginImageData::GetInterface() {
-  static const PPB_ImageData image_data_interface = {
-    &GetNativeImageDataFormat,
-    &IsImageDataFormatSupported,
-    &Create,
-    &IsImageData,
-    &Describe,
-    &DoMap,
-    &DoUnmap,
-  };
-  return &image_data_interface;
-}
-
-PluginImageData::PluginImageData()
-    : shm_fd_(-1),
-      shm_size_(0),
-      addr_(NULL) {
-  memset(&desc_, 0, sizeof(desc_));
-}
-
-bool PluginImageData::InitFromBrowserResource(PP_Resource resource) {
-  nacl_abi_size_t desc_size = static_cast<nacl_abi_size_t>(sizeof(desc_));
-  int32_t success = PP_FALSE;
-
-  NaClSrpcError result =
-      PpbImageDataRpcClient::PPB_ImageData_Describe(
-          GetMainSrpcChannel(),
-          resource,
-          &desc_size,
-          reinterpret_cast<char*>(&desc_),
-          &shm_fd_,
-          &shm_size_,
-          &success);
-  return (NACL_SRPC_RESULT_OK == result) && (PP_TRUE == success);
-}
-
-void* PluginImageData::Map() {
-  if (NULL != addr_) {
-    return addr_;
-  }
-  if (!shm_size_) {
-    return NULL;
-  }
-
-  addr_ = mmap(0, ceil64k(shm_size_), PROT_READ | PROT_WRITE,
-      MAP_SHARED, shm_fd_, 0);
-  return addr_;
-}
-
-void PluginImageData::Unmap() {
-  if (addr_) {
-    munmap(addr_, ceil64k(shm_size_));
-    addr_ = NULL;
-  }
-}
-
-PluginImageData::~PluginImageData() {
-  Unmap();
-  if (shm_fd_ != -1) {
-    close(shm_fd_);
-    shm_fd_ = -1;
-  }
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_image_data.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_image_data.h
deleted file mode 100644
index 27f8a11..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_image_data.h
+++ /dev/null
@@ -1,42 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_IMAGE_DATA_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_IMAGE_DATA_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "ppapi/c/ppb_image_data.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_ImageData interface.
-class PluginImageData : public PluginResource {
- public:
-  PluginImageData();
-
-  static const PPB_ImageData* GetInterface();
-
-  bool InitFromBrowserResource(PP_Resource resource);
-  void* Map();
-  void Unmap();
-
-  const PP_ImageDataDesc& desc() const { return desc_; }
-
- protected:
-  virtual ~PluginImageData();
-
- private:
-  PP_ImageDataDesc desc_;
-  int shm_fd_;
-  int32_t shm_size_;
-  void* addr_;
-
-  IMPLEMENT_RESOURCE(PluginImageData);
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginImageData);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_IMAGE_DATA_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc
deleted file mode 100644
index 2020909..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc
+++ /dev/null
@@ -1,477 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h"
-
-#include <stdio.h>
-#include <string.h>
-
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_input_event.h"
-
-namespace {
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::GetMainSrpcChannel;
-using ppapi_proxy::kInvalidResourceId;
-using ppapi_proxy::PluginInputEvent;
-using ppapi_proxy::PluginResource;
-using ppapi_proxy::Serialize;
-
-// InputEvent ------------------------------------------------------------------
-
-int32_t RequestInputEvents(PP_Instance instance, uint32_t event_classes) {
-  DebugPrintf("PPB_InputEvent::RequestInputEvents: instance=%"NACL_PRId32", "
-              "event_classes=%"NACL_PRIu32"\n",
-              instance, event_classes);
-  uint32_t success = 0;
-  NaClSrpcError srpc_result =
-      PpbInputEventRpcClient::PPB_InputEvent_RequestInputEvents(
-          GetMainSrpcChannel(),
-          instance,
-          static_cast<int32_t>(event_classes),
-          false,  // false -> Don't filter.
-          reinterpret_cast<int32_t*>(&success));
-  if (srpc_result == NACL_SRPC_RESULT_OK) {
-    return success;
-  }
-  return PP_ERROR_FAILED;
-}
-
-int32_t RequestFilteringInputEvents(PP_Instance instance,
-                                    uint32_t event_classes) {
-  DebugPrintf("PPB_InputEvent::RequestFilteringInputEvents: instance="
-              "%"NACL_PRId32", event_classes=%"NACL_PRIu32"\n",
-              instance, event_classes);
-  uint32_t success = 0;
-  NaClSrpcError srpc_result =
-      PpbInputEventRpcClient::PPB_InputEvent_RequestInputEvents(
-          GetMainSrpcChannel(),
-          instance,
-          static_cast<int32_t>(event_classes),
-          true,  // true -> Filter.
-          reinterpret_cast<int32_t*>(&success));
-  if (srpc_result == NACL_SRPC_RESULT_OK) {
-    return success;
-  }
-  return PP_ERROR_FAILED;
-}
-
-void ClearInputEventRequest(PP_Instance instance,
-                            uint32_t event_classes) {
-  DebugPrintf("PPB_InputEvent::ClearInputEventRequest: instance=%"NACL_PRId32
-              ", event_classes=%"NACL_PRIu32"\n",
-              instance, event_classes);
-    PpbInputEventRpcClient::PPB_InputEvent_ClearInputEventRequest(
-        GetMainSrpcChannel(),
-        instance,
-        static_cast<int32_t>(event_classes));
-}
-
-// Helper RAII class to get the PluginInputEvent from the PP_Resource and hold
-// it with a scoped_refptr. Also does a DebugPrintf.
-class InputEventGetter {
- public:
-  InputEventGetter(PP_Resource resource, const char* function_name) {
-    DebugPrintf("PPB_InputEvent::%s: resource=%"NACL_PRId32"\n",
-                function_name,
-                resource);
-    input_event_ =
-        PluginResource::GetAs<PluginInputEvent>(resource);
-  }
-
-  PluginInputEvent* get() {
-    return input_event_.get();
-  }
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(InputEventGetter);
-  scoped_refptr<PluginInputEvent> input_event_;
-};
-// This macro is for starting a resource function. It makes sure resource_arg
-// is of type PluginInputEvent, and returns error_return if it's not.
-#define BEGIN_RESOURCE_THUNK(function_name, resource_arg, error_return) \
-  InputEventGetter input_event(resource_arg, function_name); \
-  if (!input_event.get()) { \
-    return error_return; \
-  } \
-  do {} while(0)
-
-PP_Bool IsInputEvent(PP_Resource resource) {
-  BEGIN_RESOURCE_THUNK("IsInputEvent", resource, PP_FALSE);
-  return PP_TRUE;
-}
-
-#define IMPLEMENT_RESOURCE_THUNK(function, resource_arg, error_return) \
-  BEGIN_RESOURCE_THUNK(#function, resource_arg, error_return); \
-  return input_event.get()->function()
-
-#define IMPLEMENT_RESOURCE_THUNK1(function, resource_arg, arg, error_return) \
-  BEGIN_RESOURCE_THUNK(#function, resource_arg, error_return); \
-  return input_event.get()->function(arg)
-
-PP_InputEvent_Type GetType(PP_Resource event) {
-  IMPLEMENT_RESOURCE_THUNK(GetType, event, PP_INPUTEVENT_TYPE_UNDEFINED);
-}
-
-PP_TimeTicks GetTimeStamp(PP_Resource event) {
-  IMPLEMENT_RESOURCE_THUNK(GetTimeStamp, event, 0.0);
-}
-
-uint32_t GetModifiers(PP_Resource event) {
-  IMPLEMENT_RESOURCE_THUNK(GetModifiers, event, 0);
-}
-
-// Mouse -----------------------------------------------------------------------
-
-PP_Resource CreateMouseInputEvent1_1(PP_Instance instance,
-                                     PP_InputEvent_Type type,
-                                     PP_TimeTicks time_stamp,
-                                     uint32_t modifiers,
-                                     PP_InputEvent_MouseButton mouse_button,
-                                     const PP_Point* mouse_position,
-                                     int32_t click_count,
-                                     const PP_Point* mouse_movement) {
-  DebugPrintf("PPB_InputEvent::CreateMouseInputEvent: instance="
-              "%"NACL_PRId32", type=%d, time_stamp=%lf, modifiers="
-              "%"NACL_PRIu32", mouse_button=%d, x=%"NACL_PRId32", y="
-              "%"NACL_PRId32", click_count=%d, movement_x="
-              "%"NACL_PRId32", movement_y=%"NACL_PRId32"\n",
-              instance, type, time_stamp, modifiers, mouse_button,
-              mouse_position->x, mouse_position->y, click_count,
-              mouse_movement->x, mouse_movement->y);
-  PP_Resource resource_id = kInvalidResourceId;
-  NaClSrpcError srpc_result =
-      PpbInputEventRpcClient::PPB_InputEvent_CreateMouseInputEvent(
-          GetMainSrpcChannel(),
-          instance,
-          static_cast<int32_t>(type),
-          time_stamp,
-          static_cast<int32_t>(modifiers),
-          static_cast<int32_t>(mouse_button),
-          mouse_position->x,
-          mouse_position->y,
-          click_count,
-          mouse_movement->x,
-          mouse_movement->y,
-          &resource_id);
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return resource_id;
-  return kInvalidResourceId;
-}
-
-PP_Resource CreateMouseInputEvent1_0(PP_Instance instance,
-                                     PP_InputEvent_Type type,
-                                     PP_TimeTicks time_stamp,
-                                     uint32_t modifiers,
-                                     PP_InputEvent_MouseButton mouse_button,
-                                     const PP_Point* mouse_position,
-                                     int32_t click_count) {
-  PP_Point mouse_movement = PP_MakePoint(0, 0);
-  return CreateMouseInputEvent1_1(instance, type, time_stamp, modifiers,
-                                  mouse_button, mouse_position, click_count,
-                                  &mouse_movement);
-
-}
-
-PP_Bool IsMouseInputEvent(PP_Resource resource) {
-  if (!IsInputEvent(resource))
-    return PP_FALSE;
-  PP_InputEvent_Type type = GetType(resource);
-  return PP_FromBool(type == PP_INPUTEVENT_TYPE_MOUSEDOWN ||
-                     type == PP_INPUTEVENT_TYPE_MOUSEUP ||
-                     type == PP_INPUTEVENT_TYPE_MOUSEMOVE ||
-                     type == PP_INPUTEVENT_TYPE_MOUSEENTER ||
-                     type == PP_INPUTEVENT_TYPE_MOUSELEAVE ||
-                     type == PP_INPUTEVENT_TYPE_CONTEXTMENU);
-}
-
-PP_InputEvent_MouseButton GetMouseButton(PP_Resource mouse_event) {
-  IMPLEMENT_RESOURCE_THUNK(GetMouseButton, mouse_event,
-                           PP_INPUTEVENT_MOUSEBUTTON_NONE);
-}
-
-PP_Point GetMousePosition(PP_Resource mouse_event) {
-  IMPLEMENT_RESOURCE_THUNK(GetMousePosition, mouse_event, PP_MakePoint(0, 0));
-}
-
-int32_t GetMouseClickCount(PP_Resource mouse_event) {
-  IMPLEMENT_RESOURCE_THUNK(GetMouseClickCount, mouse_event, 0);
-}
-
-PP_Point GetMouseMovement(PP_Resource mouse_event) {
-  IMPLEMENT_RESOURCE_THUNK(GetMouseMovement, mouse_event, PP_MakePoint(0, 0));
-}
-
-// Wheel -----------------------------------------------------------------------
-
-PP_Resource CreateWheelInputEvent(PP_Instance instance,
-                                  PP_TimeTicks time_stamp,
-                                  uint32_t modifiers,
-                                  const PP_FloatPoint* wheel_delta,
-                                  const PP_FloatPoint* wheel_ticks,
-                                  PP_Bool scroll_by_page) {
-  DebugPrintf("PPB_InputEvent::CreateWheelInputEvent: instance="
-              "%"NACL_PRId32", time_stamp=%lf, modifiers="
-              "%"NACL_PRIu32", delta.x=%d, delta.y=%d, ticks.x=%d, ticks.y=%d, "
-              "scroll_by_page=%s\n",
-              instance, time_stamp, modifiers, wheel_delta->x, wheel_delta->y,
-              wheel_ticks->x, wheel_ticks->y,
-              (scroll_by_page ? "true" : "false"));
-  PP_Resource resource_id = kInvalidResourceId;
-  NaClSrpcError srpc_result =
-      PpbInputEventRpcClient::PPB_InputEvent_CreateWheelInputEvent(
-          GetMainSrpcChannel(),
-          instance,
-          static_cast<double>(time_stamp),
-          static_cast<int32_t>(modifiers),
-          wheel_delta->x,
-          wheel_delta->y,
-          wheel_ticks->x,
-          wheel_ticks->y,
-          static_cast<int32_t>(scroll_by_page),
-          &resource_id);
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return resource_id;
-  return kInvalidResourceId;
-}
-
-PP_Bool IsWheelInputEvent(PP_Resource resource) {
-  if (!IsInputEvent(resource))
-    return PP_FALSE;
-  PP_InputEvent_Type type = GetType(resource);
-  return PP_FromBool(type == PP_INPUTEVENT_TYPE_WHEEL);
-}
-
-PP_FloatPoint GetWheelDelta(PP_Resource wheel_event) {
-  IMPLEMENT_RESOURCE_THUNK(GetWheelDelta, wheel_event, PP_MakeFloatPoint(0, 0));
-}
-
-PP_FloatPoint GetWheelTicks(PP_Resource wheel_event) {
-  IMPLEMENT_RESOURCE_THUNK(GetWheelTicks, wheel_event, PP_MakeFloatPoint(0, 0));
-}
-
-PP_Bool GetWheelScrollByPage(PP_Resource wheel_event) {
-  IMPLEMENT_RESOURCE_THUNK(GetWheelScrollByPage, wheel_event, PP_FALSE);
-}
-
-// Keyboard --------------------------------------------------------------------
-
-PP_Resource CreateKeyboardInputEvent(PP_Instance instance,
-                                     PP_InputEvent_Type type,
-                                     PP_TimeTicks time_stamp,
-                                     uint32_t modifiers,
-                                     uint32_t key_code,
-                                     struct PP_Var character_text) {
-  DebugPrintf("PPB_InputEvent::CreateKeyboardInputEvent: instance="
-              "%"NACL_PRId32", type=%d, time_stamp=%lf, modifiers="
-              "%"NACL_PRIu32", key_code=%"NACL_PRIu32"\n",
-              instance, type, time_stamp, modifiers, key_code);
-  // Serialize the character_text Var.
-  uint32_t text_size = 0;
-  nacl::scoped_array<char> text_bytes(Serialize(&character_text, 1,
-                                                &text_size));
-  PP_Resource resource_id = kInvalidResourceId;
-  NaClSrpcError srpc_result =
-      PpbInputEventRpcClient::PPB_InputEvent_CreateKeyboardInputEvent(
-          GetMainSrpcChannel(),
-          instance,
-          static_cast<int32_t>(type),
-          static_cast<double>(time_stamp),
-          static_cast<int32_t>(modifiers),
-          static_cast<int32_t>(key_code),
-          text_size,
-          text_bytes.get(),
-          &resource_id);
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return resource_id;
-  return kInvalidResourceId;
-}
-
-PP_Bool IsKeyboardInputEvent(PP_Resource resource) {
-  if (!IsInputEvent(resource))
-    return PP_FALSE;
-  PP_InputEvent_Type type = GetType(resource);
-  return PP_FromBool(type == PP_INPUTEVENT_TYPE_KEYDOWN ||
-                     type == PP_INPUTEVENT_TYPE_KEYUP ||
-                     type == PP_INPUTEVENT_TYPE_CHAR);
-}
-
-uint32_t GetKeyCode(PP_Resource key_event) {
-  IMPLEMENT_RESOURCE_THUNK(GetKeyCode, key_event, 0);
-}
-
-PP_Var GetCharacterText(PP_Resource character_event) {
-  IMPLEMENT_RESOURCE_THUNK(GetCharacterText, character_event,
-                           PP_MakeUndefined());
-}
-
-// Keyboard_Dev ----------------------------------------------------------------
-
-PP_Bool SetUsbKeyCode(PP_Resource key_event, uint32_t usb_key_code) {
-  IMPLEMENT_RESOURCE_THUNK1(SetUsbKeyCode, key_event, usb_key_code,
-                            PP_FALSE);
-}
-
-uint32_t GetUsbKeyCode(PP_Resource key_event) {
-  IMPLEMENT_RESOURCE_THUNK(GetUsbKeyCode, key_event, 0);
-}
-
-}  // namespace
-
-namespace ppapi_proxy {
-
-// static
-const PPB_InputEvent* PluginInputEvent::GetInterface() {
-  static const PPB_InputEvent input_event_interface = {
-    RequestInputEvents,
-    RequestFilteringInputEvents,
-    ClearInputEventRequest,
-    IsInputEvent,
-    ::GetType,
-    ::GetTimeStamp,
-    ::GetModifiers
-  };
-  return &input_event_interface;
-}
-
-// static
-const PPB_MouseInputEvent_1_0* PluginInputEvent::GetMouseInterface1_0() {
-  static const PPB_MouseInputEvent_1_0 mouse_input_event_interface = {
-    CreateMouseInputEvent1_0,
-    IsMouseInputEvent,
-    ::GetMouseButton,
-    ::GetMousePosition,
-    ::GetMouseClickCount
-  };
-  return &mouse_input_event_interface;
-}
-
-// static
-const PPB_MouseInputEvent* PluginInputEvent::GetMouseInterface1_1() {
-  static const PPB_MouseInputEvent mouse_input_event_interface = {
-    CreateMouseInputEvent1_1,
-    IsMouseInputEvent,
-    ::GetMouseButton,
-    ::GetMousePosition,
-    ::GetMouseClickCount,
-    ::GetMouseMovement
-  };
-  return &mouse_input_event_interface;
-}
-
-// static
-const PPB_WheelInputEvent* PluginInputEvent::GetWheelInterface() {
-  static const PPB_WheelInputEvent wheel_input_event_interface = {
-    CreateWheelInputEvent,
-    IsWheelInputEvent,
-    ::GetWheelDelta,
-    ::GetWheelTicks,
-    ::GetWheelScrollByPage
-  };
-  return &wheel_input_event_interface;
-}
-
-// static
-const PPB_KeyboardInputEvent* PluginInputEvent::GetKeyboardInterface() {
-  static const PPB_KeyboardInputEvent keyboard_input_event_interface = {
-    CreateKeyboardInputEvent,
-    IsKeyboardInputEvent,
-    ::GetKeyCode,
-    ::GetCharacterText
-  };
-  return &keyboard_input_event_interface;
-}
-
-// static
-const PPB_KeyboardInputEvent_Dev* PluginInputEvent::GetKeyboardInterface_Dev() {
-  static const PPB_KeyboardInputEvent_Dev keyboard_input_event_dev_interface = {
-    ::SetUsbKeyCode,
-    ::GetUsbKeyCode,
-  };
-  return &keyboard_input_event_dev_interface;
-}
-
-PluginInputEvent::PluginInputEvent()
-    : character_text_(PP_MakeUndefined()) {
-}
-
-void PluginInputEvent::Init(const InputEventData& input_event_data,
-                            PP_Var character_text) {
-  input_event_data_ = input_event_data;
-  character_text_ = character_text;
-}
-
-PP_InputEvent_Type PluginInputEvent::GetType() const {
-  return input_event_data_.event_type;
-}
-
-PP_TimeTicks PluginInputEvent::GetTimeStamp() const {
-  return input_event_data_.event_time_stamp;
-}
-
-uint32_t PluginInputEvent::GetModifiers() const {
-  return input_event_data_.event_modifiers;
-}
-
-PP_InputEvent_MouseButton PluginInputEvent::GetMouseButton() const {
-  return input_event_data_.mouse_button;
-}
-
-PP_Point PluginInputEvent::GetMousePosition() const {
-  return input_event_data_.mouse_position;
-}
-
-int32_t PluginInputEvent::GetMouseClickCount() const {
-  return input_event_data_.mouse_click_count;
-}
-
-PP_Point PluginInputEvent::GetMouseMovement() const {
-  return input_event_data_.mouse_movement;
-}
-
-PP_FloatPoint PluginInputEvent::GetWheelDelta() const {
-  return input_event_data_.wheel_delta;
-}
-
-PP_FloatPoint PluginInputEvent::GetWheelTicks() const {
-  return input_event_data_.wheel_ticks;
-}
-
-PP_Bool PluginInputEvent::GetWheelScrollByPage() const {
-  return input_event_data_.wheel_scroll_by_page;
-}
-
-uint32_t PluginInputEvent::GetKeyCode() const {
-  return input_event_data_.key_code;
-}
-
-PP_Var PluginInputEvent::GetCharacterText() const {
-  PPBVarInterface()->AddRef(character_text_);
-  return character_text_;
-}
-
-PP_Bool PluginInputEvent::SetUsbKeyCode(uint32_t usb_key_code) {
-  input_event_data_.usb_key_code = usb_key_code;
-  return PP_TRUE;
-}
-
-uint32_t PluginInputEvent::GetUsbKeyCode() const {
-  return input_event_data_.usb_key_code;
-}
-
-PluginInputEvent::~PluginInputEvent() {
-  // Release the character text.  This is a no-op if it's not a string.
-  PPBVarInterface()->Release(character_text_);
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h
deleted file mode 100644
index 0e6f229..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h
+++ /dev/null
@@ -1,68 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_INPUT_EVENT_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_INPUT_EVENT_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/input_event_data.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "ppapi/c/dev/ppb_keyboard_input_event_dev.h"
-#include "ppapi/c/ppb_input_event.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_InputEvent interface.
-class PluginInputEvent : public PluginResource {
- public:
-  PluginInputEvent();
-  // Init the PluginInputEvent resource with the given data. Assumes
-  // character_text has been AddRefed if it's a string, and takes ownership.
-  void Init(const InputEventData& input_event_data, PP_Var character_text);
-
-  // PluginResource implementation.
-  virtual bool InitFromBrowserResource(PP_Resource /*resource*/) {
-    return true;
-  }
-
-  static const PPB_InputEvent* GetInterface();
-  static const PPB_MouseInputEvent_1_0* GetMouseInterface1_0();
-  static const PPB_MouseInputEvent* GetMouseInterface1_1();
-  static const PPB_WheelInputEvent* GetWheelInterface();
-  static const PPB_KeyboardInputEvent* GetKeyboardInterface();
-  static const PPB_KeyboardInputEvent_Dev* GetKeyboardInterface_Dev();
-
-  PP_InputEvent_Type GetType() const;
-  PP_TimeTicks GetTimeStamp() const;
-  uint32_t GetModifiers() const;
-
-  PP_InputEvent_MouseButton GetMouseButton() const;
-  PP_Point GetMousePosition() const;
-  int32_t GetMouseClickCount() const;
-  PP_Point GetMouseMovement() const;
-
-  PP_FloatPoint GetWheelDelta() const;
-  PP_FloatPoint GetWheelTicks() const;
-  PP_Bool GetWheelScrollByPage() const;
-
-  uint32_t GetKeyCode() const;
-  PP_Var GetCharacterText() const;
-
-  PP_Bool SetUsbKeyCode(uint32_t usb_key_code);
-  uint32_t GetUsbKeyCode() const;
-
- protected:
-  virtual ~PluginInputEvent();
-
- private:
-  InputEventData input_event_data_;
-  PP_Var character_text_;  // Undefined if this is not a character event.
-
-  IMPLEMENT_RESOURCE(PluginInputEvent);
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginInputEvent);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_INPUT_EVENT_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_instance.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_instance.cc
deleted file mode 100644
index be3571a..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_instance.cc
+++ /dev/null
@@ -1,69 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_instance.h"
-
-#include <stdio.h>
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/ppb_instance.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) {
-  DebugPrintf("PPB_Instance::BindGraphics: instance=%"NACL_PRId32
-              " device=%"NACL_PRId32"\n", instance, device);
-  int32_t success = 0;
-
-  NaClSrpcError srpc_result =
-      PpbInstanceRpcClient::PPB_Instance_BindGraphics(
-          GetMainSrpcChannel(),
-          instance,
-          device,
-          &success);
-  DebugPrintf("PPB_Instance::BindGraphics: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  else
-    return PP_FALSE;
-}
-
-PP_Bool IsFullFrame(PP_Instance instance) {
-  DebugPrintf("PPB_Instance::IsFullFrame: instance=%"NACL_PRId32"\n",
-              instance);
-  int32_t is_full_frame = 0;
-
-  NaClSrpcError srpc_result =
-      PpbInstanceRpcClient::PPB_Instance_IsFullFrame(
-          GetMainSrpcChannel(),
-          instance,
-          &is_full_frame);
-  DebugPrintf("PPB_Instance::IsFullFrame: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_OK && is_full_frame)
-    return PP_TRUE;
-  else
-    return PP_FALSE;
-}
-
-}  // namespace
-
-const PPB_Instance* PluginInstance::GetInterface() {
-  static const PPB_Instance instance_interface = {
-    BindGraphics,
-    IsFullFrame
-  };
-  return &instance_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_instance.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_instance.h
deleted file mode 100644
index 740a2b7..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_instance.h
+++ /dev/null
@@ -1,24 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_INSTANCE_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_INSTANCE_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppb_instance.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_Instance interface.
-class PluginInstance {
- public:
-  static const PPB_Instance* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginInstance);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_INSTANCE_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_memory.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_memory.cc
deleted file mode 100644
index 60e2e66..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_memory.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_memory.h"
-
-#include <cstdlib>
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/dev/ppb_memory_dev.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-void* MemAlloc(uint32_t num_bytes) {
-  DebugPrintf("PPB_Memory_Dev::MemAlloc(%"NACL_PRIu32")\n", num_bytes);
-  return std::malloc(num_bytes);
-}
-
-void MemFree(void* ptr) {
-  DebugPrintf("PPB_Memory_Dev::MemFree(%p)\n", ptr);
-  std::free(ptr);
-}
-
-}  // namespace
-
-const PPB_Memory_Dev* PluginMemory::GetInterface() {
-  static const PPB_Memory_Dev memory_interface = {
-    MemAlloc,
-    MemFree
-  };
-  return &memory_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_memory.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_memory.h
deleted file mode 100644
index 94db347..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_memory.h
+++ /dev/null
@@ -1,25 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MEMORY_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MEMORY_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/dev/ppb_memory_dev.h"
-
-namespace ppapi_proxy {
-
-// Implements the plugin side of the PPB_Memory_Dev interface.
-class PluginMemory {
- public:
-  // Returns an interface pointer suitable to the PPAPI client.
-  static const PPB_Memory_Dev* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginMemory);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MEMORY_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.cc
deleted file mode 100644
index 4395297..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.cc
+++ /dev/null
@@ -1,49 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.h"
-
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_var.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-void PostMessage(PP_Instance instance, struct PP_Var message) {
-  DebugPrintf("PPB_Messaging::PostMessage: instance=%"NACL_PRId32"\n",
-              instance);
-  if (!ppapi_proxy::PPBCoreInterface()->IsMainThread())
-    return;  // Only supported on main thread.
-
-  uint32_t message_length = 0;
-  nacl::scoped_array<char> message_bytes(Serialize(&message, 1,
-                                                   &message_length));
-  NaClSrpcError srpc_result =
-      PpbMessagingRpcClient::PPB_Messaging_PostMessage(
-          GetMainSrpcChannel(),
-          instance,
-          message_length,
-          message_bytes.get());
-  DebugPrintf("PPB_Messaging::PostMessage: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-}  // namespace
-
-const PPB_Messaging* PluginMessaging::GetInterface() {
-  static const PPB_Messaging  messaging_interface = {
-    PostMessage
-  };
-  return &messaging_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.h
deleted file mode 100644
index 96f3c22..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MESSAGING_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MESSAGING_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppb_messaging.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_Messaging interface.
-class PluginMessaging {
- public:
-  static const PPB_Messaging* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginMessaging);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MESSAGING_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.cc
deleted file mode 100644
index 76a2185..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.cc
+++ /dev/null
@@ -1,58 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.h"
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_mouse_cursor.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-const nacl_abi_size_t kPPPointBytes =
-    static_cast<nacl_abi_size_t>(sizeof(struct PP_Point));
-
-PP_Bool SetCursor(PP_Instance instance,
-                  enum PP_MouseCursor_Type type,
-                  PP_Resource custom_image,
-                  const struct PP_Point* hot_spot) {
-  DebugPrintf("PPB_MouseCursor::SetCursor: "
-              "instance=%"NACL_PRId32"\n", instance);
-
-  int32_t hot_spot_size = (hot_spot != NULL) ? kPPPointBytes : 0;
-  int32_t success = 0;
-  NaClSrpcError srpc_result =
-      PpbMouseCursorRpcClient::PPB_MouseCursor_SetCursor(
-          GetMainSrpcChannel(),
-          instance,
-          type,
-          custom_image,
-          hot_spot_size,
-          reinterpret_cast<char*>(const_cast<struct PP_Point*>(hot_spot)),
-          &success);
-
-  DebugPrintf("PPB_MouseCursor::SetCursor: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-}  // namespace
-
-const PPB_MouseCursor_1_0* PluginMouseCursor::GetInterface() {
-  static const PPB_MouseCursor mouse_cursor_interface = {
-    SetCursor,
-  };
-  return &mouse_cursor_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.h
deleted file mode 100644
index 490a8d4..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MOUSE_CURSOR_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MOUSE_CURSOR_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppb_mouse_cursor.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_MouseCursor interface.
-class PluginMouseCursor {
- public:
-  PluginMouseCursor();
-  static const PPB_MouseCursor_1_0* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginMouseCursor);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MOUSE_CURSOR_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.cc
deleted file mode 100644
index 2e2644a..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.cc
+++ /dev/null
@@ -1,68 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.h"
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_mouse_lock.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-int32_t LockMouse(PP_Instance instance, PP_CompletionCallback callback) {
-  DebugPrintf("PPB_MouseLock::LockMouse: "
-              "instance=%"NACL_PRId32"\n", instance);
-
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)
-    return PP_ERROR_BADARGUMENT;
-
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result =
-      PpbMouseLockRpcClient::PPB_MouseLock_LockMouse(
-          GetMainSrpcChannel(),
-          instance,
-          callback_id,
-          &pp_error);
-
-  DebugPrintf("PPB_MouseLock::LockMouse: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-void UnlockMouse(PP_Instance instance) {
-  DebugPrintf("PPB_MouseLock::UnlockMouse: "
-              "instance=%"NACL_PRId32"\n", instance);
-
-  NaClSrpcError srpc_result =
-      PpbMouseLockRpcClient::PPB_MouseLock_UnlockMouse(
-          GetMainSrpcChannel(),
-          instance);
-
-  DebugPrintf("PPB_MouseLock::UnlockMouse: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-}  // namespace
-
-const PPB_MouseLock* PluginMouseLock::GetInterface() {
-  static const PPB_MouseLock mouse_lock_interface = {
-    LockMouse,
-    UnlockMouse
-  };
-  return &mouse_lock_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.h
deleted file mode 100644
index cd54e01..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MOUSE_LOCK_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MOUSE_LOCK_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppb_mouse_lock.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_MouseLock interface.
-class PluginMouseLock {
- public:
-  PluginMouseLock();
-  static const PPB_MouseLock* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginMouseLock);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MOUSE_LOCK_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_net_address_private.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_net_address_private.cc
deleted file mode 100644
index 7bee171..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_net_address_private.cc
+++ /dev/null
@@ -1,345 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_net_address_private.h"
-
-#include <cstddef>
-#include <new>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_var.h"
-#include "ppapi/c/private/ppb_net_address_private.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Bool AreEqual(const PP_NetAddress_Private* addr1,
-                 const PP_NetAddress_Private* addr2) {
-  DebugPrintf("PPB_NetAddress_Private::AreEqual\n");
-
-  char* const raw_addr1 =
-      reinterpret_cast<char*>(const_cast<PP_NetAddress_Private*>(addr1));
-  char* const raw_addr2 =
-      reinterpret_cast<char*>(const_cast<PP_NetAddress_Private*>(addr2));
-
-  int32_t equals;
-  NaClSrpcError srpc_result =
-      PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_AreEqual(
-          GetMainSrpcChannel(),
-          static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)),
-          raw_addr1,
-          static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)),
-          raw_addr2,
-          &equals);
-
-  DebugPrintf("PPB_NetAddress_Private::AreEqual: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && equals)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-PP_Bool AreHostsEqual(const PP_NetAddress_Private* addr1,
-                      const PP_NetAddress_Private* addr2) {
-  DebugPrintf("PPB_NetAddress_Private::AreHostsEqual\n");
-
-  char* const raw_addr1 =
-      reinterpret_cast<char*>(const_cast<PP_NetAddress_Private*>(addr1));
-  char* const raw_addr2 =
-      reinterpret_cast<char*>(const_cast<PP_NetAddress_Private*>(addr2));
-
-  int32_t equals;
-  NaClSrpcError srpc_result =
-      PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_AreHostsEqual(
-          GetMainSrpcChannel(),
-          static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)),
-          raw_addr1,
-          static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)),
-          raw_addr2,
-          &equals);
-
-  DebugPrintf("PPB_NetAddress_Private::AreHostsEqual: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && equals)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-PP_Var Describe(PP_Module module,
-                const PP_NetAddress_Private* addr,
-                PP_Bool include_port) {
-  DebugPrintf("PP_NetAddress_Private::Describe: module=%"NACL_PRId32"\n",
-              module);
-
-  char* const raw_addr =
-      reinterpret_cast<char*>(const_cast<PP_NetAddress_Private*>(addr));
-  nacl_abi_size_t description_size = kMaxReturnVarSize;
-  nacl::scoped_array<char> description_bytes(
-      new (std::nothrow) char[description_size]);
-  if (description_bytes.get() == NULL)
-    return PP_MakeUndefined();
-
-  NaClSrpcError srpc_result =
-      PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_Describe(
-          GetMainSrpcChannel(),
-          module,
-          static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)), raw_addr,
-          include_port,
-          &description_size, description_bytes.get());
-
-  PP_Var description = PP_MakeUndefined();
-  if (srpc_result == NACL_SRPC_RESULT_OK) {
-    (void) DeserializeTo(description_bytes.get(), description_size, 1,
-                         &description);
-  }
-
-  DebugPrintf("PPB_NetAddressPrivate::Describe: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  return description;
-}
-
-PP_Bool ReplacePort(const PP_NetAddress_Private* src_addr,
-                    uint16_t port,
-                    PP_NetAddress_Private* dst_addr) {
-  DebugPrintf("PPB_NetAddressPrivate::ReplacePort\n");
-
-  char* const raw_src_addr =
-      reinterpret_cast<char*>(const_cast<PP_NetAddress_Private*>(src_addr));
-  nacl_abi_size_t dst_bytes =
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private));
-  char* const raw_dst_addr =
-      reinterpret_cast<char*>(const_cast<PP_NetAddress_Private*>(dst_addr));
-
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_ReplacePort(
-          GetMainSrpcChannel(),
-          static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)),
-          raw_src_addr,
-          port,
-          &dst_bytes, raw_dst_addr,
-          &success);
-
-  DebugPrintf("PPB_NetAddress_Private::ReplacePort: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-void GetAnyAddress(PP_Bool is_ipv6, PP_NetAddress_Private* addr) {
-  DebugPrintf("PPB_NetAddress_Private::GetAnyAddress\n");
-
-  nacl_abi_size_t addr_bytes =
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private));
-  char* const raw_addr =
-      reinterpret_cast<char*>(const_cast<PP_NetAddress_Private*>(addr));
-
-  NaClSrpcError srpc_result =
-      PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_GetAnyAddress(
-          GetMainSrpcChannel(),
-          is_ipv6,
-          &addr_bytes, raw_addr);
-
-  DebugPrintf("PPB_NetAddress_Private::GetAnyAddress: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-PP_NetAddressFamily_Private GetFamily(const PP_NetAddress_Private* addr) {
-  DebugPrintf("PPB_NetAddress_Private::GetFamily\n");
-
-  nacl_abi_size_t addr_bytes =
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private));
-  char* const raw_addr =
-      reinterpret_cast<char*>(const_cast<PP_NetAddress_Private*>(addr));
-
-  int32_t addr_family = PP_NETADDRESSFAMILY_UNSPECIFIED;
-  NaClSrpcError srpc_result =
-      PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_GetFamily(
-          GetMainSrpcChannel(),
-          addr_bytes, raw_addr,
-          &addr_family);
-
-  DebugPrintf("PPB_NetAddress_Private::GetFamily: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return static_cast<PP_NetAddressFamily_Private>(addr_family);
-  return PP_NETADDRESSFAMILY_UNSPECIFIED;
-}
-
-uint16_t GetPort(const PP_NetAddress_Private* addr) {
-  DebugPrintf("PPB_NetAddress_Private::GetPort\n");
-
-  nacl_abi_size_t addr_bytes =
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private));
-  char* const raw_addr =
-      reinterpret_cast<char*>(const_cast<PP_NetAddress_Private*>(addr));
-  int32_t port;
-
-  NaClSrpcError srpc_result =
-      PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_GetPort(
-          GetMainSrpcChannel(),
-          addr_bytes, raw_addr,
-          &port);
-
-  DebugPrintf("PPB_NetAddress_Private::GetPort: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  return static_cast<uint16_t>(static_cast<uint32_t>(port));
-}
-
-PP_Bool GetAddress(const PP_NetAddress_Private* addr,
-                   void* address,
-                   uint16_t address_size) {
-  DebugPrintf("PP_NetAddress_Private::GetAddress");
-
-  int32_t success = 0;
-  char* const raw_addr =
-      reinterpret_cast<char*>(const_cast<PP_NetAddress_Private*>(addr));
-  nacl_abi_size_t address_bytes_size = address_size;
-  NaClSrpcError srpc_result =
-      PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_GetAddress(
-          GetMainSrpcChannel(),
-          static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)), raw_addr,
-          &address_bytes_size, static_cast<char*>(address),
-          &success);
-
-  DebugPrintf("PPB_NetAddressPrivate::GetAddress: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-uint32_t GetScopeID(const PP_NetAddress_Private* addr) {
-  DebugPrintf("PPB_NetAddress_Private::GetScopeID\n");
-
-  nacl_abi_size_t addr_bytes =
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private));
-  char* const raw_addr =
-      reinterpret_cast<char*>(const_cast<PP_NetAddress_Private*>(addr));
-  int32_t scope_id;
-
-  NaClSrpcError srpc_result =
-      PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_GetScopeID(
-          GetMainSrpcChannel(),
-          addr_bytes,
-          raw_addr, &scope_id);
-
-  DebugPrintf("PPB_NetAddress_Private::GetScopeID: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  return static_cast<uint32_t>(scope_id);
-}
-
-void CreateFromIPv4Address(const uint8_t ip[4],
-                           uint16_t port,
-                           struct PP_NetAddress_Private* addr) {
-  DebugPrintf("PPB_NetAddress_Private::CreateFromIPv4Address\n");
-
-  char* raw_ip = reinterpret_cast<char*>(const_cast<uint8_t*>(ip));
-
-  nacl_abi_size_t addr_bytes =
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private));
-  char* const raw_addr =
-      reinterpret_cast<char*>(const_cast<PP_NetAddress_Private*>(addr));
-
-  NaClSrpcError srpc_result =
-      PpbNetAddressPrivateRpcClient::
-      PPB_NetAddress_Private_CreateFromIPv4Address(
-          GetMainSrpcChannel(),
-          4, raw_ip, port,
-          &addr_bytes, raw_addr);
-
-  DebugPrintf("PPB_NetAddress_Private::CreateFromIPv4Address: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-void CreateFromIPv6Address(const uint8_t ip[16],
-                           uint32_t scope_id,
-                           uint16_t port,
-                           struct PP_NetAddress_Private* addr) {
-  DebugPrintf("PPB_NetAddress_Private::CreateFromIPv6Address\n");
-
-  char* raw_ip = reinterpret_cast<char*>(const_cast<uint8_t*>(ip));
-
-  nacl_abi_size_t addr_bytes =
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private));
-  char* const raw_addr =
-      reinterpret_cast<char*>(const_cast<PP_NetAddress_Private*>(addr));
-
-  NaClSrpcError srpc_result =
-      PpbNetAddressPrivateRpcClient::
-      PPB_NetAddress_Private_CreateFromIPv6Address(
-          GetMainSrpcChannel(),
-          16, raw_ip, scope_id, port,
-          &addr_bytes, raw_addr);
-
-  DebugPrintf("PPB_NetAddress_Private::CreateFromIPv6Address: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-}  // namespace
-
-// static
-const PPB_NetAddress_Private_0_1* PluginNetAddressPrivate::GetInterface0_1() {
-  static const PPB_NetAddress_Private_0_1 netaddress_private_interface = {
-    AreEqual,
-    AreHostsEqual,
-    Describe,
-    ReplacePort,
-    GetAnyAddress
-  };
-  return &netaddress_private_interface;
-}
-
-// static
-const PPB_NetAddress_Private_1_0* PluginNetAddressPrivate::GetInterface1_0() {
-  static const PPB_NetAddress_Private_1_0 netaddress_private_interface = {
-    AreEqual,
-    AreHostsEqual,
-    Describe,
-    ReplacePort,
-    GetAnyAddress,
-    GetFamily,
-    GetPort,
-    GetAddress
-  };
-  return &netaddress_private_interface;
-}
-
-// static
-const PPB_NetAddress_Private_1_1* PluginNetAddressPrivate::GetInterface1_1() {
-  static const PPB_NetAddress_Private_1_1 netaddress_private_interface = {
-    AreEqual,
-    AreHostsEqual,
-    Describe,
-    ReplacePort,
-    GetAnyAddress,
-    GetFamily,
-    GetPort,
-    GetAddress,
-    GetScopeID,
-    CreateFromIPv4Address,
-    CreateFromIPv6Address
-  };
-  return &netaddress_private_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_net_address_private.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_net_address_private.h
deleted file mode 100644
index 98d5eeb..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_net_address_private.h
+++ /dev/null
@@ -1,26 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_NET_ADDRESS_PRIVATE_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_NET_ADDRESS_PRIVATE_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/private/ppb_net_address_private.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_NetAddress_Private interface.
-class PluginNetAddressPrivate {
- public:
-  static const PPB_NetAddress_Private_0_1* GetInterface0_1();
-  static const PPB_NetAddress_Private_1_0* GetInterface1_0();
-  static const PPB_NetAddress_Private_1_1* GetInterface1_1();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginNetAddressPrivate);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_NET_ADDRESS_PRIVATE_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_network_list_private.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_network_list_private.cc
deleted file mode 100644
index f4b7810..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_network_list_private.cc
+++ /dev/null
@@ -1,208 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_network_list_private.h"
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/private/ppb_network_list_private.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Bool IsNetworkList(PP_Resource resource) {
-  DebugPrintf("PPB_NetworkList_Private::IsNetworkList: "
-              "resource=%"NACL_PRId32"\n", resource);
-
-  int32_t is_network_list;
-  NaClSrpcError srpc_result = PpbNetworkListPrivateClient::
-      PPB_NetworkList_Private_IsNetworkList(
-          GetMainSrpcChannel(), resource, &is_network_list);
-
-  DebugPrintf("PPB_NetworkList_Private::IsNetworkList: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    return PP_FALSE;
-
-  return PP_FromBool(is_network_list);
-}
-
-uint32_t GetCount(PP_Resource resource) {
-  DebugPrintf("PPB_NetworkList_Private::GetCount: "
-              "resource=%"NACL_PRId32"\n", resource);
-
-  int32_t count;
-  NaClSrpcError srpc_result = PpbNetworkListPrivateClient::
-      PPB_NetworkList_Private_GetCount(
-          GetMainSrpcChannel(), resource, &count);
-
-  DebugPrintf("PPB_NetworkList_Private::GetCount: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    return 0;
-
-  return count;
-}
-
-struct PP_Var GetName(PP_Resource resource, uint32_t index) {
-  DebugPrintf("PPB_NetworkList_Private::GetName:"
-              " resource=%"NACL_PRId32" index=%"NACL_PRId32"\n",
-              resource, index);
-
-  nacl_abi_size_t name_size = kMaxReturnVarSize;
-  nacl::scoped_array<char> name_bytes(new char[name_size]);
-  if (name_bytes.get() == NULL)
-    return PP_MakeUndefined();
-
-  NaClSrpcError srpc_result = PpbNetworkListPrivateClient::
-      PPB_NetworkList_Private_GetName(
-          GetMainSrpcChannel(), resource, index,
-          &name_size, name_bytes.get());
-
-  struct PP_Var name = PP_MakeUndefined();
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    DeserializeTo(name_bytes.get(), name_size, 1, &name);
-
-  DebugPrintf("PPB_NetworkList_Private::GetName: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  return name;
-}
-
-PP_NetworkListType_Private GetType(PP_Resource resource, uint32_t index) {
-  DebugPrintf("PPB_NetworkList_Private::GetType:"
-              " resource=%"NACL_PRId32" index=%"NACL_PRId32"\n",
-              resource, index);
-
-  int32_t type;
-  NaClSrpcError srpc_result = PpbNetworkListPrivateClient::
-      PPB_NetworkList_Private_GetType(
-          GetMainSrpcChannel(), resource, index, &type);
-
-  DebugPrintf("PPB_NetworkList_Private::GetType: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return PP_NETWORKLIST_UNKNOWN;
-
-  return static_cast<PP_NetworkListType_Private>(type);
-}
-
-PP_NetworkListState_Private GetState(PP_Resource resource, uint32_t index) {
-  DebugPrintf("PPB_NetworkList_Private::GetState:"
-              " resource=%"NACL_PRId32" index=%"NACL_PRId32"\n",
-              resource, index);
-
-  int32_t state;
-  NaClSrpcError srpc_result = PpbNetworkListPrivateClient::
-      PPB_NetworkList_Private_GetState(
-          GetMainSrpcChannel(), resource, index, &state);
-
-  DebugPrintf("PPB_NetworkList_Private::GetState: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return PP_NETWORKLIST_DOWN;
-
-  return static_cast<PP_NetworkListState_Private>(state);
-}
-
-int32_t GetIpAddresses(PP_Resource resource,
-                      uint32_t index,
-                      PP_NetAddress_Private addresses[],
-                      uint32_t count) {
-  DebugPrintf("PPB_NetworkList_Private::GetIpAddresses:"
-              " resource=%"NACL_PRId32" index=%"NACL_PRId32"\n",
-              resource, index);
-
-  nacl_abi_size_t addr_size = count * sizeof(PP_NetAddress_Private);
-  int32_t addr_count;
-  NaClSrpcError srpc_result = PpbNetworkListPrivateClient::
-      PPB_NetworkList_Private_GetIpAddresses(
-          GetMainSrpcChannel(), resource, index,
-          &addr_size, reinterpret_cast<char*>(addresses),
-          &addr_count);
-
-  DebugPrintf("PPB_NetworkList_Private::GetIpAddresses: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  DCHECK(static_cast<uint32_t>(addr_count) > count ||
-         addr_count * sizeof(PP_NetAddress_Private) == addr_size);
-
-  return addr_count;
-}
-
-struct PP_Var GetDisplayName(PP_Resource resource, uint32_t index) {
-  DebugPrintf("PPB_NetworkList_Private::GetDisplayName:"
-              " resource=%"NACL_PRId32" index=%"NACL_PRId32"\n",
-              resource, index);
-
-  nacl_abi_size_t name_size = kMaxReturnVarSize;
-  nacl::scoped_array<char> name_bytes(new char[name_size]);
-  if (name_bytes.get() == NULL)
-    return PP_MakeUndefined();
-
-  NaClSrpcError srpc_result = PpbNetworkListPrivateClient::
-      PPB_NetworkList_Private_GetDisplayName(
-          GetMainSrpcChannel(), resource, index,
-          &name_size, name_bytes.get());
-
-  struct PP_Var name = PP_MakeUndefined();
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    DeserializeTo(name_bytes.get(), name_size, 1, &name);
-
-  DebugPrintf("PPB_NetworkList_Private::GetDisplayName: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  return name;
-}
-
-uint32_t GetMTU(PP_Resource resource, uint32_t index) {
-  DebugPrintf("PPB_NetworkList_Private::GetMTU:"
-              " resource=%"NACL_PRId32" index=%"NACL_PRId32"\n",
-              resource, index);
-
-  int32_t mtu;
-  NaClSrpcError srpc_result = PpbNetworkListPrivateClient::
-      PPB_NetworkList_Private_GetMTU(
-          GetMainSrpcChannel(), resource, index, &mtu);
-
-  DebugPrintf("PPB_NetworkList_Private::GetMTU: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return PP_NETWORKLIST_UNKNOWN;
-
-  return mtu;
-}
-
-}  // namespace
-
-const PPB_NetworkList_Private* PluginNetworkListPrivate::GetInterface() {
-  static const PPB_NetworkList_Private networklist_private_interface = {
-    IsNetworkList,
-    GetCount,
-    GetName,
-    GetType,
-    GetState,
-    GetIpAddresses,
-    GetDisplayName,
-    GetMTU,
-  };
-  return &networklist_private_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_network_list_private.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_network_list_private.h
deleted file mode 100644
index de6e4d3..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_network_list_private.h
+++ /dev/null
@@ -1,24 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_NETWORK_LIST_PRIVATE_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_NETWORK_LIST_PRIVATE_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/private/ppb_network_list_private.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_NetworkList_Private interface.
-class PluginNetworkListPrivate {
- public:
-  static const PPB_NetworkList_Private* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginNetworkListPrivate);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_NETWORK_LIST_PRIVATE_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_network_monitor_private.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_network_monitor_private.cc
deleted file mode 100644
index eb891f7..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_network_monitor_private.cc
+++ /dev/null
@@ -1,128 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_network_monitor_private.h"
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/private/ppb_network_monitor_private.h"
-#include "srpcgen/ppb_rpc.h"
-#include "srpcgen/ppp_rpc.h"
-
-namespace ppapi_proxy {
-
-PluginNetworkMonitorPrivate::PluginNetworkMonitorPrivate()
-    : network_list_callback_(NULL),
-      user_data_(NULL) {
-}
-
-PluginNetworkMonitorPrivate::~PluginNetworkMonitorPrivate() {
-}
-
-void PluginNetworkMonitorPrivate::OnNetworkListChanged(
-    PP_Resource list_resource) {
-  DCHECK(network_list_callback_);
-  network_list_callback_(user_data_, list_resource);
-}
-
-
-namespace {
-
-PP_Resource Create(PP_Instance instance_id,
-                   PPB_NetworkMonitor_Callback callback,
-                   void* user_data) {
-  DebugPrintf("PPB_NetworkMonitor_Private::Create: "
-              "instance_id=%"NACL_PRId32"\n", instance_id);
-
-  if (NULL == callback)
-    return kInvalidResourceId;
-
-  PP_Resource resource;
-  NaClSrpcError srpc_result =
-      PpbNetworkMonitorPrivateClient::PPB_NetworkMonitor_Private_Create(
-          GetMainSrpcChannel(), instance_id, &resource);
-
-  DebugPrintf("PPB_NetworkMonitor_Private::Create: %d %s\n",
-              resource, NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    return kInvalidResourceId;
-
-  scoped_refptr<PluginNetworkMonitorPrivate> network_monitor =
-      PluginResource::AdoptAs<PluginNetworkMonitorPrivate>(resource);
-  if (!network_monitor.get())
-    return kInvalidResourceId;
-
-  network_monitor->set_callback(callback, user_data);
-
-  return resource;
-}
-
-PP_Bool IsNetworkMonitor(PP_Resource resource_id) {
-  DebugPrintf("PPB_NetworkMonitor_Private::IsNetworkMonitor: "
-              "resource_id=%"NACL_PRId32"\n", resource_id);
-
-  int32_t is_network_monitor;
-  NaClSrpcError srpc_result = PpbNetworkMonitorPrivateClient::
-      PPB_NetworkMonitor_Private_IsNetworkMonitor(
-          GetMainSrpcChannel(), resource_id, &is_network_monitor);
-
-  DebugPrintf("PPB_NetworkMonitor_Private::IsNetworkMonitor: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    return PP_FALSE;
-
-  return PP_FromBool(is_network_monitor);
-}
-
-}  // namespace
-
-const PPB_NetworkMonitor_Private*
-PluginNetworkMonitorPrivate::GetInterface() {
-  static const PPB_NetworkMonitor_Private networkmonitor_private_interface = {
-    Create,
-    IsNetworkMonitor,
-  };
-  return &networkmonitor_private_interface;
-}
-
-bool PluginNetworkMonitorPrivate::InitFromBrowserResource(
-    PP_Resource resource) {
-  DebugPrintf("PluginNetworkMonitorPrivate::InitFromBrowserResource: "
-              "resource=%"NACL_PRId32"\n", resource);
-  resource_ = resource;
-  return true;
-}
-
-}  // namespace ppapi_proxy
-
-void
-PppNetworkMonitorPrivateRpcServer::
-PPP_NetworkMonitor_Private_NetworkListChanged(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Resource network_monitor_id,
-    PP_Resource network_list) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_OK;
-  ppapi_proxy::DebugPrintf(
-      "PPP_NetworkMonitor_Private::NetworkListChanged: "
-      "network_monitor_id=%"NACL_PRId32" network_list=%"NACL_PRId32"\n",
-      network_monitor_id, network_list);
-  scoped_refptr<ppapi_proxy::PluginNetworkMonitorPrivate> network_monitor =
-      ppapi_proxy::PluginResource::
-      GetAs<ppapi_proxy::PluginNetworkMonitorPrivate>(network_monitor_id);
-
-  if (!network_monitor.get())
-    return;
-
-  network_monitor->OnNetworkListChanged(network_list);
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_network_monitor_private.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_network_monitor_private.h
deleted file mode 100644
index 75396f1..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_network_monitor_private.h
+++ /dev/null
@@ -1,49 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_NETWORK_MONITOR_PRIVATE_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_NETWORK_MONITOR_PRIVATE_H_
-
-#include <pthread.h>
-#include "native_client/src/include/nacl_base.h"
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/include/ref_counted.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/private/ppb_network_monitor_private.h"
-
-namespace ppapi_proxy {
-
-class PluginNetworkMonitorPrivate : public PluginResource {
- public:
-  PluginNetworkMonitorPrivate();
-
-  void set_callback(PPB_NetworkMonitor_Callback network_list_callback,
-                    void* user_data) {
-    network_list_callback_ = network_list_callback;
-    user_data_ = user_data;
-  }
-
-  void OnNetworkListChanged(PP_Resource list_resource);
-
-  static const PPB_NetworkMonitor_Private* GetInterface();
-  virtual bool InitFromBrowserResource(PP_Resource resource);
-
- protected:
-  virtual ~PluginNetworkMonitorPrivate();
-
- private:
-  PP_Resource resource_;
-  PPB_NetworkMonitor_Callback network_list_callback_;
-  void* user_data_;
-
-  IMPLEMENT_RESOURCE(PluginNetworkMonitorPrivate);
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginNetworkMonitorPrivate);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_NETWORK_MONITOR_PRIVATE_H_AUDIO_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_server_socket_private.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_server_socket_private.cc
deleted file mode 100644
index c699425..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_server_socket_private.cc
+++ /dev/null
@@ -1,143 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_server_socket_private.h"
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/private/ppb_tcp_server_socket_private.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Resource Create(PP_Instance instance) {
-  DebugPrintf("PPB_TCPServerSocketPrivate::Create: "    \
-              "instance=%"NACL_PRId32"\n", instance);
-
-  PP_Resource resource;
-  NaClSrpcError srpc_result =
-      PpbTCPServerSocketPrivateRpcClient::PPB_TCPServerSocket_Private_Create(
-          GetMainSrpcChannel(),
-          instance,
-          &resource);
-
-  DebugPrintf("PPB_TCPServerSocketPrivate::Create: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    return kInvalidResourceId;
-  return resource;
-}
-
-PP_Bool IsTCPServerSocket(PP_Resource resource) {
-  DebugPrintf("PPB_TCPServerSocketPrivate::IsTCPServerSocket: " \
-              "resource=%"NACL_PRId32"\n", resource);
-
-  int32_t is_tcp_server_socket;
-  NaClSrpcError srpc_result =
-      PpbTCPServerSocketPrivateRpcClient::
-      PPB_TCPServerSocket_Private_IsTCPServerSocket(
-          GetMainSrpcChannel(), resource, &is_tcp_server_socket);
-
-  DebugPrintf("PPB_TCPServerSocket_Private::IsTCPServerSocket: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && is_tcp_server_socket)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-int32_t Listen(PP_Resource tcp_server_socket,
-               const PP_NetAddress_Private* addr,
-               int32_t backlog,
-               PP_CompletionCallback callback) {
-  DebugPrintf("PPB_TCPServerSocket_Private::Listen: " \
-              "tcp_server_socket=%"NACL_PRId32"\n", tcp_server_socket);
-
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result =
-      PpbTCPServerSocketPrivateRpcClient::PPB_TCPServerSocket_Private_Listen(
-          GetMainSrpcChannel(),
-          tcp_server_socket,
-          static_cast<nacl_abi_size_t>(sizeof(*addr)),
-          reinterpret_cast<char*>(const_cast<PP_NetAddress_Private*>(addr)),
-          backlog,
-          callback_id,
-          &pp_error);
-
-  DebugPrintf("PPB_TCPServerSocket_Private::Listen: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-int32_t Accept(PP_Resource tcp_server_socket,
-               PP_Resource* tcp_socket,
-               PP_CompletionCallback callback) {
-  DebugPrintf("PPB_TCPServerSocket_Private::Listen: " \
-              "tcp_server_socket=%"NACL_PRId32"\n", tcp_server_socket);
-
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback,
-                                                                    tcp_socket);
-  if (callback_id == 0)
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error;
-  NaClSrpcError srpc_result =
-      PpbTCPServerSocketPrivateRpcClient::PPB_TCPServerSocket_Private_Accept(
-          GetMainSrpcChannel(),
-          tcp_server_socket,
-          callback_id,
-          tcp_socket,
-          &pp_error);
-
-  DebugPrintf("PPB_TCPServerSocket_Private::Accept: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-void StopListening(PP_Resource tcp_server_socket) {
-  DebugPrintf("PPB_TCPServerSocket_Private::StopListening: " \
-              "tcp_server_socket="NACL_PRId32"\n", tcp_server_socket);
-
-  NaClSrpcError srpc_result =
-      PpbTCPServerSocketPrivateRpcClient::
-      PPB_TCPServerSocket_Private_StopListening(
-          GetMainSrpcChannel(), tcp_server_socket);
-
-  DebugPrintf("PPB_TCPServerSocket_Private::Disconnect: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-}  // namespace
-
-const PPB_TCPServerSocket_Private*
-  PluginTCPServerSocketPrivate::GetInterface() {
-  static const PPB_TCPServerSocket_Private tcpserversocket_private_interface = {
-    Create,
-    IsTCPServerSocket,
-    Listen,
-    Accept,
-    StopListening,
-  };
-  return &tcpserversocket_private_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_server_socket_private.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_server_socket_private.h
deleted file mode 100644
index c3bba0a..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_server_socket_private.h
+++ /dev/null
@@ -1,24 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_TCP_SERVER_SOCKET_PRIVATE_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_TCP_SERVER_SOCKET_PRIVATE_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/private/ppb_tcp_server_socket_private.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_TCPServerSocket_Private interface.
-class PluginTCPServerSocketPrivate {
- public:
-  static const PPB_TCPServerSocket_Private* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginTCPServerSocketPrivate);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_TCP_SERVER_SOCKET_PRIVATE_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_socket_private.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_socket_private.cc
deleted file mode 100644
index 3d745be..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_socket_private.cc
+++ /dev/null
@@ -1,324 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_socket_private.h"
-
-#include <string.h>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/private/ppb_tcp_socket_private.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Resource Create(PP_Instance instance) {
-  DebugPrintf("PPB_TCPSocket_Private::Create: instance=%"NACL_PRId32"\n",
-              instance);
-
-  PP_Resource resource;
-  NaClSrpcError srpc_result =
-      PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_Create(
-          GetMainSrpcChannel(), instance, &resource);
-
-  DebugPrintf("PPB_TCPSocket_Private::Create: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return resource;
-  else
-    return kInvalidResourceId;
-}
-
-PP_Bool IsTCPSocket(PP_Resource resource) {
-  DebugPrintf("PPB_TCPSocket_Private::IsTCPSocket: "
-              "resource=%"NACL_PRId32"\n", resource);
-
-  int32_t is_tcp_socket;
-  NaClSrpcError srpc_result =
-      PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_IsTCPSocket(
-          GetMainSrpcChannel(), resource, &is_tcp_socket);
-
-  DebugPrintf("PPB_TCPSocket_Private::IsTCPSocket: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && is_tcp_socket)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-int32_t Connect(PP_Resource tcp_socket, const char* host, uint16_t port,
-                struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_TCPSocket_Private::Connect: tcp_socket=%"NACL_PRId32", "
-              "host=%s, port=%"NACL_PRIu16"\n", tcp_socket, host, port);
-
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result =
-      PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_Connect(
-          GetMainSrpcChannel(),
-          tcp_socket,
-          const_cast<char*>(host),
-          static_cast<int32_t>(port),
-          callback_id,
-          &pp_error);
-
-  DebugPrintf("PPB_TCPSocket_Private::Connect: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-int32_t ConnectWithNetAddress(PP_Resource tcp_socket,
-                              const struct PP_NetAddress_Private* addr,
-                              struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_TCPSocket_Private::ConnectWithNetAddress: "
-              "tcp_socket=%"NACL_PRId32"\n", tcp_socket);
-
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  char* const raw_addr =
-      reinterpret_cast<char*>(const_cast<struct PP_NetAddress_Private*>(addr));
-
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result =
-      PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_ConnectWithNetAddress(
-          GetMainSrpcChannel(),
-          tcp_socket,
-          static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)), raw_addr,
-          callback_id,
-          &pp_error);
-
-  DebugPrintf("PPB_TCPSocket_Private::ConnectWithNetAddress: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-PP_Bool GetLocalAddress(PP_Resource tcp_socket,
-                        struct PP_NetAddress_Private* local_addr) {
-  DebugPrintf("PPB_TCPSocket_Private::GetLocalAddress: "
-              "tcp_socket=%"NACL_PRId32"\n", tcp_socket);
-
-  nacl_abi_size_t local_addr_bytes =
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private));
-
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_GetLocalAddress(
-          GetMainSrpcChannel(),
-          tcp_socket,
-          &local_addr_bytes,
-          reinterpret_cast<char*>(local_addr),
-          &success);
-
-  DebugPrintf("PPB_TCPSocket_Private::GetLocalAddress: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-PP_Bool GetRemoteAddress(PP_Resource tcp_socket,
-                         struct PP_NetAddress_Private* remote_addr) {
-  DebugPrintf("PPB_TCPSocket_Private::GetRemoteAddress: "
-              "tcp_socket=%"NACL_PRId32"\n", tcp_socket);
-
-  nacl_abi_size_t remote_addr_bytes =
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private));
-
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_GetRemoteAddress(
-          GetMainSrpcChannel(),
-          tcp_socket,
-          &remote_addr_bytes,
-          reinterpret_cast<char*>(remote_addr),
-          &success);
-
-  DebugPrintf("PPB_TCPSocket_Private::GetRemoteAddress: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-int32_t SSLHandshake(PP_Resource tcp_socket,
-                     const char* server_name,
-                     uint16_t server_port,
-                     struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_TCPSocket_Private::SSLHandshake: "
-              "tcp_socket=%"NACL_PRId32", "
-              "server_name=%s, server_port=%"NACL_PRIu16"\n",
-              tcp_socket, server_name, server_port);
-
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result =
-      PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_SSLHandshake(
-          GetMainSrpcChannel(),
-          tcp_socket,
-          const_cast<char*>(server_name),
-          static_cast<int32_t>(server_port),
-          callback_id,
-          &pp_error);
-
-  DebugPrintf("PPB_TCPSocket_Private::SSLHandshake: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-PP_Resource GetServerCertificate(PP_Resource tcp_socket) {
-  // TODO(raymes): Not implemented.
-  return 0;
-}
-
-PP_Bool AddChainBuildingCertificate(PP_Resource tcp_socket,
-                                    PP_Resource certificate,
-                                    PP_Bool is_trusted) {
-  // TODO(raymes): Not implemented.
-  return PP_FALSE;
-}
-
-int32_t Read(PP_Resource tcp_socket,
-             char* buffer,
-             int32_t bytes_to_read,
-             struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_TCPSocket_Private::Read: tcp_socket=%"NACL_PRId32", "
-              "bytes_to_read=%"NACL_PRId32"\n", tcp_socket, bytes_to_read);
-
-  if (bytes_to_read < 0)
-    bytes_to_read = 0;
-  nacl_abi_size_t buffer_size = bytes_to_read;
-
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback, buffer);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error_or_bytes;
-  NaClSrpcError srpc_result =
-      PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_Read(
-          GetMainSrpcChannel(),
-          tcp_socket,
-          bytes_to_read,
-          callback_id,
-          &buffer_size, buffer,
-          &pp_error_or_bytes);
-
-  DebugPrintf("PPB_TCPSocket_Private::Read: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error_or_bytes = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error_or_bytes);
-}
-
-int32_t Write(PP_Resource tcp_socket,
-              const char* buffer,
-              int32_t bytes_to_write,
-              struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_TCPSocket_Private::Write: tcp_socket=%"NACL_PRId32", "
-              "bytes_to_write=%"NACL_PRId32"\n", tcp_socket, bytes_to_write);
-
-  if (bytes_to_write < 0)
-    bytes_to_write = 0;
-  nacl_abi_size_t buffer_size = static_cast<nacl_abi_size_t>(bytes_to_write);
-
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error_or_bytes = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result =
-      PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_Write(
-          GetMainSrpcChannel(),
-          tcp_socket,
-          buffer_size, const_cast<char*>(buffer),
-          bytes_to_write,
-          callback_id,
-          &pp_error_or_bytes);
-
-  DebugPrintf("PPB_TCPSocket_Private::Write: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error_or_bytes = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error_or_bytes);
-}
-
-void Disconnect(PP_Resource tcp_socket) {
-  DebugPrintf("PPB_TCPSocket_Private::Disconnect: tcp_socket="NACL_PRId32"\n",
-              tcp_socket);
-
-  NaClSrpcError srpc_result =
-      PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_Disconnect(
-          GetMainSrpcChannel(), tcp_socket);
-  DebugPrintf("PPB_TCPSocket_Private::Disconnect: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-}  // namespace
-
-const PPB_TCPSocket_Private_0_3* PluginTCPSocketPrivate::GetInterface0_3() {
-  static const PPB_TCPSocket_Private_0_3 tcpsocket_private_interface = {
-    Create,
-    IsTCPSocket,
-    Connect,
-    ConnectWithNetAddress,
-    GetLocalAddress,
-    GetRemoteAddress,
-    SSLHandshake,
-    Read,
-    Write,
-    Disconnect,
-  };
-  return &tcpsocket_private_interface;
-}
-
-const PPB_TCPSocket_Private_0_4* PluginTCPSocketPrivate::GetInterface0_4() {
-  static const PPB_TCPSocket_Private tcpsocket_private_interface = {
-    Create,
-    IsTCPSocket,
-    Connect,
-    ConnectWithNetAddress,
-    GetLocalAddress,
-    GetRemoteAddress,
-    SSLHandshake,
-    GetServerCertificate,
-    AddChainBuildingCertificate,
-    Read,
-    Write,
-    Disconnect,
-  };
-  return &tcpsocket_private_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_socket_private.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_socket_private.h
deleted file mode 100644
index 9d1bd6a..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_socket_private.h
+++ /dev/null
@@ -1,25 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_TCP_SOCKET_PRIVATE_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_TCP_SOCKET_PRIVATE_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/private/ppb_tcp_socket_private.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_TCPSocket_Private interface.
-class PluginTCPSocketPrivate {
- public:
-  static const PPB_TCPSocket_Private_0_3* GetInterface0_3();
-  static const PPB_TCPSocket_Private_0_4* GetInterface0_4();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginTCPSocketPrivate);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_TCP_SOCKET_PRIVATE_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc
deleted file mode 100644
index 14e7d2f..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc
+++ /dev/null
@@ -1,178 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_testing.h"
-
-#include <cstddef>
-#include <new>
-#include <vector>
-
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/proxy_var_cache.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/dev/ppb_testing_dev.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_point.h"
-#include "ppapi/c/pp_rect.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-const nacl_abi_size_t kPPPointBytes =
-    static_cast<nacl_abi_size_t>(sizeof(struct PP_Point));
-const nacl_abi_size_t kPPURLComponentsDevBytes =
-    static_cast<nacl_abi_size_t>(sizeof(struct PP_URLComponents_Dev));
-
-PP_Bool ReadImageData(PP_Resource device_context_2d,
-                      PP_Resource image,
-                      const struct PP_Point* top_left) {
-  DebugPrintf("PPB_Testing::ReadImageData: device_context_2d=%"NACL_PRId32"\n",
-              device_context_2d);
-
-  int32_t success = 0;
-  NaClSrpcError srpc_result =
-      PpbTestingRpcClient::PPB_Testing_ReadImageData(
-          GetMainSrpcChannel(),
-          device_context_2d,
-          image,
-          kPPPointBytes,
-          reinterpret_cast<char*>(const_cast<PP_Point*>(top_left)),
-          &success);
-
-  DebugPrintf("PPB_Testing::ReadImageData: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-void RunMessageLoop(PP_Instance instance) {
-  DebugPrintf("PPB_Testing::RunMessageLoop: instance=%"NACL_PRId32"\n",
-              instance);
-
-  NaClSrpcError srpc_result =
-      PpbTestingRpcClient::PPB_Testing_RunMessageLoop(
-          GetMainSrpcChannel(),
-          instance);
-
-  DebugPrintf("PPB_Testing::RunMessageLoop: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-void QuitMessageLoop(PP_Instance instance) {
-  DebugPrintf("PPB_Testing::QuitMessageLoop: instance=%"NACL_PRId32"\n",
-              instance);
-
-  NaClSrpcError srpc_result =
-      PpbTestingRpcClient::PPB_Testing_QuitMessageLoop(
-          GetMainSrpcChannel(),
-          instance);
-
-  DebugPrintf("PPB_Testing::QuitMessageLoop: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-uint32_t GetLiveObjectsForInstance(PP_Instance instance) {
-  DebugPrintf("PPB_Testing::GetLiveObjectsForInstance: "
-              "instance=%"NACL_PRId32"\n", instance);
-
-  int32_t live_object_count = 0;
-  NaClSrpcError srpc_result =
-      PpbTestingRpcClient::PPB_Testing_GetLiveObjectsForInstance(
-          GetMainSrpcChannel(),
-          instance,
-          &live_object_count);
-
-  DebugPrintf("PPB_Testing::GetLiveObjectsForInstance: %s\n",
-              NaClSrpcErrorString(srpc_result));
-  return live_object_count;
-}
-
-PP_Bool IsOutOfProcess() {
-  // The NaCl plugin is run in-process, and all calls are synchronous, so even
-  // though a NaCl module runs in a separate process, it behaves as if it were
-  // in-process. Furthermore, calls off of the main thread are not supported
-  // (same as trusted in-process).
-  return PP_FALSE;
-}
-
-void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) {
-  DebugPrintf("PPB_Testing::SimulateInputEvent: instance=%"NACL_PRId32", "
-              "input_event=%"NACL_PRId32"\n",
-              instance, input_event);
-
-  NaClSrpcError srpc_result =
-      PpbTestingRpcClient::PPB_Testing_SimulateInputEvent(GetMainSrpcChannel(),
-                                                          instance,
-                                                          input_event);
-  DebugPrintf("PPB_Testing::SimulateInputEvent: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-struct PP_Var GetDocumentURL(PP_Instance instance,
-                             struct PP_URLComponents_Dev* components) {
-  DebugPrintf("PPB_Testing::GetDocumentURL: "
-              "instance=%"NACL_PRId32"\n", instance);
-
-  NaClSrpcChannel* channel = GetMainSrpcChannel();
-  nacl_abi_size_t components_size =
-      (components != NULL) ? kPPURLComponentsDevBytes : 0;
-  nacl_abi_size_t url_size = kMaxReturnVarSize;
-  nacl::scoped_array<char> url_bytes(new char[url_size]);
-  if (url_bytes.get() == NULL)
-    return PP_MakeUndefined();
-
-  NaClSrpcError srpc_result =
-      PpbTestingRpcClient::PPB_Testing_GetDocumentURL(
-          channel,
-          instance,
-          &components_size, reinterpret_cast<char*>(components),
-          &url_size, url_bytes.get());
-
-  struct PP_Var url = PP_MakeUndefined();
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    (void) DeserializeTo(url_bytes.get(), url_size, 1, &url);
-
-  DebugPrintf("PPB_Testing::GetDocumentURL: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  return url;
-}
-
-// TODO(dmichael): Ideally we could get a way to check the number of vars in the
-// host-side tracker when running NaCl, to make sure the proxy does not leak
-// host-side vars.
-uint32_t GetLiveVars(PP_Var live_vars[], uint32_t array_size) {
-  std::vector<PP_Var> vars = ProxyVarCache::GetInstance().GetLiveVars();
-  for (size_t i = 0u;
-       i < std::min(static_cast<size_t>(array_size), vars.size());
-       ++i)
-    live_vars[i] = vars[i];
-  return vars.size();
-}
-
-}  // namespace
-
-const PPB_Testing_Dev* PluginTesting::GetInterface() {
-  static const PPB_Testing_Dev testing_interface = {
-    ReadImageData,
-    RunMessageLoop,
-    QuitMessageLoop,
-    GetLiveObjectsForInstance,
-    IsOutOfProcess,
-    SimulateInputEvent,
-    GetDocumentURL,
-    GetLiveVars
-  };
-  return &testing_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.h
deleted file mode 100644
index 4886c2e..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_TESTING_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_TESTING_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/dev/ppb_testing_dev.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_Testing_Dev interface.
-class PluginTesting {
- public:
-  PluginTesting();
-  static const PPB_Testing_Dev* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginTesting);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_TESTING_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_udp_socket_private.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_udp_socket_private.cc
deleted file mode 100644
index 49bde4c..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_udp_socket_private.cc
+++ /dev/null
@@ -1,295 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_udp_socket_private.h"
-
-#include <string.h>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/private/ppb_udp_socket_private.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Resource Create(PP_Instance instance_id) {
-  DebugPrintf("PPB_UDPSocket_Private::Create: instance_id=%"NACL_PRId32"\n",
-              instance_id);
-
-  PP_Resource resource;
-  NaClSrpcError srpc_result =
-      PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_Create(
-          GetMainSrpcChannel(),
-          instance_id,
-          &resource);
-
-  DebugPrintf("PPB_UDPSocket_Private::Create: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return resource;
-  else
-    return kInvalidResourceId;
-}
-
-PP_Bool IsUDPSocket(PP_Resource resource_id) {
-  DebugPrintf("PPB_UDPSocket_Private::IsUDPSocket: "
-              "resource_id=%"NACL_PRId32"\n", resource_id);
-
-  int32_t is_udp_socket;
-  NaClSrpcError srpc_result =
-      PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_IsUDPSocket(
-          GetMainSrpcChannel(), resource_id, &is_udp_socket);
-
-  DebugPrintf("PPB_UDPSocket_Private::IsUDPSocket: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && is_udp_socket)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-int32_t SetSocketFeature(PP_Resource udp_socket,
-                         PP_UDPSocketFeature_Private name,
-                         struct PP_Var value) {
-  DebugPrintf("PPB_UDPSocket_Private::SetSocketFeature: ",
-              "udp_socket=%"NACL_PRId32"\n", udp_socket);
-
-  nacl_abi_size_t value_size;
-  nacl::scoped_array<char> value_bytes(Serialize(&value, 1, &value_size));
-
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result =
-      PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_SetSocketFeature(
-          GetMainSrpcChannel(),
-          udp_socket,
-          name,
-          value_size, value_bytes.get(),
-          &pp_error);
-
-  DebugPrintf("PPB_UDPSocket_Private::SetSocketFeature: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return pp_error;
-}
-
-int32_t Bind(PP_Resource udp_socket, const struct PP_NetAddress_Private* addr,
-             struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_UDPSocket_Private::Bind: "
-              "udp_socket=%"NACL_PRId32"\n", udp_socket);
-
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  char* const raw_addr =
-      reinterpret_cast<char*>(const_cast<struct PP_NetAddress_Private*>(addr));
-
-  int32_t pp_error = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result =
-      PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_Bind(
-          GetMainSrpcChannel(),
-          udp_socket,
-          sizeof(PP_NetAddress_Private), raw_addr,
-          callback_id,
-          &pp_error);
-
-  DebugPrintf("PPB_UDPSocket_Private::Bind: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-PP_Bool GetBoundAddress(PP_Resource udp_socket,
-                        struct PP_NetAddress_Private* addr) {
-  DebugPrintf("PPB_UDPSocket_Private::GetBoundAddress: "
-              "udp_socket="NACL_PRId32"\n", udp_socket);
-
-  nacl_abi_size_t addr_bytes =
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private));
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_GetBoundAddress(
-          GetMainSrpcChannel(),
-          udp_socket,
-          &addr_bytes,
-          reinterpret_cast<char*>(addr),
-          &success);
-
-  DebugPrintf("PPB_UDPSocket_Private::GetBoundAddress: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-int32_t RecvFrom(PP_Resource udp_socket, char* buffer, int32_t num_bytes,
-                 struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_UDPSocket_Private::RecvFrom: udp_socket=%"NACL_PRId32", "
-              "num_bytes=%"NACL_PRId32"\n", udp_socket, num_bytes);
-
-  if (num_bytes < 0)
-    num_bytes = 0;
-  nacl_abi_size_t buffer_size = static_cast<nacl_abi_size_t>(num_bytes);
-
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback, buffer);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error_or_bytes;
-  NaClSrpcError srpc_result =
-      PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_RecvFrom(
-          GetMainSrpcChannel(),
-          udp_socket,
-          num_bytes,
-          callback_id,
-          &buffer_size,
-          buffer,
-          &pp_error_or_bytes);
-
-  DebugPrintf("PPB_UDPSocket_Private::RecvFrom: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error_or_bytes = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error_or_bytes);
-}
-
-PP_Bool GetRecvFromAddress(PP_Resource udp_socket,
-                           struct PP_NetAddress_Private* addr) {
-  DebugPrintf("PPB_UDPSocket_Private::GetRecvFromAddress: "
-              "udp_socket="NACL_PRId32"\n", udp_socket);
-
-  nacl_abi_size_t addr_bytes =
-      static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private));
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_GetRecvFromAddress(
-          GetMainSrpcChannel(),
-          udp_socket,
-          &addr_bytes,
-          reinterpret_cast<char*>(addr),
-          &success);
-
-  DebugPrintf("PPB_UDPSocket_Private::GetRecvFromAddress: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-int32_t SendTo(PP_Resource udp_socket, const char* buffer, int32_t num_bytes,
-               const struct PP_NetAddress_Private* addr,
-               struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_UDPSocket_Private::SendTo: udp_socket="NACL_PRId32", "
-              "num_bytes="NACL_PRId32"\n", udp_socket, num_bytes);
-
-  if (num_bytes < 0)
-    num_bytes = 0;
-  nacl_abi_size_t buffer_size = static_cast<nacl_abi_size_t>(num_bytes);
-
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  char* const raw_addr =
-      reinterpret_cast<char*>(const_cast<struct PP_NetAddress_Private*>(addr));
-
-  int32_t pp_error_or_bytes = PP_ERROR_FAILED;
-  NaClSrpcError srpc_result =
-      PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_SendTo(
-          GetMainSrpcChannel(),
-          udp_socket,
-          buffer_size,
-          const_cast<char*>(buffer),
-          num_bytes,
-          static_cast<nacl_abi_size_t>(sizeof(PP_NetAddress_Private)),
-          raw_addr,
-          callback_id,
-          &pp_error_or_bytes);
-
-  DebugPrintf("PPB_UDPSocket_Private::SendTo: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error_or_bytes = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error_or_bytes);
-}
-
-void Close(PP_Resource udp_socket) {
-  DebugPrintf("PPB_UDPSocket_Private::Close: "
-              "udp_socket="NACL_PRId32"\n", udp_socket);
-
-  NaClSrpcError srpc_result =
-      PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_Close(
-          GetMainSrpcChannel(),
-          udp_socket);
-
-  DebugPrintf("PPB_UDPSocket_Private::Close: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-}  // namespace
-
-const PPB_UDPSocket_Private_0_2* PluginUDPSocketPrivate::GetInterface0_2() {
-  static const PPB_UDPSocket_Private_0_2 udpsocket_private_interface = {
-    Create,
-    IsUDPSocket,
-    Bind,
-    RecvFrom,
-    GetRecvFromAddress,
-    SendTo,
-    Close
-  };
-  return &udpsocket_private_interface;
-}
-
-const PPB_UDPSocket_Private_0_3* PluginUDPSocketPrivate::GetInterface0_3() {
-  static const PPB_UDPSocket_Private_0_3 udpsocket_private_interface = {
-    Create,
-    IsUDPSocket,
-    Bind,
-    GetBoundAddress,
-    RecvFrom,
-    GetRecvFromAddress,
-    SendTo,
-    Close
-  };
-  return &udpsocket_private_interface;
-}
-
-const PPB_UDPSocket_Private_0_4* PluginUDPSocketPrivate::GetInterface0_4() {
-  static const PPB_UDPSocket_Private_0_4 udpsocket_private_interface = {
-    Create,
-    IsUDPSocket,
-    SetSocketFeature,
-    Bind,
-    GetBoundAddress,
-    RecvFrom,
-    GetRecvFromAddress,
-    SendTo,
-    Close
-  };
-  return &udpsocket_private_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_udp_socket_private.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_udp_socket_private.h
deleted file mode 100644
index 4f9287e..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_udp_socket_private.h
+++ /dev/null
@@ -1,26 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_UDP_SOCKET_PRIVATE_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_UDP_SOCKET_PRIVATE_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/private/ppb_udp_socket_private.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_UDPSocket_Private interface.
-class PluginUDPSocketPrivate {
- public:
-  static const PPB_UDPSocket_Private_0_2* GetInterface0_2();
-  static const PPB_UDPSocket_Private_0_3* GetInterface0_3();
-  static const PPB_UDPSocket_Private_0_4* GetInterface0_4();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginUDPSocketPrivate);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_UDP_SOCKET_PRIVATE_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.cc
deleted file mode 100644
index 01b1490..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.cc
+++ /dev/null
@@ -1,237 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.h"
-
-#include <stdio.h>
-#include <string.h>
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_url_loader.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Resource Create(PP_Instance instance) {
-  DebugPrintf("PPB_URLLoader::Create: instance=%"NACL_PRId32"\n", instance);
-
-  PP_Resource resource;
-  NaClSrpcError srpc_result =
-      PpbURLLoaderRpcClient::PPB_URLLoader_Create(
-          GetMainSrpcChannel(), instance, &resource);
-  DebugPrintf("PPB_URLLoader::Create: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return resource;
-  return kInvalidResourceId;
-}
-
-PP_Bool IsURLLoader(PP_Resource resource) {
-  DebugPrintf("PPB_URLLoader::IsURLLoader: resource=%"NACL_PRId32"\n",
-              resource);
-
-  int32_t is_url_loader;
-  NaClSrpcError srpc_result =
-      PpbURLLoaderRpcClient::PPB_URLLoader_IsURLLoader(
-          GetMainSrpcChannel(), resource, &is_url_loader);
-  DebugPrintf("PPB_URLLoader::IsURLLoader: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && is_url_loader)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-int32_t Open(PP_Resource loader,
-             PP_Resource request,
-             struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_URLLoader::Open: loader=%"NACL_PRId32"\n", loader);
-  DebugPrintf("PPB_URLLoader::Open: request=%"NACL_PRId32"\n", request);
-
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error;
-  NaClSrpcError srpc_result =
-      PpbURLLoaderRpcClient::PPB_URLLoader_Open(
-          GetMainSrpcChannel(), loader, request, callback_id, &pp_error);
-  DebugPrintf("PPB_URLLoader::Open: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-int32_t FollowRedirect(PP_Resource loader,
-                       struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_URLLoader::FollowRedirect: loader=%"NACL_PRId32"\n", loader);
-
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error;
-  NaClSrpcError srpc_result =
-      PpbURLLoaderRpcClient::PPB_URLLoader_FollowRedirect(
-          GetMainSrpcChannel(), loader, callback_id, &pp_error);
-  DebugPrintf("PPB_URLLoader::FollowRedirect: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-PP_Bool GetUploadProgress(PP_Resource loader,
-                          int64_t* bytes_sent,
-                          int64_t* total_bytes_to_be_sent) {
-  DebugPrintf("PPB_URLLoader::GetUploadProgress: loader=%"NACL_PRId32"\n",
-              loader);
-
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbURLLoaderRpcClient::PPB_URLLoader_GetUploadProgress(
-          GetMainSrpcChannel(),
-          loader,
-          bytes_sent,
-          total_bytes_to_be_sent,
-          &success);
- DebugPrintf("PPB_URLLoader::GetUploadProgress: %s\n",
-             NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-PP_Bool GetDownloadProgress(PP_Resource loader,
-                            int64_t* bytes_received,
-                            int64_t* total_bytes_to_be_received) {
-  DebugPrintf("PPB_URLLoader::GetDownloadProgress: loader=%"NACL_PRId32"\n",
-              loader);
-
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbURLLoaderRpcClient::PPB_URLLoader_GetDownloadProgress(
-          GetMainSrpcChannel(),
-          loader,
-          bytes_received,
-          total_bytes_to_be_received,
-          &success);
- DebugPrintf("PPB_URLLoader::GetDownloadProgress: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-PP_Resource GetResponseInfo(PP_Resource loader) {
-  DebugPrintf("PPB_URLLoader::GetResponseInfo: loader=%"NACL_PRId32"\n",
-              loader);
-
-  PP_Resource response;
-  NaClSrpcError srpc_result =
-      PpbURLLoaderRpcClient::PPB_URLLoader_GetResponseInfo(
-          GetMainSrpcChannel(),
-          loader,
-          &response);
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return response;
-  return kInvalidResourceId;
-}
-
-int32_t ReadResponseBody(PP_Resource loader,
-                         void* buffer,
-                         int32_t bytes_to_read,
-                         struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_URLLoader::ReadResponseBody: loader=%"NACL_PRId32"\n",
-              loader);
-  if (bytes_to_read < 0)
-    bytes_to_read = 0;
-  nacl_abi_size_t buffer_size = bytes_to_read;
-
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback, buffer);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error_or_bytes;
-  NaClSrpcError srpc_result =
-      PpbURLLoaderRpcClient::PPB_URLLoader_ReadResponseBody(
-          GetMainSrpcChannel(),
-          loader,
-          bytes_to_read,
-          callback_id,
-          &buffer_size,
-          static_cast<char*>(buffer),
-          &pp_error_or_bytes);
-  DebugPrintf("PPB_URLLoader::ReadResponseBody: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error_or_bytes = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error_or_bytes);
-}
-
-int32_t FinishStreamingToFile(PP_Resource loader,
-                              struct PP_CompletionCallback callback) {
-  DebugPrintf("PPB_URLLoader::FinishStreamingToFile: loader=%"NACL_PRId32"\n",
-              loader);
-
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)  // Just like Chrome, for now disallow blocking calls.
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error;
-  NaClSrpcError srpc_result =
-      PpbURLLoaderRpcClient::PPB_URLLoader_FinishStreamingToFile(
-          GetMainSrpcChannel(), loader, callback_id, &pp_error);
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-void Close(PP_Resource loader) {
-  DebugPrintf("PPB_URLLoader::Close: loader=%"NACL_PRId32"\n", loader);
-
-  NaClSrpcError srpc_result =
-      PpbURLLoaderRpcClient::PPB_URLLoader_Close(
-          GetMainSrpcChannel(), loader);
-  DebugPrintf("PPB_URLLoader::Close: %s\n", NaClSrpcErrorString(srpc_result));
-}
-
-}  // namespace
-
-const PPB_URLLoader* PluginURLLoader::GetInterface() {
-  static const PPB_URLLoader url_loader_interface = {
-    Create,
-    IsURLLoader,
-    Open,
-    FollowRedirect,
-    GetUploadProgress,
-    GetDownloadProgress,
-    GetResponseInfo,
-    ReadResponseBody,
-    FinishStreamingToFile,
-    Close,
-  };
-  return &url_loader_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.h
deleted file mode 100644
index a62cb9b..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.h
+++ /dev/null
@@ -1,24 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_URL_LOADER_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_URL_LOADER_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppb_url_loader.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_URLLoader interface.
-class PluginURLLoader {
- public:
-  static const PPB_URLLoader* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginURLLoader);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_URL_LOADER_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_request_info.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_request_info.cc
deleted file mode 100644
index 8b60013..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_request_info.cc
+++ /dev/null
@@ -1,140 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_url_request_info.h"
-
-#include <stdio.h>
-#include <string.h>
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/ppb_url_request_info.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Resource Create(PP_Instance instance) {
-  DebugPrintf("PPB_URLRequestInfo::Create: instance=%"NACL_PRId32"\n",
-              instance);
-
-  PP_Resource resource;
-  NaClSrpcError srpc_result =
-      PpbURLRequestInfoRpcClient::PPB_URLRequestInfo_Create(
-          GetMainSrpcChannel(), instance, &resource);
-  DebugPrintf("PPB_URLRequestInfo::Create: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return resource;
-  return kInvalidResourceId;
-}
-
-PP_Bool IsURLRequestInfo(PP_Resource resource) {
-  DebugPrintf("PPB_URLRequestInfo::IsURLRequestInfo: resource=%"NACL_PRId32"\n",
-              resource);
-
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbURLRequestInfoRpcClient::PPB_URLRequestInfo_IsURLRequestInfo(
-          GetMainSrpcChannel(), resource, &success);
-  DebugPrintf("PPB_URLRequestInfo::IsURLRequestInfo: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-PP_Bool SetProperty(PP_Resource request,
-                    PP_URLRequestProperty property,
-                    struct PP_Var value) {
-  DebugPrintf("PPB_URLRequestInfo::SetProperty: request=%"NACL_PRId32"\n",
-              request);
-
-  nacl_abi_size_t value_size = 0;
-  nacl::scoped_array<char> value_bytes(Serialize(&value, 1, &value_size));
-
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbURLRequestInfoRpcClient::PPB_URLRequestInfo_SetProperty(
-          GetMainSrpcChannel(),
-          request,
-          static_cast<int32_t>(property),
-          value_size,
-          value_bytes.get(),
-          &success);
-  DebugPrintf("PPB_URLRequestInfo::SetProperty: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-PP_Bool AppendDataToBody(PP_Resource request, const void* data, uint32_t len) {
-  DebugPrintf("PPB_URLRequestInfo::AppendDataToBody: request=%"NACL_PRId32"\n",
-              request);
-
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbURLRequestInfoRpcClient::PPB_URLRequestInfo_AppendDataToBody(
-          GetMainSrpcChannel(),
-          request,
-          static_cast<nacl_abi_size_t>(len),
-          static_cast<char*>(const_cast<void*>(data)),
-          &success);
-  DebugPrintf("PPB_URLRequestInfo::AppendDataToBody: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-PP_Bool AppendFileToBody(PP_Resource request,
-                         PP_Resource file_ref,
-                         int64_t start_offset,
-                         int64_t number_of_bytes,
-                         PP_Time expected_last_modified_time) {
-  DebugPrintf("PPB_URLRequestInfo::AppendFileToBody: request=%"NACL_PRId32"\n",
-              request);
-
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbURLRequestInfoRpcClient::PPB_URLRequestInfo_AppendFileToBody(
-          GetMainSrpcChannel(),
-          request,
-          file_ref,
-          start_offset,
-          number_of_bytes,
-          static_cast<double>(expected_last_modified_time),
-          &success);
-  DebugPrintf("PPB_URLRequestInfo::AppendFileToBody: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-}  // namespace
-
-const PPB_URLRequestInfo* PluginURLRequestInfo::GetInterface() {
-  static const PPB_URLRequestInfo url_request_info_interface = {
-    Create,
-    IsURLRequestInfo,
-    SetProperty,
-    AppendDataToBody,
-    AppendFileToBody,
-  };
-  return &url_request_info_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_request_info.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_request_info.h
deleted file mode 100644
index c80078c..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_request_info.h
+++ /dev/null
@@ -1,24 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_URL_REQUEST_INFO_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_URL_REQUEST_INFO_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppb_url_request_info.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_URLRequestInfo interface.
-class PluginURLRequestInfo {
- public:
-  static const PPB_URLRequestInfo* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginURLRequestInfo);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_URL_REQUEST_INFO_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_response_info.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_response_info.cc
deleted file mode 100644
index 8a19485..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_response_info.cc
+++ /dev/null
@@ -1,90 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_url_response_info.h"
-
-#include <stdio.h>
-#include <string.h>
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/ppb_url_response_info.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Bool IsURLResponseInfo(PP_Resource resource) {
-  DebugPrintf("PPB_URLResponseInfo::IsURLResponseInfo: resource=%"NACL_PRId32
-              "\n", resource);
-
-  int32_t success;
-  NaClSrpcError srpc_result =
-      PpbURLResponseInfoRpcClient::PPB_URLResponseInfo_IsURLResponseInfo(
-          GetMainSrpcChannel(), resource, &success);
-  DebugPrintf("PPB_URLResponseInfo::IsURLResponseInfo: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && success)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-PP_Var GetProperty(PP_Resource response, PP_URLResponseProperty property) {
-  DebugPrintf("PPB_URLResponseInfo::GetProperty: response=%"NACL_PRId32"\n",
-              response);
-  NaClSrpcChannel* channel = GetMainSrpcChannel();
-
-  PP_Var value = PP_MakeUndefined();
-  nacl_abi_size_t value_size = kMaxReturnVarSize;
-  nacl::scoped_array<char> value_bytes(new char[value_size]);
-
-  NaClSrpcError srpc_result =
-      PpbURLResponseInfoRpcClient::PPB_URLResponseInfo_GetProperty(
-          channel,
-          response,
-          static_cast<int32_t>(property),
-          &value_size,
-          value_bytes.get());
-  DebugPrintf("PPB_URLResponseInfo::GetProperty: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    (void) DeserializeTo(value_bytes.get(), value_size, 1, &value);
-  return value;
-}
-
-PP_Resource GetBodyAsFileRef(PP_Resource response) {
-  DebugPrintf("PPB_URLResponseInfo::GetBodyAsFileRef: response=%"NACL_PRId32
-              "\n", response);
-
-  PP_Resource file_ref;
-  NaClSrpcError srpc_result =
-      PpbURLResponseInfoRpcClient::PPB_URLResponseInfo_GetBodyAsFileRef(
-          GetMainSrpcChannel(), response, &file_ref);
-  DebugPrintf("PPB_URLResponseInfo::GetBodyAsFileRef: %s\n",
-              NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return file_ref;
-  return kInvalidResourceId;
-}
-
-}  // namespace
-
-const PPB_URLResponseInfo* PluginURLResponseInfo::GetInterface() {
-  static const PPB_URLResponseInfo url_response_info_interface = {
-    IsURLResponseInfo,
-    GetProperty,
-    GetBodyAsFileRef,
-  };
-  return &url_response_info_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_response_info.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_response_info.h
deleted file mode 100644
index 66b08e8..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_response_info.h
+++ /dev/null
@@ -1,24 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_URL_RESPONSE_INFO_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_URL_RESPONSE_INFO_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppb_url_response_info.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_URLResponseInfo interface.
-class PluginURLResponseInfo {
- public:
-  static const PPB_URLResponseInfo* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginURLResponseInfo);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_URL_RESPONSE_INFO_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_var.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_var.cc
deleted file mode 100644
index d9700da..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_var.cc
+++ /dev/null
@@ -1,279 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h"
-
-#include <stdio.h>
-
-#include <string>
-#include <utility>
-
-#include "native_client/src/include/checked_cast.h"
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/include/portability_io.h"
-#include "native_client/src/shared/ppapi_proxy/array_buffer_proxy_var.h"
-#include "native_client/src/shared/ppapi_proxy/proxy_var_cache.h"
-#include "native_client/src/shared/ppapi_proxy/string_proxy_var.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_var.h"
-#include "ppapi/c/ppb_var.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-void AddRef(PP_Var var) {
-  DebugPrintf("PPB_Var::AddRef: var=PPB_Var(%s)\n",
-              PluginVar::DebugString(var).c_str());
-  ProxyVarCache::GetInstance().RetainProxyVar(var);
-}
-
-void Release(PP_Var var) {
-  DebugPrintf("PPB_Var::Release: var=PPB_Var(%s)\n",
-              PluginVar::DebugString(var).c_str());
-  ProxyVarCache::GetInstance().ReleaseProxyVar(var);
-}
-
-PP_Var VarFromUtf8(const char* data, uint32_t len) {
-  DebugPrintf("PPB_Var::VarFromUtf8: data='%.*s'\n", len, data);
-  if (!StringIsUtf8(data, len)) {
-    DebugPrintf("PPB_Var::VarFromUtf8: not UTF8\n");
-    return PP_MakeNull();
-  }
-  SharedProxyVar proxy_var(new StringProxyVar(data, len));
-  ProxyVarCache::GetInstance().RetainSharedProxyVar(proxy_var);
-  PP_Var var;
-  var.type = PP_VARTYPE_STRING;
-  var.value.as_id = proxy_var->id();
-  // Increment the reference count for the return to the caller.
-  AddRef(var);
-  DebugPrintf("PPB_Var::VarFromUtf8: as_id=%"NACL_PRId64"\n", var.value.as_id);
-  return var;
-}
-
-PP_Var VarFromUtf8_1_0(PP_Module /*module*/, const char* data, uint32_t len) {
-  return VarFromUtf8(data, len);
-}
-
-const char* VarToUtf8(PP_Var var, uint32_t* len) {
-  DebugPrintf("PPB_Var::VarToUtf8: as_id=%"NACL_PRId64"\n", var.value.as_id);
-  SharedStringProxyVar string_var = StringProxyVar::CastFromProxyVar(
-      ProxyVarCache::GetInstance().SharedProxyVarForVar(var));
-  const char* data = NULL;
-  if (string_var == NULL) {
-    *len = 0;
-  } else {
-    *len = static_cast<uint32_t>(string_var->contents().size());
-    // Mimics PPAPI implementation: as long as SharedStringProxyVar is alive,
-    // the return value can be validly used.
-    data = string_var->contents().c_str();
-  }
-  DebugPrintf("PPB_Var::VarToUtf8: data='%.*s'\n", *len, data);
-  return data;
-}
-
-int64_t GetVarId(PP_Var var) {
-  SharedProxyVar proxy_var =
-      ProxyVarCache::GetInstance().SharedProxyVarForVar(var);
-  if (proxy_var == NULL) {
-    return -1;
-  } else {
-    return proxy_var->id();
-  }
-}
-
-PP_Var CreateArrayBuffer(uint32_t size_in_bytes) {
-  DebugPrintf("PPB_VarArrayBuffer::Create: size_in_bytes=%"NACL_PRIu32"\n",
-              size_in_bytes);
-  SharedProxyVar proxy_var(new ArrayBufferProxyVar(size_in_bytes));
-  ProxyVarCache::GetInstance().RetainSharedProxyVar(proxy_var);
-  PP_Var var;
-  var.type = PP_VARTYPE_ARRAY_BUFFER;
-  var.value.as_id = proxy_var->id();
-  // Increment the reference count for the return to the caller.
-  AddRef(var);
-  DebugPrintf("PPB_VarArrayBuffer::Create: as_id=%"NACL_PRId64"\n",
-              var.value.as_id);
-  return var;
-}
-
-PP_Bool ByteLength(PP_Var var, uint32_t* byte_length) {
-  DebugPrintf("PPB_VarArrayBuffer::ByteLength: var=PPB_Var(%s)\n",
-              PluginVar::DebugString(var).c_str());
-  SharedArrayBufferProxyVar buffer_var = ArrayBufferProxyVar::CastFromProxyVar(
-      ProxyVarCache::GetInstance().SharedProxyVarForVar(var));
-  if (buffer_var) {
-    *byte_length = buffer_var->buffer_length();
-    DebugPrintf("PPB_VarArrayBuffer::ByteLength: length=%"NACL_PRIu32"\n",
-                *byte_length);
-    return PP_TRUE;
-  }
-  return PP_FALSE;
-}
-
-void* Map(PP_Var var) {
-  DebugPrintf("PPB_VarArrayBuffer::Map: var=PPB_Var(%s)\n",
-              PluginVar::DebugString(var).c_str());
-  SharedArrayBufferProxyVar buffer_var = ArrayBufferProxyVar::CastFromProxyVar(
-      ProxyVarCache::GetInstance().SharedProxyVarForVar(var));
-  if (!buffer_var)
-    return NULL;
-  void* data = buffer_var->buffer();
-  DebugPrintf("PPB_VarArrayBuffer::Map: buffer=%p\n", data);
-  return data;
-}
-
-void Unmap(PP_Var var) {
-  DebugPrintf("PPB_VarArrayBuffer::Unap: var=PPB_Var(%s)\n",
-              PluginVar::DebugString(var).c_str());
-  // We don't use shared memory, so there's nothing to do.
-}
-
-}  // namespace
-
-const PPB_Var* PluginVar::GetInterface() {
-  static const PPB_Var var_interface = {
-    AddRef,
-    Release,
-    VarFromUtf8,
-    VarToUtf8
-  };
-  return &var_interface;
-}
-
-const PPB_Var_1_0* PluginVar::GetInterface1_0() {
-  static const PPB_Var_1_0 var_interface = {
-    AddRef,
-    Release,
-    VarFromUtf8_1_0,
-    VarToUtf8
-  };
-  return &var_interface;
-}
-
-const PPB_VarArrayBuffer* PluginVar::GetArrayBufferInterface() {
-  static const PPB_VarArrayBuffer interface = {
-    CreateArrayBuffer,
-    ByteLength,
-    Map,
-    Unmap
-  };
-  return &interface;
-}
-
-std::string PluginVar::DebugString(const PP_Var& var) {
-  switch (var.type) {
-    case PP_VARTYPE_UNDEFINED:
-      return "##UNDEFINED##";
-    case PP_VARTYPE_NULL:
-      return "##NULL##";
-    case PP_VARTYPE_BOOL:
-      return (var.value.as_bool ? "true" : "false");
-    case PP_VARTYPE_INT32:
-      {
-        char buf[32];
-        const size_t kBufSize = sizeof(buf);
-        SNPRINTF(buf, kBufSize, "%d", static_cast<int>(var.value.as_int));
-        return buf;
-      }
-    case PP_VARTYPE_DOUBLE:
-      {
-        char buf[32];
-        const size_t kBufSize = sizeof(buf);
-        SNPRINTF(buf, kBufSize, "%f", var.value.as_double);
-        return buf;
-      }
-    case PP_VARTYPE_STRING:
-      {
-        uint32_t len;
-        const char* data = VarToUtf8(var, &len);
-        return std::string(data, len);
-      }
-    case PP_VARTYPE_OBJECT:
-      {
-        char buf[32];
-        const size_t kBufSize = sizeof(buf);
-        SNPRINTF(buf, kBufSize, "%"NACL_PRId64"", GetVarId(var));
-        return std::string("##OBJECT##") + buf + "##";
-      }
-    case PP_VARTYPE_ARRAY_BUFFER:
-      {
-        char buf[32];
-        const size_t kBufSize = sizeof(buf);
-        SNPRINTF(buf, kBufSize, "%"NACL_PRId64"", GetVarId(var));
-        return std::string("##ARRAYBUFFER##") + buf + "##";
-      }
-    case PP_VARTYPE_ARRAY:
-    case PP_VARTYPE_DICTIONARY:
-      NACL_NOTREACHED();
-      break;
-  }
-  ASSERT_MSG(0, "Unexpected type seen");
-  return "##ERROR##";
-}
-
-PP_Var PluginVar::StringToPPVar(const std::string& str) {
-  static const PPB_Var* ppb_var = NULL;
-  if (ppb_var == NULL) {
-    ppb_var = static_cast<const PPB_Var*>(
-        ppapi_proxy::PluginVar::GetInterface());
-  }
-  if (ppb_var == NULL) {
-    return PP_MakeUndefined();
-  }
-  return ppb_var->VarFromUtf8(str.c_str(),
-                              nacl::assert_cast<uint32_t>(str.size()));
-}
-
-std::string PluginVar::PPVarToString(const PP_Var& var) {
-  static const PPB_Var* ppb_var = NULL;
-  if (ppb_var == NULL) {
-    ppb_var = static_cast<const PPB_Var*>(
-        ppapi_proxy::PluginVar::GetInterface());
-  }
-  if (ppb_var == NULL || var.type != PP_VARTYPE_STRING) {
-    return "";
-  }
-  uint32_t len;
-  return ppb_var->VarToUtf8(var, &len);
-}
-
-void PluginVar::Print(const PP_Var& var) {
-  switch (var.type) {
-    case PP_VARTYPE_UNDEFINED:
-      DebugPrintf("PP_Var(undefined)");
-      break;
-    case PP_VARTYPE_NULL:
-      DebugPrintf("PP_Var(null)");
-      break;
-    case PP_VARTYPE_BOOL:
-      DebugPrintf("PP_Var(bool: %s)", var.value.as_bool ? "true" : "false");
-      break;
-    case PP_VARTYPE_INT32:
-      DebugPrintf("PP_Var(int32: %"NACL_PRId32")", var.value.as_int);
-      break;
-    case PP_VARTYPE_DOUBLE:
-      DebugPrintf("PP_Var(double: %f)", var.value.as_double);
-      break;
-    case PP_VARTYPE_STRING:
-      {
-        std::string str = DebugString(var);
-        DebugPrintf("PP_Var(string: '%*s')",
-                    static_cast<uint32_t>(str.size()),
-                    str.c_str());
-      }
-    case PP_VARTYPE_OBJECT:
-      DebugPrintf("PP_Var(object: %"NACL_PRIu64")", GetVarId(var));
-      break;
-    case PP_VARTYPE_ARRAY_BUFFER:
-      DebugPrintf("PP_Var(object: %"NACL_PRIu64")", GetVarId(var));
-      break;
-    case PP_VARTYPE_ARRAY:
-    case PP_VARTYPE_DICTIONARY:
-      break;
-  }
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_var.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_var.h
deleted file mode 100644
index 21f8169..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_var.h
+++ /dev/null
@@ -1,46 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_VAR_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_VAR_H_
-
-#include <string>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability.h"
-#include "ppapi/c/pp_var.h"
-#include "ppapi/c/ppb_var.h"
-#include "ppapi/c/ppb_var_array_buffer.h"
-
-namespace ppapi_proxy {
-
-// Implements the plugin side of the PPB_Var interface.
-// This implementation also determines how PP_Vars are represented internally
-// in the proxied implementation.
-class PluginVar {
- public:
-  // Returns an interface pointer suitable to the PPAPI client.
-  static const PPB_Var* GetInterface();
-  // Returns the 1.0 interface to support backwards-compatibility.
-  static const PPB_Var_1_0* GetInterface1_0();
-
-  // Returns an interface pointer for the PPB_VarArrayBuffer interface.
-  static const PPB_VarArrayBuffer* GetArrayBufferInterface();
-
-  // String helpers.
-  static PP_Var StringToPPVar(const std::string& str);
-  static std::string PPVarToString(const PP_Var& var);
-
-  // Printing and debugging.
-  static void Print(const PP_Var& var);
-  static std::string DebugString(const PP_Var& var);
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginVar);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_VAR_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_view.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_view.cc
deleted file mode 100644
index 4ad5d5b..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_view.cc
+++ /dev/null
@@ -1,105 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_view.h"
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_upcall.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_rect.h"
-#include "ppapi/c/pp_size.h"
-#include "srpcgen/ppb_rpc.h"
-#include "srpcgen/upcall.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-class ViewGetter {
- public:
-  ViewGetter(PP_Resource resource, const char* function_name) {
-    DebugPrintf("PPB_View::%s: resource=%"NACL_PRId32"\n",
-                function_name,
-                resource);
-    view_ = PluginResource::GetAs<PluginView>(resource);
-  }
-
-  PluginView* get() { return view_.get(); }
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(ViewGetter);
-  scoped_refptr<PluginView> view_;
-};
-
-// This macro is for starting a resource function. It makes sure resource_arg
-// is of type PluginView, and returns error_return if it's not.
-#define BEGIN_RESOURCE_THUNK(function_name, resource_arg, error_return) \
-  ViewGetter view(resource_arg, function_name); \
-  if (!view.get()) { \
-    return error_return; \
-  }
-
-PP_Bool IsView(PP_Resource resource) {
-  DebugPrintf("PPB_View::IsView: resource=%"NACL_PRId32"\n",
-              resource);
-  return PP_FromBool(PluginResource::GetAs<PluginView>(resource).get());
-}
-
-PP_Bool GetRect(PP_Resource resource, PP_Rect* viewport) {
-  BEGIN_RESOURCE_THUNK("GetRect", resource, PP_FALSE);
-  *viewport = view.get()->view_data().viewport_rect;
-  return PP_TRUE;
-}
-
-PP_Bool IsFullscreen(PP_Resource resource) {
-  BEGIN_RESOURCE_THUNK("IsFullscreen", resource, PP_FALSE);
-  return view.get()->view_data().is_fullscreen;
-}
-
-PP_Bool IsUserVisible(PP_Resource resource) {
-  BEGIN_RESOURCE_THUNK("IsUserVisible", resource, PP_FALSE);
-  const ViewData& data = view.get()->view_data();
-  return PP_FromBool(data.is_page_visible &&
-                     data.clip_rect.size.width > 0 &&
-                     data.clip_rect.size.height > 0);
-}
-
-PP_Bool IsPageVisible(PP_Resource resource) {
-  BEGIN_RESOURCE_THUNK("IsPageVisible", resource, PP_FALSE);
-  return view.get()->view_data().is_page_visible;
-}
-
-PP_Bool GetClipRect(PP_Resource resource, PP_Rect* clip) {
-  BEGIN_RESOURCE_THUNK("GetClipRect", resource, PP_FALSE);
-  *clip = view.get()->view_data().clip_rect;
-  return PP_TRUE;
-}
-
-}  // namespace
-
-PluginView::PluginView() {}
-
-void PluginView::Init(const ViewData& view_data) {
-  view_data_ = view_data;
-}
-
-const PPB_View* PluginView::GetInterface() {
-  static const PPB_View view_interface = {
-    &IsView,
-    &GetRect,
-    &IsFullscreen,
-    &IsUserVisible,
-    &IsPageVisible,
-    &GetClipRect
-  };
-  return &view_interface;
-}
-
-PluginView::~PluginView() {}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_view.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_view.h
deleted file mode 100644
index b55fc2a..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_view.h
+++ /dev/null
@@ -1,42 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_VIEW_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_VIEW_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/ppapi_proxy/view_data.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "ppapi/c/ppb_view.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_View interface.
-class PluginView : public PluginResource {
- public:
-  PluginView();
-  void Init(const ViewData& view_data);
-
-  // PluginResource implementation.
-  virtual bool InitFromBrowserResource(PP_Resource /*resource*/) {
-    return true;
-  }
-
-  const ViewData& view_data() const { return view_data_; }
-
-  static const PPB_View* GetInterface();
-
- private:
-  virtual ~PluginView();
-
-  ViewData view_data_;
-
-  IMPLEMENT_RESOURCE(PluginView);
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginView);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_VIEW_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_websocket.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_websocket.cc
deleted file mode 100644
index d2acf09..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_websocket.cc
+++ /dev/null
@@ -1,353 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_websocket.h"
-
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_var.h"
-#include "ppapi/c/ppb_websocket.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-PP_Resource Create(PP_Instance instance) {
-  DebugPrintf("PPB_WebSocket::Create: instance=%"NACL_PRId32"\n", instance);
-
-  PP_Resource resource;
-  NaClSrpcError srpc_result =
-      PpbWebSocketRpcClient::PPB_WebSocket_Create(
-          GetMainSrpcChannel(), instance, &resource);
-  DebugPrintf("PPB_WebSocket::Create: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK)
-    return resource;
-  return kInvalidResourceId;
-}
-
-PP_Bool IsWebSocket(PP_Resource resource) {
-  DebugPrintf(
-      "PPB_WebSocket::IsWebSocket: resource=%"NACL_PRId32"\n", resource);
-
-  int32_t is_websocket;
-  NaClSrpcError srpc_result =
-      PpbWebSocketRpcClient::PPB_WebSocket_IsWebSocket(
-          GetMainSrpcChannel(), resource, &is_websocket);
-  DebugPrintf("PPB_WebSocket::IsWebSocket: %s\n",
-      NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && is_websocket)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-int32_t Connect(PP_Resource ws,
-                PP_Var url,
-                const PP_Var protocols[],
-                uint32_t protocol_count,
-                PP_CompletionCallback callback) {
-  DebugPrintf("PPB_WebSocket::Connect: ws=%"NACL_PRId32"\n", ws);
-
-  nacl_abi_size_t url_size = 0;
-  nacl::scoped_array<char> url_bytes(Serialize(&url, 1, &url_size));
-
-  nacl_abi_size_t protocols_size = 0;
-  nacl::scoped_array<char> protocols_bytes(
-      Serialize(protocols, protocol_count, &protocols_size));
-
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error;
-  NaClSrpcError srpc_result =
-      PpbWebSocketRpcClient::PPB_WebSocket_Connect(
-          GetMainSrpcChannel(),
-          ws,
-          url_size, url_bytes.get(),
-          protocols_size, protocols_bytes.get(),
-          static_cast<int32_t>(protocol_count),
-          callback_id,
-          &pp_error);
-  DebugPrintf("PPB_WebSocket::Connect: %s\n",
-      NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-int32_t Close(PP_Resource ws,
-              uint16_t code,
-              PP_Var reason,
-              PP_CompletionCallback callback) {
-  DebugPrintf("PPB_WebSocket::Close: ws=%"NACL_PRId32"\n", ws);
-
-  nacl_abi_size_t reason_size = 0;
-  nacl::scoped_array<char> reason_bytes(Serialize(&reason, 1, &reason_size));
-
-  int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0)
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  int32_t pp_error;
-  NaClSrpcError srpc_result =
-      PpbWebSocketRpcClient::PPB_WebSocket_Close(
-          GetMainSrpcChannel(),
-          ws,
-          code,
-          reason_size, reason_bytes.get(),
-          callback_id,
-          &pp_error);
-  DebugPrintf("PPB_WebSocket::Close: %s\n", NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-  return MayForceCallback(callback, pp_error);
-}
-
-int32_t ReceiveMessage(PP_Resource ws,
-                       PP_Var* message,
-                       PP_CompletionCallback callback) {
-  DebugPrintf("PPB_WebSocket::ReceiveMessage: ws=%"NACL_PRId32"\n", ws);
-
-  if (message == NULL)
-    return PP_ERROR_FAILED;
-  int32_t callback_id =
-      CompletionCallbackTable::Get()->AddCallback(callback, message);
-  if (callback_id == 0)
-    return PP_ERROR_BLOCKS_MAIN_THREAD;
-
-  nacl_abi_size_t sync_read_buffer_size = kMaxReturnVarSize;
-  nacl::scoped_array<char> sync_read_buffer_bytes(
-      new char[sync_read_buffer_size]);
-
-  int32_t pp_error;
-  NaClSrpcError srpc_result =
-      PpbWebSocketRpcClient::PPB_WebSocket_ReceiveMessage(
-          GetMainSrpcChannel(),
-          ws,
-          callback_id,
-          &pp_error,
-          &sync_read_buffer_size,
-          sync_read_buffer_bytes.get());
-  DebugPrintf("PPB_WebSocket::ReceiveMessage: %s\n",
-      NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    pp_error = PP_ERROR_FAILED;
-
-  if (pp_error != PP_OK_COMPLETIONPENDING) {
-    // Consumes plugin callback and deserialize received data.
-    void* plugin_buffer;
-    PP_Var* plugin_var;
-    PP_CompletionCallback plugin_callback =
-        CompletionCallbackTable::Get()->RemoveCallback(callback_id,
-                                                       &plugin_buffer,
-                                                       &plugin_var);
-    DCHECK(plugin_callback.func == callback.func);
-    DCHECK(plugin_var == message);
-    if (pp_error == PP_OK) {
-      *message = PP_MakeUndefined();
-      if (!DeserializeTo(sync_read_buffer_bytes.get(),
-          sync_read_buffer_size, 1, message))
-        return PP_ERROR_FAILED;
-    }
-  }
-
-  return MayForceCallback(callback, pp_error);
-}
-
-int32_t SendMessage(PP_Resource ws,
-                    PP_Var message) {
-  DebugPrintf("PPB_WebSocket::SendMessage: ws=%"NACL_PRId32"\n", ws);
-
-  nacl_abi_size_t message_size = 0;
-  nacl::scoped_array<char> message_bytes(
-      Serialize(&message, 1, &message_size));
-
-  int32_t pp_error;
-  NaClSrpcError srpc_result =
-      PpbWebSocketRpcClient::PPB_WebSocket_SendMessage(
-          GetMainSrpcChannel(),
-          ws,
-          message_size, message_bytes.get(),
-          &pp_error);
-  DebugPrintf("PPB_WebSocket::SendMessage: %s\n",
-      NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    return PP_ERROR_FAILED;
-  return pp_error;
-}
-
-uint64_t GetBufferedAmount(PP_Resource ws) {
-  DebugPrintf("PPB_WebSocket::GetBufferedAmount: ws=%"NACL_PRId32"\n", ws);
-
-  int64_t buffered_amount = 0;
-  NaClSrpcError srpc_result =
-      PpbWebSocketRpcClient::PPB_WebSocket_GetBufferedAmount(
-          GetMainSrpcChannel(), ws, &buffered_amount);
-  DebugPrintf("PPB_WebSocket::GetBufferedAmount: %s\n",
-      NaClSrpcErrorString(srpc_result));
-
-  return static_cast<uint64_t>(buffered_amount);
-}
-
-uint16_t GetCloseCode(PP_Resource ws) {
-  DebugPrintf("PPB_WebSocket::GetCloseCode: ws=%"NACL_PRId32"\n", ws);
-
-  int32_t close_code = 0;
-  NaClSrpcError srpc_result =
-      PpbWebSocketRpcClient::PPB_WebSocket_GetCloseCode(
-          GetMainSrpcChannel(), ws, &close_code);
-  DebugPrintf("PPB_WebSocket::GetCloseCode: %s\n",
-      NaClSrpcErrorString(srpc_result));
-
-  return static_cast<uint16_t>(close_code);
-}
-
-PP_Var GetCloseReason(PP_Resource ws) {
-  DebugPrintf("PPB_WebSocket::GetCloseReason: ws=%"NACL_PRId32"\n", ws);
-
-  nacl_abi_size_t reason_size = kMaxReturnVarSize;
-  nacl::scoped_array<char> reason_bytes(new char[reason_size]);
-  NaClSrpcError srpc_result =
-      PpbWebSocketRpcClient::PPB_WebSocket_GetCloseReason(
-          GetMainSrpcChannel(), ws, &reason_size, reason_bytes.get());
-  DebugPrintf("PPB_WebSocket::GetCloseReason: %s\n",
-      NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK) {
-    PP_Var reason = PP_MakeUndefined();
-    if (DeserializeTo(reason_bytes.get(), reason_size, 1, &reason))
-      return reason;
-  }
-
-  return PP_MakeUndefined();
-}
-
-PP_Bool GetCloseWasClean(PP_Resource ws) {
-  DebugPrintf(
-      "PPB_WebSocket::GetCloseWasClean: ws=%"NACL_PRId32"\n", ws);
-
-  int32_t was_clean;
-  NaClSrpcError srpc_result =
-      PpbWebSocketRpcClient::PPB_WebSocket_GetCloseWasClean(
-          GetMainSrpcChannel(), ws, &was_clean);
-  DebugPrintf("PPB_WebSocket::GetCloseWasClean: %s\n",
-      NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK && was_clean)
-    return PP_TRUE;
-  return PP_FALSE;
-}
-
-PP_Var GetExtensions(PP_Resource ws) {
-  DebugPrintf("PPB_WebSocket::GetExtensions: ws=%"NACL_PRId32"\n", ws);
-
-  nacl_abi_size_t extensions_size = kMaxReturnVarSize;
-  nacl::scoped_array<char> extensions_bytes(new char[extensions_size]);
-  NaClSrpcError srpc_result =
-      PpbWebSocketRpcClient::PPB_WebSocket_GetExtensions(
-          GetMainSrpcChannel(), ws, &extensions_size, extensions_bytes.get());
-  DebugPrintf("PPB_WebSocket::GetExtensions: %s\n",
-      NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK) {
-    PP_Var extensions = PP_MakeUndefined();
-    if (DeserializeTo(extensions_bytes.get(), extensions_size, 1, &extensions))
-      return extensions;
-  }
-
-  return PP_MakeUndefined();
-}
-
-PP_Var GetProtocol(PP_Resource ws) {
-  DebugPrintf("PPB_WebSocket::GetProtocol: ws=%"NACL_PRId32"\n", ws);
-
-  nacl_abi_size_t protocol_size = kMaxReturnVarSize;
-  nacl::scoped_array<char> protocol_bytes(new char[protocol_size]);
-  NaClSrpcError srpc_result =
-      PpbWebSocketRpcClient::PPB_WebSocket_GetProtocol(
-          GetMainSrpcChannel(), ws, &protocol_size, protocol_bytes.get());
-  DebugPrintf("PPB_WebSocket::GetProtocol: %s\n",
-      NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK) {
-    PP_Var protocol = PP_MakeUndefined();
-    if (DeserializeTo(protocol_bytes.get(), protocol_size, 1, &protocol))
-      return protocol;
-  }
-
-  return PP_MakeUndefined();
-}
-
-PP_WebSocketReadyState GetReadyState(PP_Resource ws) {
-  DebugPrintf(
-      "PPB_WebSocket::GetReadyState: ws=%"NACL_PRId32"\n", ws);
-
-  int32_t ready_state;
-  NaClSrpcError srpc_result =
-      PpbWebSocketRpcClient::PPB_WebSocket_GetReadyState(
-          GetMainSrpcChannel(), ws, &ready_state);
-  DebugPrintf("PPB_WebSocket::GetReadyState: %s\n",
-      NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result != NACL_SRPC_RESULT_OK)
-    return PP_WEBSOCKETREADYSTATE_INVALID;
-  return static_cast<PP_WebSocketReadyState>(ready_state);
-}
-
-PP_Var GetURL(PP_Resource ws) {
-  DebugPrintf("PPB_WebSocket::GetURL: ws=%"NACL_PRId32"\n", ws);
-
-  nacl_abi_size_t url_size = kMaxReturnVarSize;
-  nacl::scoped_array<char> url_bytes(new char[url_size]);
-  NaClSrpcError srpc_result =
-      PpbWebSocketRpcClient::PPB_WebSocket_GetURL(
-          GetMainSrpcChannel(), ws, &url_size, url_bytes.get());
-  DebugPrintf("PPB_WebSocket::GetURL: %s\n",
-      NaClSrpcErrorString(srpc_result));
-
-  if (srpc_result == NACL_SRPC_RESULT_OK) {
-    PP_Var url = PP_MakeUndefined();
-    if (DeserializeTo(url_bytes.get(), url_size, 1, &url))
-      return url;
-  }
-
-  return PP_MakeUndefined();
-}
-
-}  // namespace
-
-const PPB_WebSocket* PluginWebSocket::GetInterface() {
-  static const PPB_WebSocket websocket_interface = {
-    &Create,
-    &IsWebSocket,
-    &Connect,
-    &Close,
-    &ReceiveMessage,
-    &SendMessage,
-    &GetBufferedAmount,
-    &GetCloseCode,
-    &GetCloseReason,
-    &GetCloseWasClean,
-    &GetExtensions,
-    &GetProtocol,
-    &GetReadyState,
-    &GetURL
-  };
-  return &websocket_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_websocket.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_websocket.h
deleted file mode 100644
index 285ec36..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_websocket.h
+++ /dev/null
@@ -1,24 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_WEBSOCKET_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_WEBSOCKET_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/ppb_websocket.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_WebSocket interface.
-class PluginWebSocket {
- public:
-  static const PPB_WebSocket* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginWebSocket);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_WEBSOCKET_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_zoom.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_zoom.cc
deleted file mode 100644
index 176308f..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_zoom.cc
+++ /dev/null
@@ -1,62 +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 "native_client/src/shared/ppapi_proxy/plugin_ppb_zoom.h"
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/dev/ppb_zoom_dev.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "srpcgen/ppb_rpc.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-void ZoomChanged(PP_Instance instance,
-                    double factor) {
-  DebugPrintf("PPB_Zoom::ZoomChanged: "
-              "instance=%"NACL_PRId32"\n", instance);
-
-  NaClSrpcError srpc_result =
-      PpbZoomRpcClient::PPB_Zoom_ZoomChanged(
-          GetMainSrpcChannel(),
-          instance,
-          factor);
-
-  DebugPrintf("PPB_Zoom::ZoomChanged: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-void ZoomLimitsChanged(PP_Instance instance,
-                       double minimum_factor,
-                       double maximum_factor) {
-  DebugPrintf("PPB_Zoom::ZoomLimitsChanged: "
-              "instance=%"NACL_PRId32"\n", instance);
-
-  NaClSrpcError srpc_result =
-      PpbZoomRpcClient::PPB_Zoom_ZoomLimitsChanged(
-          GetMainSrpcChannel(),
-          instance,
-          minimum_factor,
-          maximum_factor);
-
-  DebugPrintf("PPB_Zoom::ZoomLimitsChanged: %s\n",
-              NaClSrpcErrorString(srpc_result));
-}
-
-}  // namespace
-
-const PPB_Zoom_Dev* PluginZoom::GetInterface() {
-  static const PPB_Zoom_Dev zoom_interface = {
-    ZoomChanged,
-    ZoomLimitsChanged
-  };
-  return &zoom_interface;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_zoom.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_zoom.h
deleted file mode 100644
index 1bba063..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_zoom.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_ZOOM_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_ZOOM_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "ppapi/c/dev/ppb_zoom_dev.h"
-
-namespace ppapi_proxy {
-
-// Implements the untrusted side of the PPB_Zoom_Dev interface.
-class PluginZoom {
- public:
-  PluginZoom();
-  static const PPB_Zoom_Dev* GetInterface();
-
- private:
-  NACL_DISALLOW_COPY_AND_ASSIGN(PluginZoom);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_ZOOM_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_find_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_find_rpc_server.cc
deleted file mode 100644
index a5d596e..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_find_rpc_server.cc
+++ /dev/null
@@ -1,67 +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.
-//
-// SRPC-abstraction wrappers around PPP_Scrollbar functions.
-
-#include <string.h>
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/include/portability_process.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/dev/ppp_find_dev.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/ppp.h"
-#include "srpcgen/ppp_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::PPPFindInterface;
-
-void PppFindRpcServer::PPP_Find_StartFind(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    nacl_abi_size_t text_bytes, char* text,
-    int32_t case_sensitive,
-    int32_t* supports_find) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-
-  PP_Bool pp_supports_find = PPPFindInterface()->StartFind(
-      instance,
-      text,
-      PP_FromBool(case_sensitive));
-  *supports_find = PP_ToBool(pp_supports_find);
-
-  DebugPrintf("PPP_Find::StartFind: supports_find=%d\n", *supports_find);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PppFindRpcServer::PPP_Find_SelectFindResult(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    int32_t forward) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-
-  PPPFindInterface()->SelectFindResult(instance, PP_FromBool(forward));
-  DebugPrintf("PPP_Find::SelectFindResult\n");
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PppFindRpcServer::PPP_Find_StopFind(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-
-  PPPFindInterface()->StopFind(instance);
-  DebugPrintf("PPP_Find::StopFind\n");
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_input_event_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_input_event_rpc_server.cc
deleted file mode 100644
index 845b998..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_input_event_rpc_server.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// SRPC-abstraction wrappers around PPB_InputEvent functions.
-
-#include <cstring>
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/include/portability_process.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "native_client/src/shared/ppapi_proxy/input_event_data.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource_tracker.h"
-#include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_var.h"
-#include "ppapi/c/ppp.h"
-#include "ppapi/c/ppp_input_event.h"
-
-using nacl::scoped_ptr;
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::DeserializeTo;
-using ppapi_proxy::InputEventData;
-using ppapi_proxy::PPPInputEventInterface;
-using ppapi_proxy::PluginInputEvent;
-using ppapi_proxy::PluginResource;
-using ppapi_proxy::PluginResourceTracker;
-
-
-void PppInputEventRpcServer::PPP_InputEvent_HandleInputEvent(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    PP_Resource browser_resource,
-    uint32_t event_data_size, char* event_data,
-    uint32_t character_text_size, char* character_text_bytes,
-    // outputs
-    int32_t* handled) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-  *handled = static_cast<int32_t>(PP_FALSE);
-
-  // The browser will immediately release this resource when we return, hence
-  // we use a browser count of 0. If the NaCl instance calls AddRefResource,
-  // the ResourceTracker will inform the browser synchronously, so the resource
-  // will be retained.
-  scoped_refptr<PluginInputEvent> input_event =
-      PluginResource::AdoptAsWithNoBrowserCount<PluginInputEvent>(
-          browser_resource);
-  // Now deserialize the input event data and initialize the local
-  // InputEventData with it. Note that we don't actually use the provided
-  // PP_Resource for anything; we have all the data sent to us immediately to
-  // avoid too much RPC in input event handling calls. Using the browser-
-  // provided resource id, however, guarantees our PP_Resource is unique (since
-  // all other resource ids used in the untrusted side were also provided by
-  // the browser).
-  InputEventData data;
-  std::memcpy(&data, event_data, event_data_size);
-  PP_Var character_text_var = PP_MakeUndefined();
-  DeserializeTo(character_text_bytes, character_text_size, 1,
-                &character_text_var);
-  input_event->Init(data, character_text_var);
-
-  *handled = static_cast<int32_t>(
-      PPPInputEventInterface()->HandleInputEvent(instance, browser_resource));
-  DebugPrintf("PPP_InputEvent::HandleInputEvent: handled=%d\n", handled);
-  // Now release the input, to match the behavior of the browser. If the NaCl
-  // instance wants to retain the input event for any reason (e.g. to share it
-  // to another thread), it must have called AddRefResource by now. If it has
-  // not, then the input event resource will be deleted from
-  // PluginResourceTracker's cache, and because the browser refcount was set to
-  // 0, the resource tracker will *not* tell the browser. When we return, the
-  // browser decrements its local reference count for us.
-  PluginResourceTracker::Get()->UnrefResource(browser_resource);
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_instance_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_instance_rpc_server.cc
deleted file mode 100644
index 3306c69..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_instance_rpc_server.cc
+++ /dev/null
@@ -1,180 +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.
-//
-// SRPC-abstraction wrappers around PPB_Instance functions.
-
-#include <string.h>
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/include/portability_process.h"
-#include "native_client/src/include/nacl_scoped_ptr.h"
-#include "srpcgen/ppp_rpc.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_instance_data.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_ppb_view.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/ppapi_proxy/view_data.h"
-#include "ppapi/c/ppp.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_var.h"
-#include "ppapi/c/ppp_instance.h"
-
-using nacl::scoped_ptr;
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::PluginInstanceData;
-using ppapi_proxy::PluginResource;
-using ppapi_proxy::PluginView;
-using ppapi_proxy::PPPInstanceInterface;
-using ppapi_proxy::ViewData;
-
-namespace {
-
-// Several of the PPAPI methods return booleans.  These boolean values are done
-// using SRPC's int32_t, so to be clearer, we define success and failure.
-// TODO(sehr): fix SRPC's bool type.
-const int32_t kMethodSuccess = 1;
-const int32_t kMethodFailure = 0;
-
-// Build vector of "count" char pointers from a string of NUL-separated tokens.
-// Returns NULL on out of memory or parsing error.
-const char** GetCharpArray(uint32_t count, char* str, uint32_t total_len) {
-  const char** array = new const char *[count];
-  if (array == NULL) {
-    return NULL;
-  }
-  const char* p = const_cast<const char*>(str);
-  for (uint32_t i = 0; i < count; ++i) {
-    array[i] = p;
-    // Find the end of the current array element.
-    while ('\0' != *p) {
-      // We know that p >= str, so the cast preserves sign.
-      if (total_len <= static_cast<uint32_t>(p - str)) {
-        // Reached the end of the string before finding NUL.
-        delete[] array;
-        return NULL;
-      }
-      ++p;
-    }
-    // And find the next starting point (if any).
-    // We know that p >= str, so the cast preserves sign.
-    if (total_len > static_cast<uint32_t>(p - str)) {
-      ++p;
-    }
-  }
-  return array;
-}
-
-}  // namespace
-
-void PppInstanceRpcServer::PPP_Instance_DidCreate(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    int32_t argc,
-    uint32_t argn_bytes, char* argn,
-    uint32_t argv_bytes, char* argv,
-    // outputs
-    int32_t* success) {
-  ppapi_proxy::PluginInstanceData::DidCreate(instance);
-
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  *success = kMethodFailure;
-  // Deserialize the argv and argn strutures.
-  scoped_ptr<const char*> argn_copy(GetCharpArray(argc, argn, argn_bytes));
-  if (argn_copy.get() == NULL) {
-    return;
-  }
-  scoped_ptr<const char*> argv_copy(GetCharpArray(argc, argv, argv_bytes));
-  if (argv_copy.get() == NULL) {
-    return;
-  }
-  bool created = PPPInstanceInterface()->DidCreate(instance,
-                                                   argc,
-                                                   argn_copy.get(),
-                                                   argv_copy.get());
-  DebugPrintf("PPP_Instance::DidCreate: created=%d\n", created);
-  *success = created ? kMethodSuccess : kMethodFailure;
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PppInstanceRpcServer::PPP_Instance_DidDestroy(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance) {
-  ppapi_proxy::PluginInstanceData::DidDestroy(instance);
-
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-  PPPInstanceInterface()->DidDestroy(instance);
-  DebugPrintf("PPP_Instance::DidDestroy\n");
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PppInstanceRpcServer::PPP_Instance_DidChangeView(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance_id,
-    PP_Resource resource,
-    nacl_abi_size_t view_size,
-    char* view_bytes) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-
-  if (view_size != sizeof(ViewData))
-    return;
-  ViewData view_data;
-  memcpy(&view_data, view_bytes, sizeof(ViewData));
-
-  ppapi_proxy::PluginInstanceData* instance_data =
-      ppapi_proxy::PluginInstanceData::FromPP(instance_id);
-  if (!instance_data)
-    return;
-
-  scoped_refptr<PluginView> view =
-      PluginResource::AdoptAsWithNoBrowserCount<PluginView>(resource);
-  view->Init(view_data);
-
-  instance_data->set_last_view_data(view_data);
-
-  PPPInstanceInterface()->DidChangeView(
-      instance_id, resource, &view_data.viewport_rect, &view_data.clip_rect);
-  DebugPrintf("PPP_Instance::DidChangeView\n");
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PppInstanceRpcServer::PPP_Instance_DidChangeFocus(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    bool has_focus) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-  PPPInstanceInterface()->DidChangeFocus(instance, PP_FromBool(has_focus));
-  DebugPrintf("PPP_Instance::DidChangeFocus\n");
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PppInstanceRpcServer::PPP_Instance_HandleDocumentLoad(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    PP_Resource url_loader,
-    // outputs
-    int32_t* success) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-  *success = kMethodFailure;
-  bool handled =
-      PPPInstanceInterface()->HandleDocumentLoad(instance, url_loader);
-  DebugPrintf("PPP_Instance::HandleDocumentLoad: handled=%d\n", handled);
-  *success = handled ? kMethodSuccess : kMethodFailure;
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_messaging_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_messaging_rpc_server.cc
deleted file mode 100644
index b8ef263..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_messaging_rpc_server.cc
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/ppp.h"
-#include "ppapi/c/ppp_messaging.h"
-#include "srpcgen/ppp_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::DeserializeTo;
-using ppapi_proxy::PPPMessagingInterface;
-
-void PppMessagingRpcServer::PPP_Messaging_HandleMessage(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      nacl_abi_size_t message_size, char* message_bytes) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-
-  PP_Var message;
-  if (!DeserializeTo(message_bytes, message_size, 1, &message))
-    return;
-  PPPMessagingInterface()->HandleMessage(instance, message);
-  DebugPrintf("PPP_Messaging::HandleMessage\n");
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_mouse_lock_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_mouse_lock_rpc_server.cc
deleted file mode 100644
index da3220d..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_mouse_lock_rpc_server.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// SRPC-abstraction wrappers around PPP_MouseLock functions.
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/include/portability_process.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/ppp_mouse_lock.h"
-#include "srpcgen/ppp_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::PPPMouseLockInterface;
-
-void PppMouseLockRpcServer::PPP_MouseLock_MouseLockLost(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-
-  PPPMouseLockInterface()->MouseLockLost(instance);
-
-  DebugPrintf("PPP_MouseLock::MouseLockLost");
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_printing_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_printing_rpc_server.cc
deleted file mode 100644
index e529d45..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_printing_rpc_server.cc
+++ /dev/null
@@ -1,127 +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.
-//
-// SRPC-abstraction wrappers around PPP_Printing functions.
-
-#include <string.h>
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/include/portability_process.h"
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/dev/ppp_printing_dev.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/ppp.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::PPPPrintingInterface;
-
-namespace {
-
-const nacl_abi_size_t kPPPrintSettingsBytes =
-    static_cast<nacl_abi_size_t>(sizeof(struct PP_PrintSettings_Dev));
-const nacl_abi_size_t kPPPrintPageNumberRangeBytes =
-    static_cast<nacl_abi_size_t>(sizeof(struct PP_PrintPageNumberRange_Dev));
-
-}  // namespace
-
-void PppPrintingRpcServer::PPP_Printing_QuerySupportedFormats(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    // outputs
-    int32_t* formats) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-
-  uint32_t pp_formats = PPPPrintingInterface()->QuerySupportedFormats(instance);
-  *formats = static_cast<int32_t>(pp_formats);
-
-  DebugPrintf("PPP_Printing::QuerySupportedFormats: "
-              "formats=%"NACL_PRId32"\n", *formats);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PppPrintingRpcServer::PPP_Printing_Begin(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    nacl_abi_size_t print_settings_bytes, char* print_settings,
-    // outputs
-    int32_t* pages_required) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-
-  if (print_settings_bytes != sizeof(struct PP_PrintSettings_Dev))
-    return;
-  struct PP_PrintSettings_Dev* pp_print_settings =
-      reinterpret_cast<struct PP_PrintSettings_Dev*>(print_settings);
-  *pages_required = PPPPrintingInterface()->Begin(instance, pp_print_settings);
-
-  DebugPrintf("PPP_Printing::Begin: pages_required=%"NACL_PRId32"\n",
-              *pages_required);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PppPrintingRpcServer::PPP_Printing_PrintPages(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    nacl_abi_size_t page_ranges_bytes, char* page_ranges,
-    int32_t page_range_count,
-    // outputs
-    PP_Resource* image_data) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-
-  if (page_ranges_bytes < kPPPrintPageNumberRangeBytes * page_range_count)
-    return;
-  struct PP_PrintPageNumberRange_Dev* pp_page_ranges =
-      reinterpret_cast<struct PP_PrintPageNumberRange_Dev*>(page_ranges);
-  *image_data = PPPPrintingInterface()->PrintPages(instance,
-                                                   pp_page_ranges,
-                                                   page_range_count);
-
-  DebugPrintf("PPP_Printing::PrintPages: image_data=%"NACL_PRId32"\n",
-              *image_data);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PppPrintingRpcServer::PPP_Printing_End(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-
-  PPPPrintingInterface()->End(instance);
-
-  DebugPrintf("PPP_Printing::End\n");
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PppPrintingRpcServer::PPP_Printing_IsScalingDisabled(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    // outputs
-    int32_t* /*PP_Bool*/ scaling_disabled) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-
-  PP_Bool pp_scaling_disabled =
-      PPPPrintingInterface()->IsScalingDisabled(instance);
-  *scaling_disabled = PP_ToBool(pp_scaling_disabled);
-
-  DebugPrintf("PPP_Printing::IsScalingDisabled: scaling_disabled=%d\n",
-              pp_scaling_disabled);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_rpc_server.cc
deleted file mode 100644
index de7b7c0..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_rpc_server.cc
+++ /dev/null
@@ -1,151 +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.
-//
-// SRPC-abstraction wrappers around PPP functions.
-
-#include <stdarg.h>
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/include/portability_process.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/ppp.h"
-#include "srpcgen/ppp_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-
-namespace {
-
-const int kInvalidDesc = -1;
-
-// In order to close the upcall socket descriptor when we shut down, we
-// need to remember it.
-// TODO(sehr,polina): This ugly state should be attached to the correct
-// data structure for the plugin module.
-int upcall_socket_fd = kInvalidDesc;
-
-// The plugin will make synchronous calls back to the browser on the main
-// thread.  The service exported from the browser is specified in
-// service_description.
-bool StartMainSrpcChannel(const char* service_description,
-                          NaClSrpcChannel* channel) {
-  NaClSrpcService* service =
-      reinterpret_cast<NaClSrpcService*>(calloc(1, sizeof(*service)));
-  if (NULL == service) {
-    return false;
-  }
-  if (!NaClSrpcServiceStringCtor(service, service_description)) {
-    free(service);
-    return false;
-  }
-  channel->client = service;
-  // Remember the main channel for later calls back from the main thread.
-  ppapi_proxy::SetMainSrpcChannel(channel);
-  return true;
-}
-
-void StopMainSrpcChannel() {
-  NaClSrpcChannel* channel = ppapi_proxy::GetMainSrpcChannel();
-  NaClSrpcService* service = channel->client;
-  NaClSrpcServiceDtor(service);
-  channel->client = NULL;
-  ppapi_proxy::SetMainSrpcChannel(NULL);
-}
-
-// The plugin will make asynchronous calls to the browser on other threads.
-// The service exported on this channel will be gotten by service discovery.
-bool StartUpcallSrpcChannel(NaClSrpcImcDescType upcall_channel_desc) {
-  // Create the upcall srpc client.
-  if (upcall_channel_desc == kInvalidDesc) {
-    return false;
-  }
-  NaClSrpcChannel* upcall_channel = reinterpret_cast<NaClSrpcChannel*>(
-      calloc(1, sizeof(*upcall_channel)));
-  if (NULL == upcall_channel) {
-    return false;
-  }
-  if (!NaClSrpcClientCtor(upcall_channel, upcall_channel_desc)) {
-    free(upcall_channel);
-    return false;
-  }
-  ppapi_proxy::SetUpcallSrpcChannel(upcall_channel);
-  upcall_socket_fd = upcall_channel_desc;
-  return true;
-}
-
-void StopUpcallSrpcChannel() {
-  NaClSrpcChannel* upcall_channel = ppapi_proxy::GetUpcallSrpcChannel();
-  NaClSrpcDtor(upcall_channel);
-  ppapi_proxy::SetUpcallSrpcChannel(NULL);
-  close(upcall_socket_fd);
-  upcall_socket_fd = kInvalidDesc;
-}
-
-}  // namespace
-
-//
-// The following methods are the SRPC dispatchers for ppapi/c/ppp.h.
-//
-
-void PppRpcServer::PPP_InitializeModule(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    PP_Module module,
-    NaClSrpcImcDescType upcall_channel_desc,
-    const char* service_description,
-    int32_t* success) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  DebugPrintf("PPP_InitializeModule: module=%"NACL_PRId32": %s\n",
-              module, service_description);
-  // Set up the service for calling back into the browser.
-  if (!StartMainSrpcChannel(const_cast<const char*>(service_description),
-                            rpc->channel)) {
-    DebugPrintf("PPP_InitializeModule: "
-                "failed to export service on main channel\n");
-    return;
-  }
-  // Set up the upcall channel for calling back into the browser.
-  if (!StartUpcallSrpcChannel(upcall_channel_desc)) {
-    DebugPrintf("PPP_InitializeModule: "
-                "failed to construct upcall channel\n");
-    StopMainSrpcChannel();
-    return;
-  }
-  ppapi_proxy::SetModuleIdForSrpcChannel(rpc->channel, module);
-  *success = ::PPP_InitializeModule(module, ppapi_proxy::GetBrowserInterface);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
-
-void PppRpcServer::PPP_ShutdownModule(NaClSrpcRpc* rpc,
-                                      NaClSrpcClosure* done) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  DebugPrintf("PPP_ShutdownModule\n");
-  // We do NOT call ::PPP_ShutdownModule as it cannot do anything useful
-  // at this point while still having an ability to hang the browser.
-  ppapi_proxy::UnsetModuleIdForSrpcChannel(rpc->channel);
-  StopUpcallSrpcChannel();
-  // TODO(sehr, polina): do we even need this function?
-  // Shouldn't the Dtor be called when nexe's main exits?
-  //StopMainSrpcChannel();
-  // Exit the srpc loop. The server won't answer any more requests.
-  rpc->result = NACL_SRPC_RESULT_BREAK;
-  DebugPrintf("PPP_ShutdownModule: %s\n", NaClSrpcErrorString(rpc->result));
-}
-
-void PppRpcServer::PPP_GetInterface(NaClSrpcRpc* rpc,
-                                    NaClSrpcClosure* done,
-                                    const char* interface_name,
-                                    int32_t* exports_interface_name) {
-  NaClSrpcClosureRunner runner(done);
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  DebugPrintf("PPP_GetInterface('%s')\n", interface_name);
-  // Since the proxy will make calls to proxied interfaces, we need simply
-  // to know whether the plugin exports a given interface.
-  const void* plugin_interface = ::PPP_GetInterface(interface_name);
-  *exports_interface_name = (plugin_interface != NULL);
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_selection_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_selection_rpc_server.cc
deleted file mode 100644
index 618bdc0..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_selection_rpc_server.cc
+++ /dev/null
@@ -1,41 +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.
-//
-// SRPC-abstraction wrappers around PPP_Selection_Dev functions.
-
-#include <string.h>
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/include/portability_process.h"
-#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/dev/ppp_selection_dev.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/ppp.h"
-#include "srpcgen/ppp_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::PPPSelectionInterface;
-using ppapi_proxy::SerializeTo;
-
-void PppSelectionRpcServer::PPP_Selection_GetSelectedText(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    int32_t html,
-    // outputs
-    nacl_abi_size_t* selected_text_bytes, char* selected_text) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-
-  PP_Bool pp_html = PP_FromBool(html);
-  PP_Var pp_selected_text =
-      PPPSelectionInterface()->GetSelectedText(instance, pp_html);
-  if (!SerializeTo(&pp_selected_text, selected_text, selected_text_bytes))
-    return;
-
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_zoom_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_zoom_rpc_server.cc
deleted file mode 100644
index c5a4b8b..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_zoom_rpc_server.cc
+++ /dev/null
@@ -1,35 +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.
-//
-// SRPC-abstraction wrappers around PPP_Zoom functions.
-
-#include <string.h>
-
-#include "native_client/src/include/portability.h"
-#include "native_client/src/include/portability_process.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/dev/ppp_zoom_dev.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/ppp.h"
-#include "srpcgen/ppp_rpc.h"
-
-using ppapi_proxy::DebugPrintf;
-using ppapi_proxy::PPPZoomInterface;
-
-void PppZoomRpcServer::PPP_Zoom_Zoom(
-    NaClSrpcRpc* rpc,
-    NaClSrpcClosure* done,
-    // inputs
-    PP_Instance instance,
-    double factor,
-    int32_t text_only) {
-  rpc->result = NACL_SRPC_RESULT_APP_ERROR;
-  NaClSrpcClosureRunner runner(done);
-
-  PPPZoomInterface()->Zoom(instance, factor, PP_FromBool(text_only));
-
-  DebugPrintf("PPP_Zoom::Zoom");
-  rpc->result = NACL_SRPC_RESULT_OK;
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource.cc
deleted file mode 100644
index d5a076f..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource.cc
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-
-namespace ppapi_proxy {
-
-PluginResource::PluginResource() {
-}
-
-PluginResource::~PluginResource() {
-}
-
-}  // namespace ppapi_proxy
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource.h
deleted file mode 100644
index 91e7933..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource.h
+++ /dev/null
@@ -1,154 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_RESOURCE_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_RESOURCE_H_
-
-#include "native_client/src/include/nacl_base.h"
-#include "native_client/src/include/ref_counted.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource_tracker.h"
-#include "ppapi/c/pp_resource.h"
-
-namespace ppapi_proxy {
-
-// If you inherit from resource, make sure you add the class name here.
-#define FOR_ALL_RESOURCES(F) \
-  F(PluginAudio) \
-  F(PluginAudioConfig) \
-  F(PluginBuffer) \
-  F(PluginFont) \
-  F(PluginGraphics2D) \
-  F(PluginGraphics3D) \
-  F(PluginImageData) \
-  F(PluginInputEvent) \
-  F(PluginNetworkMonitorPrivate) \
-  F(PluginView)
-
-// Forward declaration of PluginResource classes.
-#define DECLARE_RESOURCE_CLASS(RESOURCE) class RESOURCE;
-FOR_ALL_RESOURCES(DECLARE_RESOURCE_CLASS)
-#undef DECLARE_RESOURCE_CLASS
-
-class PluginResource : public nacl::RefCountedThreadSafe<PluginResource> {
- public:
-  PluginResource();
-
-  // Returns NULL if the resource is invalid or is a different type.
-  template<typename T>
-  static scoped_refptr<T> GetAs(PP_Resource res) {
-    // See if we have the resource cached.
-    scoped_refptr<PluginResource> resource =
-        PluginResourceTracker::Get()->GetExistingResource(res);
-
-    return resource ? resource->Cast<T>() : NULL;
-  }
-
-  // Adopt the given PP_Resource as type T. Use this function for resources that
-  // the browser provides to the plugin with an incremented ref count (i.e.,
-  // calls AddRefResource); it initializes the browser refcount to 1 or
-  // increments it if the resource already exists.
-  // Returns NULL if the resource is invalid or is a different type.
-  template<typename T>
-  static scoped_refptr<T> AdoptAs(PP_Resource res);
-
-  // Adopt the given PP_Resource as type T. Use this function for resources
-  // when the browser drops the refcount immediately. These resources are
-  // typically meant to be cached on the plugin side, with little or no
-  // interaction back to the browser. For an example, see PluginInputEvent.
-  // This is like AdoptAs above, except it initializes the browser_refcount to
-  // 0 for resources that are new to the plugin, and does not increment the
-  // browser_refcount for resources that exist.
-  // Returns NULL if the resource is invalid or is a different type.
-  template<typename T>
-  static scoped_refptr<T> AdoptAsWithNoBrowserCount(PP_Resource res);
-
-  // Cast the resource into a specified type. This will return NULL if the
-  // resource does not match the specified type. Specializations of this
-  // template call into As* functions.
-  template <typename T> T* Cast() { return NULL; }
-
- protected:
-  virtual ~PluginResource();
-
-  virtual bool InitFromBrowserResource(PP_Resource resource) = 0;
-
- private:
-  friend class nacl::RefCountedThreadSafe<PluginResource>;
-
-  // Type-specific getters for individual resource types. These will return
-  // NULL if the resource does not match the specified type. Used by the Cast()
-  // function.
-  #define DEFINE_TYPE_GETTER(RESOURCE)  \
-      virtual RESOURCE* As##RESOURCE() { return NULL; }
-  FOR_ALL_RESOURCES(DEFINE_TYPE_GETTER)
-  #undef DEFINE_TYPE_GETTER
-
-  // Call this macro in the derived class declaration to actually implement the
-  // type getter.
-  #define IMPLEMENT_RESOURCE(RESOURCE)  \
-      virtual RESOURCE* As##RESOURCE() { return this; }
-
-  DISALLOW_COPY_AND_ASSIGN(PluginResource);
-};
-
-// Cast() specializations.
-#define DEFINE_RESOURCE_CAST(Type)                         \
-  template <> inline Type* PluginResource::Cast<Type>() {  \
-      return As##Type();                                   \
-  }
-
-FOR_ALL_RESOURCES(DEFINE_RESOURCE_CAST)
-#undef DEFINE_RESOURCE_CAST
-
-#undef FOR_ALL_RESOURCES
-
-template<typename T> scoped_refptr<T>
-PluginResourceTracker::AdoptBrowserResource(PP_Resource res,
-                                            size_t browser_refcount) {
-  ResourceMap::iterator result = live_resources_.find(res);
-  // Do we have it already?
-  if (result == live_resources_.end()) {
-    // No - try to create a new one.
-    scoped_refptr<T> new_resource = new T();
-    if (new_resource->InitFromBrowserResource(res)) {
-      AddResource(new_resource, res, browser_refcount);
-      return new_resource;
-    } else {
-      return scoped_refptr<T>();
-    }
-  } else {
-    // Consume more browser refcounts (unless browser_refcount is 0).
-    result->second.browser_refcount += browser_refcount;
-    return result->second.resource->Cast<T>();
-  }
-}
-
-template<typename T>
-scoped_refptr<T> PluginResource::AdoptAs(PP_Resource res) {
-  // Short-circuit if null resource.
-  if (!res)
-    return NULL;
-
-  // Adopt the resource with 1 browser-side refcount.
-  const size_t browser_refcount = 1;
-  return PluginResourceTracker::Get()->AdoptBrowserResource<T>(
-      res, browser_refcount);
-}
-
-template<typename T>
-scoped_refptr<T> PluginResource::AdoptAsWithNoBrowserCount(PP_Resource res) {
-  // Short-circuit if null resource.
-  if (!res)
-    return NULL;
-
-  // Adopt the resource with 0 browser-side refcount.
-  const size_t browser_refcount = 0;
-  return PluginResourceTracker::Get()->AdoptBrowserResource<T>(
-      res, browser_refcount);
-}
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_RESOURCE_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource_tracker.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource_tracker.cc
deleted file mode 100644
index 3d32513..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource_tracker.cc
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "native_client/src/shared/ppapi_proxy/plugin_resource_tracker.h"
-
-#include <limits>
-#include <set>
-
-#include "base/basictypes.h"
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h"
-#include "ppapi/c/pp_resource.h"
-
-namespace ppapi_proxy {
-
-// static
-PluginResourceTracker* PluginResourceTracker::Get() {
-  CR_DEFINE_STATIC_LOCAL(PluginResourceTracker, tracker, ());
-  return &tracker;
-}
-
-PluginResourceTracker::ResourceAndRefCounts::ResourceAndRefCounts(
-    PluginResource* r, size_t browser_count)
-    : resource(r), browser_refcount(browser_count), plugin_refcount(1) {
-}
-
-PluginResourceTracker::ResourceAndRefCounts::~ResourceAndRefCounts() {
-}
-
-scoped_refptr<PluginResource> PluginResourceTracker::GetExistingResource(
-    PP_Resource res) const {
-  ResourceMap::const_iterator result = live_resources_.find(res);
-  if (result == live_resources_.end())
-    return scoped_refptr<PluginResource>();
-  else
-    return result->second.resource;
-}
-
-PluginResourceTracker::PluginResourceTracker() : last_id_(0) {
-}
-
-void PluginResourceTracker::AddResource(PluginResource* resource,
-                                        PP_Resource id,
-                                        size_t browser_refcount) {
-  // Add the resource with plugin use-count 1.
-  live_resources_.insert(
-      std::make_pair(id, ResourceAndRefCounts(resource, browser_refcount)));
-}
-
-bool PluginResourceTracker::AddRefResource(PP_Resource res) {
-  ResourceMap::iterator i = live_resources_.find(res);
-  if (i == live_resources_.end()) {
-    return false;
-  } else {
-    // We don't protect against overflow, since a plugin as malicious as to ref
-    // once per every byte in the address space could have just as well unrefed
-    // one time too many.
-    i->second.plugin_refcount++;
-    if (i->second.browser_refcount == 0) {
-      // If we don't currently have any refcount with the browser, try to
-      // obtain one.
-      i->second.browser_refcount++;
-      ObtainBrowserResource(res);
-    }
-    return true;
-  }
-}
-
-bool PluginResourceTracker::UnrefResource(PP_Resource res) {
-  ResourceMap::iterator i = live_resources_.find(res);
-  if (i != live_resources_.end()) {
-    i->second.plugin_refcount--;
-    if (0 == i->second.plugin_refcount) {
-      size_t browser_refcount = i->second.browser_refcount;
-      live_resources_.erase(i);
-
-      // Release all browser references.
-      ReleaseBrowserResource(res, browser_refcount);
-    }
-    return true;
-  } else {
-    return false;
-  }
-}
-
-void PluginResourceTracker::ObtainBrowserResource(PP_Resource res) {
-  if (res) {
-    NaClSrpcChannel* channel = ppapi_proxy::GetMainSrpcChannel();
-    PpbCoreRpcClient::PPB_Core_AddRefResource(channel, res);
-  }
-}
-
-void PluginResourceTracker::ReleaseBrowserResource(PP_Resource res,
-                                                   size_t browser_refcount) {
-  // Release all browser references.
-  if (res && (browser_refcount > 0)) {
-    NaClSrpcChannel* channel = ppapi_proxy::GetMainSrpcChannel();
-    PpbCoreRpcClient::ReleaseResourceMultipleTimes(channel, res,
-                                                   browser_refcount);
-  }
-}
-
-}  // namespace ppapi_proxy
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource_tracker.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource_tracker.h
deleted file mode 100644
index 49289cf..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource_tracker.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_
-#define WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_
-
-#include <map>
-#include <utility>
-
-#include "native_client/src/include/nacl_base.h"
-#include "native_client/src/include/ref_counted.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-
-namespace ppapi_proxy {
-
-class PluginResource;
-
-// This class maintains a global list of all live pepper resources. It allows
-// us to check resource ID validity and to map them to a specific module.
-//
-// This object is threadsafe.
-class PluginResourceTracker {
- public:
-  // Returns the pointer to the singleton object.
-  static PluginResourceTracker* Get();
-
-  // PP_Resources --------------------------------------------------------------
-
-  // Increment resource's plugin refcount. See ResourceAndRefCount.
-  bool AddRefResource(PP_Resource res);
-  bool UnrefResource(PP_Resource res);
-
- private:
-  friend class PluginResource;
-
-  // Prohibit creation other then by the Singleton class.
-  PluginResourceTracker();
-
-  // Adds the given resource to the tracker and assigns it a resource ID, local
-  // refcount of 1, and initializes the browser reference count to
-  // |browser_refcount|. Used only by the Resource class.
-  void AddResource(PluginResource* resource, PP_Resource id,
-                   size_t browser_refcount);
-
-  // The returned pointer will be NULL if there is no resource. Note that this
-  // return value is a scoped_refptr so that we ensure the resource is valid
-  // from the point of the lookup to the point that the calling code needs it.
-  // Otherwise, the plugin could Release() the resource on another thread and
-  // the object will get deleted out from under us.
-  scoped_refptr<PluginResource> GetExistingResource(PP_Resource res) const;
-
-  // Get or create a new PluginResource from a browser resource.
-  // If we are already tracking this resource, we bump its browser_refcount to
-  // reflect that we took ownership of it. If this is a new resource, we create
-  // a PluginResource for it with the given browser_refcount.
-  template<typename T> scoped_refptr<T> AdoptBrowserResource(
-      PP_Resource res, size_t browser_refcount);
-
-  // Try to get a browser-side refcount for an existing resource.
-  void ObtainBrowserResource(PP_Resource res);
-
-  // Release browser-side refcount.
-  void ReleaseBrowserResource(PP_Resource res, size_t refcount);
-
-  // Last assigned resource ID.
-  PP_Resource last_id_;
-
-  struct ResourceAndRefCounts {
-    scoped_refptr<PluginResource> resource;
-    size_t browser_refcount;
-    size_t plugin_refcount;
-    ResourceAndRefCounts(PluginResource* r, size_t browser_refcount);
-    ~ResourceAndRefCounts();
-  };
-  typedef std::map<PP_Resource, ResourceAndRefCounts> ResourceMap;
-  ResourceMap live_resources_;
-
-  DISALLOW_COPY_AND_ASSIGN(PluginResourceTracker);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_upcall.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_upcall.cc
deleted file mode 100644
index 8ab8f66..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_upcall.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// This is an early draft of background thread support.
-// Until it is complete, we assume that all proxy functions
-// (except CallOnMainThread) are called on the main PPAPI thread.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-
-#include "native_client/src/shared/ppapi_proxy/plugin_upcall.h"
-
-#include <pthread.h>
-#include <map>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/portability.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_errors.h"
-#include "srpcgen/ppp_rpc.h"
-#include "srpcgen/upcall.h"
-
-using ppapi_proxy::CompletionCallbackTable;
-
-namespace ppapi_proxy {
-
-namespace {
-
-  class CallOnMainThreadCriticalSection {
-    static pthread_mutex_t mutex_;
-   public:
-    CallOnMainThreadCriticalSection() { pthread_mutex_lock(&mutex_); }
-    ~CallOnMainThreadCriticalSection() { pthread_mutex_unlock(&mutex_); }
-  };
-
-  pthread_mutex_t CallOnMainThreadCriticalSection::mutex_ =
-      PTHREAD_MUTEX_INITIALIZER;
-
-}  // namespace
-
-// The call on main thread is implemented via an RPC to the browser side on the
-// upcall channel, instead of locally to the plugin. This is to ensure that
-// when the callback runs (and potentially calls one of the PPB_ methods
-// over RPC), the browser-side is listening.
-void PluginUpcallCoreCallOnMainThread(int32_t delay_in_milliseconds,
-                                      PP_CompletionCallback callback,
-                                      int32_t result) {
-  // Force PluginUpcallCoreCallOnMainThread, from multiple threads, to occur
-  // one at a time.
-  CallOnMainThreadCriticalSection guard;
-  NaClSrpcChannel* upcall_channel = GetUpcallSrpcChannel();
-  if (upcall_channel == NULL) {
-    DebugPrintf("PluginUpcallCoreCallOnMainThread: NULL channel.\n");
-    return;
-  }
-  int32_t callback_id =
-      ppapi_proxy::CompletionCallbackTable::Get()->AddCallback(callback);
-  if (callback_id == 0) {
-    DebugPrintf("PluginUpcallCoreCallOnMainThread: NULL callback.\n");
-    return;
-  }
-  (void) PppUpcallRpcClient::PPB_Core_CallOnMainThread(
-      upcall_channel, delay_in_milliseconds, callback_id, result);
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_upcall.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_upcall.h
deleted file mode 100644
index 71534bd..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_upcall.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// This is an early draft of background thread support.
-// Until it is complete, we assume that all functions proxy functions
-// (but CallOnMainThread) are called on the main thread.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_UPCALL_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_UPCALL_H_
-
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_resource.h"
-
-namespace ppapi_proxy {
-
-// Initialize the plugin side to allow upcalls (calls to the browser from
-// other than the PPAPI main thread).
-int32_t PluginUpcallStartup();
-
-// Shut down the plugin side for upcalls.
-void PluginUpcallShutdown();
-
-// The upcall for PPB_Core.CallOnMainThread.
-void PluginUpcallCoreCallOnMainThread(int32_t delay_in_milliseconds,
-                                      PP_CompletionCallback callback,
-                                      int32_t result);
-
-// The upcall for PPB_Graphics2D.Flush.
-int32_t PluginUpcallGraphics2DFlush(PP_Resource graphics_2d,
-                                    PP_CompletionCallback callback);
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_UPCALL_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy.gyp b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy.gyp
deleted file mode 100644
index 3dc56bf..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy.gyp
+++ /dev/null
@@ -1,94 +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.
-
-{
-  'variables': {
-    'chromium_code': 1,  # Use higher warning level.
-  },
-  'includes': [
-    '../../../../../native_client/build/common.gypi',
-  ],
-  'target_defaults': {
-    'conditions': [
-      ['OS=="linux"', {
-        'cflags!': [
-          '-Wno-unused-parameter', # be a bit stricter to match NaCl flags.
-        ],
-      }],
-      ['OS=="mac"', {
-        'cflags!': [
-          '-Wno-unused-parameter', # be a bit stricter to match NaCl flags.
-        ],
-      }],
-    ],
-  },
-  'targets': [
-    {
-      'target_name': 'nacl_ppapi_browser',
-      'type': 'static_library',
-      'sources': [
-        'browser_callback.cc',
-        'browser_globals.cc',
-        'browser_ppb_audio_config_rpc_server.cc',
-        'browser_ppb_audio_rpc_server.cc',
-        'browser_ppb_core_rpc_server.cc',
-        'browser_ppb_file_io_rpc_server.cc',
-        'browser_ppb_file_ref_rpc_server.cc',
-        'browser_ppb_file_system_rpc_server.cc',
-        'browser_ppb_find_rpc_server.cc',
-        'browser_ppb_font_rpc_server.cc',
-        'browser_ppb_fullscreen_rpc_server.cc',
-        'browser_ppb_gamepad_rpc_server.cc',
-        'browser_ppb_graphics_2d_rpc_server.cc',
-        'browser_ppb_graphics_3d_rpc_server.cc',
-        'browser_ppb_host_resolver_private_rpc_server.cc',
-        'browser_ppb_image_data_rpc_server.cc',
-        'browser_ppb_input_event_rpc_server.cc',
-        'browser_ppb_instance_rpc_server.cc',
-        'browser_ppb_messaging_rpc_server.cc',
-        'browser_ppb_mouse_cursor_rpc_server.cc',
-        'browser_ppb_mouse_lock_rpc_server.cc',
-        'browser_ppb_net_address_private_rpc_server.cc',
-        'browser_ppb_network_list_private_rpc_server.cc',
-        'browser_ppb_network_monitor_private_rpc_server.cc',
-        'browser_ppb_rpc_server.cc',
-        'browser_ppb_tcp_server_socket_private_rpc_server.cc',
-        'browser_ppb_tcp_socket_private_rpc_server.cc',
-        'browser_ppb_testing_rpc_server.cc',
-        'browser_ppb_udp_socket_private_rpc_server.cc',
-        'browser_ppb_url_loader_rpc_server.cc',
-        'browser_ppb_url_request_info_rpc_server.cc',
-        'browser_ppb_url_response_info_rpc_server.cc',
-        'browser_ppb_websocket_rpc_server.cc',
-        'browser_ppb_zoom_rpc_server.cc',
-        'browser_ppp_find.cc',
-        'browser_ppp_input_event.cc',
-        'browser_ppp_instance.cc',
-        'browser_ppp_messaging.cc',
-        'browser_ppp_mouse_lock.cc',
-        'browser_ppp_printing.cc',
-        'browser_ppp_selection.cc',
-        'browser_ppp_zoom.cc',
-        'browser_ppp.cc',
-        'browser_upcall.cc',
-        'input_event_data.cc',
-        'object_serialize.cc',
-        'ppp_instance_combined.cc',
-        'utility.cc',
-        'view_data.cc',
-        # Autogerated files
-        'ppp_rpc_client.cc',
-        'ppb_rpc_server.cc',
-        'upcall_server.cc',
-      ],
-      'include_dirs': [
-        '<(DEPTH)/ppapi/native_client/src/shared/ppapi_proxy/trusted',
-        '<(DEPTH)/ppapi',
-      ],
-      'dependencies': [
-        '<(DEPTH)/ppapi/ppapi.gyp:ppapi_c',
-      ],
-    },
-  ],
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp
deleted file mode 100644
index 0a919b1..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp
+++ /dev/null
@@ -1,119 +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.
-
-{
-  'includes': [
-    '../../../../../native_client/build/common.gypi',
-  ],
-  'targets': [
-    {
-      'target_name': 'ppruntime_lib',
-      'type': 'none',
-      'dependencies': [
-        '<(DEPTH)/native_client/tools.gyp:prep_toolchain',
-        '<(DEPTH)/media/media_untrusted.gyp:shared_memory_support_untrusted',
-      ],
-      'variables': {
-        'nlib_target': 'libppruntime.a',
-        'build_glibc': 0,
-        'build_newlib': 1,
-        'include_dirs': [
-          '<(DEPTH)/gpu',
-          '<(DEPTH)/media',
-          '<(DEPTH)/third_party/khronos',
-          '<(DEPTH)/ppapi/native_client/src/shared/ppapi_proxy/untrusted',
-        ],
-        'sources': [
-          '<(DEPTH)/gpu/command_buffer/common/cmd_buffer_common.cc',
-          '<(DEPTH)/gpu/command_buffer/common/debug_marker_manager.cc',
-          '<(DEPTH)/gpu/command_buffer/common/gles2_cmd_format.cc',
-          '<(DEPTH)/gpu/command_buffer/common/gles2_cmd_utils.cc',
-          '<(DEPTH)/gpu/command_buffer/common/logging.cc',
-
-          '<(DEPTH)/gpu/command_buffer/client/atomicops.cc',
-          '<(DEPTH)/gpu/command_buffer/client/cmd_buffer_helper.cc',
-          '<(DEPTH)/gpu/command_buffer/client/fenced_allocator.cc',
-          '<(DEPTH)/gpu/command_buffer/client/gles2_c_lib.cc',
-          '<(DEPTH)/gpu/command_buffer/client/gles2_cmd_helper.cc',
-          '<(DEPTH)/gpu/command_buffer/client/gles2_implementation.cc',
-          '<(DEPTH)/gpu/command_buffer/client/gles2_interface.cc',
-          '<(DEPTH)/gpu/command_buffer/client/program_info_manager.cc',
-          '<(DEPTH)/gpu/command_buffer/client/transfer_buffer.cc',
-          '<(DEPTH)/gpu/command_buffer/client/gles2_lib.cc',
-          '<(DEPTH)/gpu/command_buffer/client/mapped_memory.cc',
-          '<(DEPTH)/gpu/command_buffer/client/query_tracker.cc',
-          '<(DEPTH)/gpu/command_buffer/client/share_group.cc',
-          '<(DEPTH)/gpu/command_buffer/client/ring_buffer.cc',
-          '<(DEPTH)/gpu/command_buffer/common/id_allocator.cc',
-
-          'command_buffer_nacl.cc',
-          'input_event_data.cc',
-          'object_serialize.cc',
-          'plugin_callback.cc',
-          'plugin_globals.cc',
-          'plugin_instance_data.cc',
-          'plugin_main.cc',
-          'plugin_opengles.cc',
-          'plugin_ppb.cc',
-          'plugin_ppb_audio.cc',
-          'plugin_ppb_audio_config.cc',
-          'plugin_ppb_buffer.cc',
-          'plugin_ppb_core.cc',
-          'plugin_ppb_file_io.cc',
-          'plugin_ppb_file_ref.cc',
-          'plugin_ppb_file_system.cc',
-          'plugin_ppb_find.cc',
-          'plugin_ppb_font.cc',
-          'plugin_ppb_fullscreen.cc',
-          'plugin_ppb_gamepad.cc',
-          'plugin_ppb_graphics_2d.cc',
-          'plugin_ppb_graphics_3d.cc',
-          'plugin_ppb_host_resolver_private.cc',
-          'plugin_ppb_image_data.cc',
-          'plugin_ppb_input_event.cc',
-          'plugin_ppb_instance.cc',
-          'plugin_ppb_memory.cc',
-          'plugin_ppb_messaging.cc',
-          'plugin_ppb_mouse_cursor.cc',
-          'plugin_ppb_mouse_lock.cc',
-          'plugin_ppb_net_address_private.cc',
-          'plugin_ppb_network_list_private.cc',
-          'plugin_ppb_network_monitor_private.cc',
-          'plugin_ppb_tcp_server_socket_private.cc',
-          'plugin_ppb_tcp_socket_private.cc',
-          'plugin_ppb_testing.cc',
-          'plugin_ppb_udp_socket_private.cc',
-          'plugin_ppb_url_loader.cc',
-          'plugin_ppb_url_request_info.cc',
-          'plugin_ppb_url_response_info.cc',
-          'plugin_ppb_var.cc',
-          'plugin_ppb_view.cc',
-          'plugin_ppb_websocket.cc',
-          'plugin_ppb_zoom.cc',
-          'plugin_ppp_find_rpc_server.cc',
-          'plugin_ppp_input_event_rpc_server.cc',
-          'plugin_ppp_instance_rpc_server.cc',
-          'plugin_ppp_messaging_rpc_server.cc',
-          'plugin_ppp_mouse_lock_rpc_server.cc',
-          'plugin_ppp_printing_rpc_server.cc',
-          'plugin_ppp_selection_rpc_server.cc',
-          'plugin_ppp_zoom_rpc_server.cc',
-          'plugin_ppp_rpc_server.cc',
-          'plugin_resource.cc',
-          'plugin_resource_tracker.cc',
-          'plugin_upcall.cc',
-          'ppp_instance_combined.cc',
-          'proxy_var.cc',
-          'proxy_var_cache.cc',
-          'utility.cc',
-          'view_data.cc',
-          # Autogenerated files
-          'ppp_rpc_server.cc',
-          'ppb_rpc_client.cc',
-          'upcall_client.cc'
-        ],
-      },
-    },
-  ],
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb.srpc
deleted file mode 100644
index 91e7679..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb.srpc
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (c) 2010 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC method used to implement PPB_GetInterface method.
-# See ppapi/c/ppb.h for interface details.
-{
- 'name': 'PpbRpc',
- 'rpcs': [
-          # Checks whether the browser exports a specified interface name.
-          {'name': 'PPB_GetInterface',
-           'inputs': [['interface_name', 'string'],
-                     ],
-           'outputs': [['exports_interface_name', 'int32_t'],
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_audio.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_audio.srpc
deleted file mode 100644
index 8e97cfc..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_audio.srpc
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright (c) 2010 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# This file declares the RPC methods used to implement PPB_Audio
-# calls from the plugin.  The functions are described in
-# ppapi/c/ppb_audio.h.
-{
- 'name': 'PpbAudioRpc',
- 'rpcs': [
-          # Implements a call to create an audio resource.
-          # Returns descriptors for memory window, sync socket.
-          {'name': 'PPB_Audio_Create',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['config', 'PP_Resource'],
-                     ],
-           'outputs': [['out_resource', 'PP_Resource'],
-                      ]
-          },
-          # Implements a call to determine IsAudio.
-          {'name': 'PPB_Audio_IsAudio',
-           'inputs': [['resource', 'PP_Resource'],
-                     ],
-           'outputs': [['out_bool', 'int32_t'],
-                      ]
-          },
-          # Implements a call to get current config as resource.
-          {'name': 'PPB_Audio_GetCurrentConfig',
-           'inputs': [['resource', 'PP_Resource'],
-                     ],
-           'outputs': [['out_resource', 'PP_Resource'],
-                      ]
-          },
-          # Implements a call to stop playback.
-          {'name': 'PPB_Audio_StopPlayback',
-           'inputs': [['resource', 'PP_Resource'],
-                     ],
-           'outputs': [['out_bool', 'int32_t'],
-                      ]
-          },
-          # Implements a call to start playback.
-          {'name': 'PPB_Audio_StartPlayback',
-           'inputs': [['resource', 'PP_Resource'],
-                     ],
-           'outputs': [['out_bool', 'int32_t'],
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_audio_config.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_audio_config.srpc
deleted file mode 100644
index 20d33c0..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_audio_config.srpc
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright (c) 2012 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# This file declares the RPC methods used to implement PPB_AudioConfig
-# calls from the plugin.  The functions are described in
-# ppapi/c/ppb_audio_config.h.
-{
- 'name': 'PpbAudioConfigRpc',
- 'rpcs': [
-          # Implements a call to create an audio configuration for stereo output.
-          {'name': 'PPB_AudioConfig_CreateStereo16Bit',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['sample_rate', 'int32_t'],
-                      ['sample_frame_count', 'int32_t'],
-                     ],
-           'outputs': [['resource', 'PP_Resource'],
-                      ]
-          },
-          # Implements a call to check if this is an AudioConfig.
-          {'name': 'PPB_AudioConfig_IsAudioConfig',
-           'inputs': [['resource', 'PP_Resource'],
-                     ],
-           'outputs': [['out_bool', 'int32_t']
-                      ]
-          },
-          # Implements a call to get recommended sample frame count (v1.0)
-          {'name': 'PPB_AudioConfig_RecommendSampleFrameCount_1_0',
-           'inputs': [['request_sample_rate', 'int32_t'],
-                      ['request_sample_frame_count', 'int32_t'],
-                     ],
-           'outputs': [['out_sample_frame_count', 'int32_t']
-                      ]
-          },
-          # Implements a call to get recommended sample frame count
-          {'name': 'PPB_AudioConfig_RecommendSampleFrameCount',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['request_sample_rate', 'int32_t'],
-                      ['request_sample_frame_count', 'int32_t'],
-                     ],
-           'outputs': [['out_sample_frame_count', 'int32_t']
-                      ]
-          },
-          # Implements a call to get the sample rate.
-          {'name': 'PPB_AudioConfig_GetSampleRate',
-           'inputs': [['resource', 'PP_Resource'],
-                     ],
-           'outputs': [['sample_rate', 'int32_t']
-                      ]
-          },
-          # Implements a call to get the obtained sample frame count.
-          {'name': 'PPB_AudioConfig_GetSampleFrameCount',
-           'inputs': [['resource', 'PP_Resource'],
-                     ],
-           'outputs': [['sample_frame_count', 'int32_t'],
-                      ]
-          },
-          # Implements a call to get recommended sample rate
-          {'name': 'PPB_AudioConfig_RecommendSampleRate',
-           'inputs': [['instance', 'PP_Instance'],
-                     ],
-           'outputs': [['sample_rate', 'int32_t']
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_core.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_core.srpc
deleted file mode 100644
index b95a4f5..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_core.srpc
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright (c) 2010 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPB_Core interface.
-# See ppapi/c/ppb_core.h for interface details.
-{
- 'name': 'PpbCoreRpc',
- 'rpcs': [
-          # Implements calls to increment the reference count on a resource.
-          {'name': 'PPB_Core_AddRefResource',
-           'inputs': [['resource', 'PP_Resource'],
-                     ],
-           'outputs': []
-          },
-          # Implements calls to decrement the reference count on a resource.
-          {'name': 'PPB_Core_ReleaseResource',
-           'inputs': [['resource', 'PP_Resource'],
-                     ],
-           'outputs': []
-          },
-          # Implements calls to decrement more than one reference count on a
-          # resource. This does not exist in PPB_Core, we implement it as an
-          # optimization.
-          {'name': 'ReleaseResourceMultipleTimes',
-           'inputs': [['resource', 'PP_Resource'],
-                      ['count', 'int32_t']
-                     ],
-           'outputs': []
-          },
-
-          # MemAlloc and MemFree do not require RPCs to the browser.
-
-          # Implements calls to get the time.
-          {'name': 'PPB_Core_GetTime',
-           'inputs': [],
-           'outputs': [['time', 'double'],
-                      ]
-          },
-          # Implements calls to get the browser time ticks.
-          {'name': 'PPB_Core_GetTimeTicks',
-           'inputs': [],
-           'outputs': [['time_ticks', 'double'],
-                      ]
-          },
-          # To be called from the main thread only!
-          {'name': 'PPB_Core_CallOnMainThread',
-           'inputs': [['delay_in_milliseconds', 'int32_t'],  # int32_t
-                      ['callback_id', 'int32_t'],       # PP_CompletionCallback
-                      ['result', 'int32_t'],            # int32_t
-                     ],
-            'outputs': []
-          },
-
-          # IsMainThread does not require PRCs to the browser.
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_file_io.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_file_io.srpc
deleted file mode 100644
index 470cb4d8..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_file_io.srpc
+++ /dev/null
@@ -1,91 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPB_FileIO calls from the plugin.
-# See ppapi/c/ppb_file_io.h for interface details.
-
-{
-  'name': 'PpbFileIORpc',
-  'rpcs': [
-          {'name': 'PPB_FileIO_Create',
-           'inputs': [['instance', 'PP_Instance'],
-                      ],
-           'outputs': [['resource', 'PP_Resource'],
-                       ]
-          },
-          {'name': 'PPB_FileIO_IsFileIO',
-           'inputs': [['resource', 'PP_Resource'],
-                      ],
-           'outputs': [['success', 'int32_t'],  # PP_Bool
-                       ]
-          },
-          {'name': 'PPB_FileIO_Open',
-           'inputs': [['file_io', 'PP_Resource'],
-                      ['file_ref', 'PP_Resource'],
-                      ['open_flags', 'int32_t'],
-                      ['callback_id', 'int32_t'],
-                      ],
-           'outputs': [['pp_error', 'int32_t'],
-                       ]
-          },
-          {'name': 'PPB_FileIO_Query',
-           'inputs': [['file_io', 'PP_Resource'],
-                      ['bytes_to_read', 'int32_t'],
-                      ['callback_id', 'int32_t'],
-                      ],
-           'outputs': [['info', 'char[]'],  # PP_FileInfo
-                       ['pp_error', 'int32_t'],
-                       ]
-          },
-          {'name': 'PPB_FileIO_Touch',
-           'inputs': [['file_io', 'PP_Resource'],
-                      ['last_access_time', 'double'],  # PP_Time
-                      ['last_modified_time', 'double'],  # PP_Time
-                      ['callback_id', 'int32_t'],
-                      ],
-           'outputs': [['pp_error', 'int32_t'],
-                       ]
-          },
-          {'name': 'PPB_FileIO_Read',
-           'inputs': [['file_io', 'PP_Resource'],
-                      ['offset', 'int64_t'],
-                      ['bytes_to_read', 'int32_t'],
-                      ['callback_id', 'int32_t'],
-                      ],
-           'outputs': [['buffer', 'char[]'],
-                       ['pp_error_or_bytes', 'int32_t'],
-                       ]
-           },
-           {'name': 'PPB_FileIO_Write',
-            'inputs': [['file_io', 'PP_Resource'],
-                       ['offset', 'int64_t'],
-                       ['buffer', 'char[]'],
-                       ['bytes_to_write', 'int32_t'],
-                       ['callback_id', 'int32_t'],
-                       ],
-            'outputs': [['pp_error_or_bytes', 'int32_t'],
-                        ]
-           },
-           {'name': 'PPB_FileIO_SetLength',
-            'inputs': [['file_io', 'PP_Resource'],
-                       ['length', 'int64_t'],
-                       ['callback_id', 'int32_t'],
-                       ],
-            'outputs': [['pp_error', 'int32_t'],
-                        ]
-           },
-           {'name': 'PPB_FileIO_Flush',
-            'inputs': [['file_io', 'PP_Resource'],
-                       ['callback_id', 'int32_t'],
-                       ],
-            'outputs': [['pp_error', 'int32_t'],
-                        ]
-           },
-           {'name': 'PPB_FileIO_Close',
-            'inputs': [['file_io', 'PP_Resource'],
-                       ],
-            'outputs': []
-            }
-           ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_file_ref.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_file_ref.srpc
deleted file mode 100644
index 3775299..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_file_ref.srpc
+++ /dev/null
@@ -1,82 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPB_FileIO calls from the plugin.
-# See ppapi/c/ppb_file_ref.h for interface details.
-
-{
-  'name': 'PpbFileRefRpc',
-  'rpcs': [
-          {'name': 'PPB_FileRef_Create',
-           'inputs': [['file_system', 'PP_Resource'],
-                      ['path', 'char[]'],
-                      ],
-           'outputs': [['resource', 'PP_Resource'],
-                       ]
-          },
-          {'name': 'PPB_FileRef_IsFileRef',
-           'inputs': [['resource', 'PP_Resource'],
-                      ],
-           'outputs': [['success', 'int32_t'],  # PP_Bool
-                       ]
-          },
-          {'name': 'PPB_FileRef_GetFileSystemType',
-           'inputs': [['file_ref', 'PP_Resource'],
-                      ],
-           'outputs': [['file_system_type', 'int32_t'],  # PP_FileSytemType
-                       ]
-          },
-          {'name': 'PPB_FileRef_GetName',
-           'inputs': [['file_ref', 'PP_Resource'],
-                      ],
-           'outputs': [['name', 'char[]'],               # PP_Var
-                       ]
-          },
-          {'name': 'PPB_FileRef_GetPath',
-           'inputs': [['file_ref', 'PP_Resource'],
-                      ],
-           'outputs': [['path', 'char[]'],               # PP_Var
-                       ]
-          },
-          {'name': 'PPB_FileRef_GetParent',
-           'inputs': [['file_ref', 'PP_Resource'],
-                      ],
-           'outputs': [['parent', 'PP_Resource'],
-                       ]
-          },
-          {'name': 'PPB_FileRef_MakeDirectory',
-           'inputs': [['directory_ref', 'PP_Resource'],
-                      ['make_ancestors', 'int32_t'],     # PP_Bool
-                      ['callback_id', 'int32_t'],
-                      ],
-           'outputs': [['pp_error', 'int32_t'],
-                       ]
-          },
-          {'name': 'PPB_FileRef_Touch',
-           'inputs': [['file_ref', 'PP_Resource'],
-                      ['last_access_time', 'double'],    # PP_Time
-                      ['last_modified_time', 'double'],  # PP_Time
-                      ['callback_id', 'int32_t'],
-                      ],
-           'outputs': [['pp_error', 'int32_t'],
-                       ]
-          },
-          {'name': 'PPB_FileRef_Delete',
-           'inputs': [['file_ref', 'PP_Resource'],
-                      ['callback_id', 'int32_t'],
-                      ],
-           'outputs': [['pp_error', 'int32_t'],
-                       ]
-          },
-          {'name': 'PPB_FileRef_Rename',
-           'inputs': [['file_ref', 'PP_Resource'],
-                      ['new_file_ref', 'PP_Resource'],
-                      ['callback_id', 'int32_t'],
-                      ],
-           'outputs': [['pp_error', 'int32_t'],
-                       ]
-          }
-          ]
-}
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_file_system.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_file_system.srpc
deleted file mode 100644
index 266f850..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_file_system.srpc
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPB_FileSystem calls from the plugin.
-# See ppapi/c/ppb_file_system.h for interface details.
-
-{
-  'name': 'PpbFileSystemRpc',
-  'rpcs': [
-          {'name': 'PPB_FileSystem_Create',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['file_system_type', 'int32_t'],   # PP_FileSystemType
-                      ],
-           'outputs': [['resource', 'PP_Resource'],
-                       ]
-          },
-          {'name': 'PPB_FileSystem_IsFileSystem',
-           'inputs': [['resource', 'PP_Resource'],
-                      ],
-           'outputs': [['success', 'int32_t'],  # PP_Bool
-                       ]
-          },
-          {'name': 'PPB_FileSystem_Open',
-           'inputs': [['file_system', 'PP_Resource'],
-                      ['expected_size', 'int64_t'],
-                      ['callback_id', 'int32_t']
-                      ],
-           'outputs': [['pp_error', 'int32_t'],
-                       ]
-          },
-          {'name': 'PPB_FileSystem_GetType',
-           'inputs': [['file_system', 'PP_Resource'],
-                      ],
-           'outputs': [['type', 'int32_t'],  # PP_FileSystemType
-                       ],
-          }
-          ]
-}
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_find.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_find.srpc
deleted file mode 100644
index d3077c3..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_find.srpc
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement the PPB_Find interface.
-# See ppapi/c/dev/ppb_find_dev.h for interface details.
-{
- 'name': 'PpbFindRpc',
- 'rpcs': [
-          {'name': 'PPB_Find_NumberOfFindResultsChanged',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['total', 'int32_t'],
-                      ['final_result', 'int32_t'],  # PP_Bool
-                     ],
-           'outputs': [
-                      ]
-          },
-          {'name': 'PPB_Find_SelectedFindResultChanged',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['index', 'int32_t'],
-                     ],
-           'outputs': [
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_font.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_font.srpc
deleted file mode 100644
index b72bcf1..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_font.srpc
+++ /dev/null
@@ -1,79 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPB_Font calls from the plugin.
-# See ppapi/c/dev/ppb_font_dev.h for interface details.
-{
- 'name': 'PpbFontRpc',
- 'rpcs': [
-          {'name': 'PPB_Font_GetFontFamilies',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                    ],
-           'outputs': [['font_families', 'char[]'],  # PP_Var
-                      ]
-          },
-          {'name': 'PPB_Font_Create',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                      ['description', 'char[]'],    # PP_FontDescription_Dev
-                      ['face', 'char[]'],           # PP_Var, description->face
-                    ],
-           'outputs': [['font', 'PP_Resource'],     # PP_Resource
-                      ]
-          },
-          {'name': 'PPB_Font_IsFont',
-           'inputs': [['resource', 'PP_Resource'],  # PP_Resource
-                     ],
-           'outputs': [['is_font', 'int32_t'],      # PP_Bool
-                      ]
-          },
-          {'name': 'PPB_Font_Describe',
-           'inputs': [['font', 'PP_Resource'],      # PP_Resource
-                     ],
-           'outputs': [['description', 'char[]'],   # PP_FontDescription_Dev
-                       ['face', 'char[]'],          # PP_Var, description->face
-                       ['metrics', 'char[]'],       # PP_FontMetrics_Dev
-                       ['success', 'int32_t'],      # PP_Bool
-                      ]
-          },
-          {'name': 'PPB_Font_DrawTextAt',
-           'inputs': [['font', 'PP_Resource'],      # PP_Resource
-                      ['image_data', 'PP_Resource'],  # PP_Resource
-                      ['text_run', 'char[]'],       # PP_TextRun_Dev
-                      ['text', 'char[]'],           # PP_Var, text_run->text
-                      ['position', 'char[]'],       # PP_Point
-                      ['color', 'int32_t'],         # uint32_t
-                      ['clip', 'char[]'],           # PP_Rect
-                      ['image_data_is_opaque', 'int32_t'],  # PP_Bool
-                     ],
-           'outputs': [['success', 'int32_t'],      # PP_Bool
-                      ]
-          },
-          {'name': 'PPB_Font_MeasureText',
-           'inputs': [['font', 'PP_Resource'],      # PP_Resource
-                      ['text_run', 'char[]'],       # PP_TextRun_Dev
-                      ['text', 'char[]'],           # PP_Var, text_run->text
-                     ],
-           'outputs': [['width', 'int32_t'],        # int32_t
-                      ]
-          },
-          {'name': 'PPB_Font_CharacterOffsetForPixel',
-           'inputs': [['font', 'PP_Resource'],      # PP_Resource
-                      ['text_run', 'char[]'],       # PP_TextRun_Dev
-                      ['text', 'char[]'],           # PP_Var, text_run->text
-                      ['pixel_position', 'int32_t'],  # int32_t
-                     ],
-           'outputs': [['offset', 'int32_t'],       # uint32_t
-                      ]
-          },
-          {'name': 'PPB_Font_PixelOffsetForCharacter',
-           'inputs': [['font', 'PP_Resource'],      # PP_Resource
-                      ['text_run', 'char[]'],       # PP_TextRun_Dev
-                      ['text', 'char[]'],           # PP_Var, text_run->text
-                      ['char_offset', 'int32_t'],   # uint32_t
-                     ],
-           'outputs': [['offset', 'int32_t'],       # int32_t
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_fullscreen.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_fullscreen.srpc
deleted file mode 100644
index 19ac4aa..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_fullscreen.srpc
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPB_Fullscreen interface.
-# See ppapi/c/dev/ppb_fullscreen.h for interface details.
-{
- 'name': 'PpbFullscreenRpc',
- 'rpcs': [
-          {'name': 'PPB_Fullscreen_SetFullscreen',
-           'inputs': [['instance', 'PP_Instance'],    # PP_Instance
-                      ['fullscreen', 'int32_t'],      # PP_Bool
-                     ],
-           'outputs': [['success', 'int32_t'],        # PP_Bool
-	              ]
-          },
-          {'name': 'PPB_Fullscreen_GetScreenSize',
-           'inputs': [['instance', 'PP_Instance'],    # PP_Instance
-                     ],
-           'outputs': [['size', 'char[]'],            # PP_Size*
-                       ['success', 'int32_t'],        # PP_Bool
-	              ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_gamepad.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_gamepad.srpc
deleted file mode 100644
index 19fdf53..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_gamepad.srpc
+++ /dev/null
@@ -1,15 +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.
-
-# RPC methods used to implement PPB_Gamepad interface.
-# See ppapi/c/ppb_gamepad.h for interface details.
-{
- 'name': 'PpbGamepadRpc',
- 'rpcs': [
-          {'name': 'PPB_Gamepad_Sample',
-           'inputs': [['instance', 'PP_Instance']],
-           'outputs': [['data', 'char[]']]            # PP_GamepadsSampleData
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_graphics_2d.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_graphics_2d.srpc
deleted file mode 100644
index a5d9199..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_graphics_2d.srpc
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright (c) 2010 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# RPC methods used to implement PPB_Graphics2D interface.
-# See ppapi/c/ppb_graphics_2d.h for interface details.
-
-{
- 'name': 'PpbGraphics2DRpc',
- 'rpcs': [
-          {'name': 'PPB_Graphics2D_Create',
-           'inputs': [['instance', 'PP_Instance'],       # PP_Instance
-                      ['size', 'char[]'],                # PP_Size
-                      ['is_always_opaque', 'int32_t'],   # PP_Bool
-                     ],
-           'outputs': [['resource', 'PP_Resource'],      # PP_Resource
-                      ]
-          },
-          {'name': 'PPB_Graphics2D_IsGraphics2D',
-           'inputs': [['resource', 'PP_Resource'],       # PP_Resource
-                     ],
-           'outputs': [['success', 'int32_t'],           # PP_Bool
-                      ]
-          },
-          {'name': 'PPB_Graphics2D_Describe',
-           'inputs': [['graphics_2d', 'PP_Resource'],    # PP_Resource
-                     ],
-           'outputs': [['size', 'char[]'],               # PP_Size
-                       ['is_always_opaque', 'int32_t'],  # PP_Bool
-                       ['success', 'int32_t'],           # PP_Bool
-                      ]
-          },
-          {'name': 'PPB_Graphics2D_PaintImageData',
-           'inputs': [['graphics_2d', 'PP_Resource'],    # PP_Resource
-                      ['image', 'PP_Resource'],          # PP_Resource
-                      ['top_left', 'char[]'],            # PP_Point
-                      ['src_rect', 'char[]'],            # PP_Rect
-                     ],
-           'outputs': []
-          },
-          {'name': 'PPB_Graphics2D_Scroll',
-           'inputs': [['graphics_2d', 'PP_Resource'],    # PP_Resource
-                      ['clip_rect', 'char[]'],           # PP_Rect
-                      ['amount', 'char[]'],              # PP_Point
-                     ],
-           'outputs': []
-          },
-          {'name': 'PPB_Graphics2D_ReplaceContents',
-           'inputs': [['graphics_2d', 'PP_Resource'],    # PP_Resource
-                      ['image', 'PP_Resource'],          # PP_Resource
-                     ],
-           'outputs': []
-          },
-          {'name': 'PPB_Graphics2D_Flush',
-           'inputs': [['graphics_2d', 'PP_Resource'],    # PP_Resource
-                      ['callback_id', 'int32_t'],        # PP_CompletionCallback
-                     ],
-           'outputs': [['pp_error', 'int32_t'],          # int32_t
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_graphics_3d.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_graphics_3d.srpc
deleted file mode 100644
index 0cb9b57..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_graphics_3d.srpc
+++ /dev/null
@@ -1,146 +0,0 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# This file declares the RPC methods used to implement the Pepper 3D drawing
-# API.
-# TODO(neb): Figure what the threading model really is. Keep the following
-# comment here until then, although it may be wrong:
-# All of the following RPC methods are invoked on the NPAPI thread from
-# untrusted code.  This means, due to the Pepper threading model, that they
-# may only be invoked by code that is called from the JavaScript foreground
-# thread in the renderer.
-{
- 'name': 'PpbGraphics3DRpc',
- 'rpcs': [
-          # For PPB_Graphics3D.GetAttribMaxValue(...)
-          {'name': 'PPB_Graphics3D_GetAttribMaxValue',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['attribute', 'int32_t']
-                     ],
-           'outputs': [['value', 'int32_t'],
-                       ['pp_error', 'int32_t']
-                      ],
-          },
-          # For PPB_Graphics3D.Create(...)
-          {'name': 'PPB_Graphics3D_Create',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['share_context', 'PP_Resource'],
-                      ['attrib_list', 'int32_t[]']
-                     ],
-           'outputs': [['resource_id', 'PP_Resource']
-                      ],
-          },
-          # For PPB_Graphics3D.GetAttribs(...)
-          {'name': 'PPB_Graphics3D_GetAttribs',
-           'inputs': [['context', 'PP_Resource'],
-                      ['input_attrib_list', 'int32_t[]']
-                     ],
-           'outputs': [['output_attrib_list', 'int32_t[]'],
-                       ['pp_error', 'int32_t']
-                      ],
-          },
-          # For PPB_Graphics3D.SetAttribs(...)
-          {'name': 'PPB_Graphics3D_SetAttribs',
-           'inputs': [['context', 'PP_Resource'],
-                      ['attrib_list', 'int32_t[]']
-                     ],
-           'outputs': [['pp_error', 'int32_t']
-                      ],
-          },
-          # For PPB_Graphics3D.GetError(...)
-          {'name': 'PPB_Graphics3D_GetError',
-           'inputs': [['context', 'PP_Resource']
-                     ],
-           'outputs': [['pp_error', 'int32_t']
-                      ],
-          },
-          # For PPB_Graphics3D.SwapBuffers(...)
-          {'name': 'PPB_Graphics3D_SwapBuffers',
-           'inputs': [['context', 'PP_Resource'],
-                      ['callback_id', 'int32_t']
-                     ],
-           'outputs': [['pp_error', 'int32_t']
-                      ],
-          },
-          # End of PPB_Graphics3D.
-
-          # Start of PPB_Graphics3DTrusted.
-          # Create a Graphics3D context.
-          {'name': 'PPB_Graphics3DTrusted_CreateRaw',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['share_context', 'PP_Resource'],
-                      ['attrib_list', 'int32_t[]']
-                     ],
-           'outputs': [['resource_id', 'PP_Resource']]
-          },
-          # Initialize the command buffer.
-          {'name': 'PPB_Graphics3DTrusted_InitCommandBuffer',
-           'inputs': [['resource_id', 'PP_Resource'],
-                      ],
-           'outputs': [['success', 'int32_t']]  # PP_Bool
-          },
-          # Set the buffer used for commands.
-          {'name': 'PPB_Graphics3DTrusted_SetGetBuffer',
-           'inputs': [['resource_id', 'PP_Resource'],
-                      ['shm_id', 'int32_t'],
-                     ],
-           'outputs': []
-          },
-          # Get command buffer state.
-          {'name': 'PPB_Graphics3DTrusted_GetState',
-           'inputs': [['resource_id', 'PP_Resource']],
-           'outputs': [['state', 'char[]'],          # PP_Graphics3DTrustedState
-                      ]
-          },
-          # Flush async.
-          {'name': 'PPB_Graphics3DTrusted_Flush',
-           'inputs': [['resource_id', 'PP_Resource'],
-                      ['put_offset', 'int32_t']
-                      ],
-           'outputs': []
-          },
-          # Flush sync.
-          {'name': 'PPB_Graphics3DTrusted_FlushSync',
-           'inputs': [['resource_id', 'PP_Resource'],
-                      ['put_offset', 'int32_t']
-                      ],
-           'outputs': [['state', 'char[]'],          # PP_Graphics3DTrustedState
-                      ]
-          },
-          # Flush sync fast.
-          {'name': 'PPB_Graphics3DTrusted_FlushSyncFast',
-           'inputs': [['resource_id', 'PP_Resource'],
-                      ['put_offset', 'int32_t'],
-                      ['last_known_offset', 'int32_t']
-                      ],
-           'outputs': [['state', 'char[]'],          # PP_Graphics3DTrustedState
-                      ]
-          },
-          # Create a shared memory transfer buffer.
-          {'name': 'PPB_Graphics3DTrusted_CreateTransferBuffer',
-           'inputs': [['resource_id', 'PP_Resource'],
-                      ['size', 'int32_t'],
-                      ['request_id', 'int32_t']
-                     ],
-           'outputs': [['id', 'int32_t']]
-          },
-          # Destroy a shared memory transfer buffer.
-          {'name': 'PPB_Graphics3DTrusted_DestroyTransferBuffer',
-           'inputs': [['resource_id', 'PP_Resource'],
-                      ['id', 'int32_t'],
-                     ],
-           'outputs': []
-          },
-          # Get a shared memory transfer buffer.
-          {'name': 'PPB_Graphics3DTrusted_GetTransferBuffer',
-           'inputs': [['resource_id', 'PP_Resource'],
-                      ['id', 'int32_t'],
-                     ],
-           'outputs': [['shm_desc', 'handle'],
-                       ['shm_size', 'int32_t']
-                      ]
-          },
-          # End of PPB_Graphics3DTrusted
-        ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_host_resolver_private.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_host_resolver_private.srpc
deleted file mode 100644
index a5d733d..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_host_resolver_private.srpc
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright (c) 2012 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# RPC methods used to implement PPB_HostResolver_Private calls from
-# the plugin.  See ppapi/c/private/ppb_host_resolver_private.h for
-# interface details.
-
-{
-  'name': 'PpbHostResolverPrivateRpc',
-  'rpcs': [
-    {'name': 'PPB_HostResolver_Private_Create',
-     'inputs': [['instance', 'PP_Instance'],
-               ],
-     'outputs': [['resource', 'PP_Resource'],
-                ]
-    },
-    {'name': 'PPB_HostResolver_Private_IsHostResolver',
-     'inputs': [['resource', 'PP_Resource'],
-                ],
-     'outputs': [['is_host_resolver', 'int32_t'],     # PP_Bool
-                 ]
-    },
-    {'name': 'PPB_HostResolver_Private_Resolve',
-     'inputs': [['host_resolver', 'PP_Resource'],
-                ['host', 'string'],                   # const char*
-                ['port', 'int32_t'],                  # uint16_t
-                ['hint', 'char[]'],        # const PP_HostResolver_Private_Hint*
-                ['callback_id', 'int32_t']            # PP_CompletionCallback
-               ],
-     'outputs': [['pp_error', 'int32_t'],
-                ]
-    },
-    {'name': 'PPB_HostResolver_Private_GetCanonicalName',
-     'inputs': [['host_resolver', 'PP_Resource'],
-               ],
-     'outputs': [['canonical_name', 'char[]']         # PP_Var
-                ]
-    },
-    {'name': 'PPB_HostResolver_Private_GetSize',
-     'inputs': [['host_resolver', 'PP_Resource'],
-               ],
-     'outputs': [['size', 'int32_t'],                 # uint32_t
-                ]
-    },
-    {'name': 'PPB_HostResolver_Private_GetNetAddress',
-     'inputs': [['host_resolver', 'PP_Resource'],
-                ['index', 'int32_t'],                 # uint32_t
-               ],
-     'outputs': [['addr', 'char[]'],                  # PP_NetAddress_Private*
-                 ['success', 'int32_t'],              # PP_Bool
-                ]
-    }
-  ]
-}
\ No newline at end of file
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_image_data.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_image_data.srpc
deleted file mode 100644
index ba2376a..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_image_data.srpc
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) 2010 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# This file declares the RPC methods used to implement PPB_ImageData calls from
-# the plugin.  The functions are described in ppapi/c/ppb_image_data.h.
-{
- 'name': 'PpbImageDataRpc',
- 'rpcs': [
-          {'name': 'PPB_ImageData_GetNativeImageDataFormat',
-           'inputs': [],
-           'outputs': [['format', 'int32_t'],
-                      ]
-          },
-          {'name': 'PPB_ImageData_IsImageDataFormatSupported',
-           'inputs': [['format', 'int32_t'],
-                     ],
-           'outputs': [['success', 'int32_t'],
-                      ]
-          },
-          {'name': 'PPB_ImageData_Create',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['format', 'int32_t'],
-                      ['size', 'char[]'],           # PP_Size
-                      ['init_to_zero', 'int32_t'],
-                     ],
-           'outputs': [['resource', 'PP_Resource'],
-                      ]
-          },
-          {'name': 'PPB_ImageData_IsImageData',
-           'inputs': [['resource', 'PP_Resource'],
-                     ],
-           'outputs': [['success', 'int32_t'],
-                      ]
-          },
-          {'name': 'PPB_ImageData_Describe',
-           'inputs': [['resource', 'PP_Resource'],
-                     ],
-           'outputs': [['desc', 'char[]'],          # PP_ImageDataDesc
-                       ['shm', 'handle'],
-                       ['shm_size', 'int32_t'],
-                       ['success', 'int32_t'],
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_input_event.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_input_event.srpc
deleted file mode 100644
index 71c2cc74..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_input_event.srpc
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement the PPB_InputEvent interface.
-# See ppapi/c/ppb_input_event.h for interface details.
-{
- 'name': 'PpbInputEventRpc',
- 'rpcs': [
-          {'name': 'PPB_InputEvent_RequestInputEvents',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                      ['event_classes', 'int32_t'],  # uint32_t, bitfield
-                      ['filtered', 'int32_t']  # bool
-                     ],
-           'outputs': [['success', 'int32_t'],  # pp_error value
-                      ]
-          },
-          {'name': 'PPB_InputEvent_ClearInputEventRequest',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                      ['event_classes', 'int32_t']  # uint32_t, bitfield
-                     ],
-           'outputs': []
-          },
-          {'name': 'PPB_InputEvent_CreateMouseInputEvent',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                      ['type', 'int32_t'],  # PP_InputEvent_Type
-                      ['time_stamp', 'double'],  # PP_TimeTicks
-                      ['modifiers', 'int32_t'],  # uint32_t
-                      ['mouse_button', 'int32_t'],  # PP_InputEvent_MouseButton
-                      ['mouse_position_x', 'int32_t'],  # PP_Point.x
-                      ['mouse_position_y', 'int32_t'],  # PP_Point.y
-                      ['click_count', 'int32_t'],
-                      ['mouse_movement_x', 'int32_t'],  # PP_Point.x
-                      ['mouse_movement_y', 'int32_t'],  # PP_Point.y
-                     ],
-           'outputs': [['resource_id', 'PP_Resource']]
-          },
-          {'name': 'PPB_InputEvent_CreateWheelInputEvent',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                      ['time_stamp', 'double'],  # PP_TimeTicks
-                      ['modifiers', 'int32_t'],  # uint32_t
-                      ['wheel_delta_x', 'double'],  # PP_FloatPoint.x
-                      ['wheel_delta_y', 'double'],  # PP_FloatPoint.y
-                      ['wheel_ticks_x', 'double'],  # PP_FloatPoint.x
-                      ['wheel_ticks_y', 'double'],  # PP_FloatPoint.y
-                      ['scroll_by_page', 'int32_t']  # PP_Bool
-                     ],
-           'outputs': [['resource_id', 'PP_Resource']]
-          },
-          {'name': 'PPB_InputEvent_CreateKeyboardInputEvent',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                      ['type', 'int32_t'],  # PP_InputEvent_Type
-                      ['time_stamp', 'double'],  # PP_TimeTicks
-                      ['modifiers', 'int32_t'],  # uint32_t
-                      ['key_code', 'int32_t'],  # uint32_t
-                      ['character_text', 'char[]']  # String PP_Var
-                     ],
-           'outputs': [['resource_id', 'PP_Resource']]
-          }
-
-         ]
-}
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_instance.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_instance.srpc
deleted file mode 100644
index ba0e8eb..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_instance.srpc
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (c) 2010 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPB_Instance interface.
-# See ppapi/c/ppb_instance.h for interface details.
-{
- 'name': 'PpbInstanceRpc',
- 'rpcs': [
-          {'name': 'PPB_Instance_BindGraphics',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                      ['graphics_device', 'PP_Resource'],  # PP_Resource
-                     ],
-           'outputs': [['success', 'int32_t'],  # PP_Bool
-                      ]
-          },
-          {'name': 'PPB_Instance_IsFullFrame',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                     ],
-           'outputs': [['is_full_frame', 'int32_t'],  # PP_Bool
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_messaging.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_messaging.srpc
deleted file mode 100644
index 03333b6..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_messaging.srpc
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPB_Messaging interface.
-# See ppapi/c/ppb_messaging.h for interface details.
-{
- 'name': 'PpbMessagingRpc',
- 'rpcs': [
-          {'name': 'PPB_Messaging_PostMessage',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                      ['message', 'char[]'],  # PP_Var
-                     ],
-           'outputs': []
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_mouse_cursor.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_mouse_cursor.srpc
deleted file mode 100644
index 474e68b..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_mouse_cursor.srpc
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# RPC methods used to implement PPB_MouseCursor calls from the plugin.
-
-{
- 'name': 'PpbMouseCursorRpc',
- 'rpcs': [
-          {'name': 'PPB_MouseCursor_SetCursor',
-           'inputs': [['instance', 'PP_Instance'],      # PP_Instance
-                      ['type', 'int32_t'],              # PP_MouseCursor_Type
-                      ['custom_image', 'PP_Resource'],  # PP_Resource
-                      ['hot_spot', 'char[]'],           # PP_Point
-                     ],
-           'outputs': [['success', 'int32_t'],          # PP_Bool
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_mouse_lock.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_mouse_lock.srpc
deleted file mode 100644
index ffa601c..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_mouse_lock.srpc
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# RPC methods used to implement PPB_MouseLock calls from the plugin.
-# See ppapi/c/ppb_mouse_lock.h for interface details.
-
-{
- 'name': 'PpbMouseLockRpc',
- 'rpcs': [
-          {'name': 'PPB_MouseLock_LockMouse',
-           'inputs': [['instance', 'PP_Instance'],    # PP_Instance
-                      ['callback_id', 'int32_t'],     # PP_CompletionCallback
-                     ],
-           'outputs': [['pp_error', 'int32_t'],
-                      ]
-          },
-          {'name': 'PPB_MouseLock_UnlockMouse',
-           'inputs': [['instance', 'PP_Instance'],    # PP_Instance
-                     ],
-           'outputs': []
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_net_address_private.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_net_address_private.srpc
deleted file mode 100644
index 0ac722b..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_net_address_private.srpc
+++ /dev/null
@@ -1,88 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# RPC methods used to implement PPB_NetAddress_Private calls from the plugin.
-# See ppapi/c/private/ppb_net_address_private.h for interface details.
-
-{
-  'name': 'PpbNetAddressPrivateRpc',
-  'rpcs': [
-    {'name': 'PPB_NetAddress_Private_AreEqual',
-     'inputs': [['addr1', 'char[]'],                 # PP_NetAddress_Private*
-                ['addr2', 'char[]'],                 # PP_NetAddress_Private*
-               ],
-     'outputs': [['equals', 'int32_t'],              # PP_Bool
-                ]
-    },
-    {'name': 'PPB_NetAddress_Private_AreHostsEqual',
-     'inputs': [['addr1', 'char[]'],                 # PP_NetAddress_Private*
-                ['addr2', 'char[]'],                 # PP_NetAddress_Private*
-               ],
-     'outputs': [['equals', 'int32_t'],              # PP_Bool
-                ]
-    },
-    {'name': 'PPB_NetAddress_Private_Describe',
-     'inputs': [['module', 'int32_t'],               # PP_Module
-                ['addr', 'char[]'],                  # PP_NetAddress_Private*
-                ['include_port', 'int32_t'],         # PP_Bool
-               ],
-     'outputs': [['description', 'char[]'],          # PP_Var
-                ]
-    },
-    {'name': 'PPB_NetAddress_Private_ReplacePort',
-     'inputs': [['src_addr', 'char[]'],              # PP_NetAddress_Private*
-                ['port', 'int32_t'],                 # uint16_t
-               ],
-     'outputs': [['dst_addr', 'char[]'],             # PP_NetAddress_Private*
-                 ['success', 'int32_t'],             # PP_Bool
-                ]
-    },
-    {'name': 'PPB_NetAddress_Private_GetAnyAddress',
-     'inputs': [['is_ipv6', 'int32_t'],              # PP_Bool
-               ],
-     'outputs': [['addr', 'char[]'],                 # PP_NetAddress_Private*
-                ]
-    },
-    {'name': 'PPB_NetAddress_Private_GetFamily',
-     'inputs': [['addr', 'char[]'],                  # PP_NetAddress_Private*
-               ],
-     'outputs': [['addr_family', 'int32_t'],  # PP_NetAddressFamily_Private
-                ]
-    },
-    {'name': 'PPB_NetAddress_Private_GetPort',
-     'inputs': [['addr', 'char[]'],                  # PP_NetAddress_Private*
-               ],
-     'outputs': [['port', 'int32_t'],                # uint16_t
-                ]
-    },
-    {'name': 'PPB_NetAddress_Private_GetAddress',
-     'inputs': [['addr', 'char[]'],                  # PP_NetAddress_Private*
-               ],
-     'outputs': [['address', 'char[]'],
-                 ['success', 'int32_t'],             # PP_Bool
-                ]
-    },
-    {'name': 'PPB_NetAddress_Private_GetScopeID',
-     'inputs': [['addr', 'char[]'],                  # PP_NetAddress_Private*
-               ],
-     'outputs': [['scope_id', 'int32_t'],            # uint32_t
-                ]
-    },
-    {'name': 'PPB_NetAddress_Private_CreateFromIPv4Address',
-     'inputs': [['ip', 'char[]'],                   # uint8_t[4]
-                ['port', 'int32_t'],                # uint16_t
-               ],
-     'outputs': [['addr', 'char[]'],                 # PP_NetAddress_Private*
-                ]
-    },
-    {'name': 'PPB_NetAddress_Private_CreateFromIPv6Address',
-     'inputs': [['ip', 'char[]'],                   # uint8_t[16]
-                ['scope_id', 'int32_t'],            # uint32_t
-                ['port', 'int32_t'],                # uint16_t
-               ],
-     'outputs': [['addr', 'char[]'],                 # PP_NetAddress_Private*
-                ]
-    },
-   ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_network_list_private.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_network_list_private.srpc
deleted file mode 100644
index 086f1bc..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_network_list_private.srpc
+++ /dev/null
@@ -1,68 +0,0 @@
-# Copyright (c) 2012 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# This file declares the RPC methods used to implement
-# PPB_NetworkList_Private calls from the plugin.  The functions are described
-# in ppapi/c/private/ppb_network_list.h.
-
-{
- 'name': 'PpbNetworkListPrivate',
- 'rpcs': [
-          {'name': 'PPB_NetworkList_Private_IsNetworkList',
-           'inputs': [['resource', 'PP_Resource'],
-                     ],
-           'outputs': [['out_bool', 'int32_t'],
-                      ]
-          },
-          {'name': 'PPB_NetworkList_Private_GetCount',
-           'inputs': [['resource', 'PP_Resource'],
-                     ],
-           'outputs': [['count', 'int32_t'],
-                      ]
-          },
-          {'name': 'PPB_NetworkList_Private_GetName',
-           'inputs': [['resource', 'PP_Resource'],
-                      ['index', 'int32_t'],
-                     ],
-           'outputs': [['name', 'char[]'],
-                      ]
-          },
-          {'name': 'PPB_NetworkList_Private_GetType',
-           'inputs': [['resource', 'PP_Resource'],
-                      ['index', 'int32_t'],
-                     ],
-           'outputs': [['type', 'int32_t'],
-                      ]
-          },
-          {'name': 'PPB_NetworkList_Private_GetState',
-           'inputs': [['resource', 'PP_Resource'],
-                      ['index', 'int32_t'],
-                     ],
-           'outputs': [['state', 'int32_t'],
-                      ]
-          },
-          {'name': 'PPB_NetworkList_Private_GetIpAddresses',
-           'inputs': [['resource', 'PP_Resource'],
-                      ['index', 'int32_t'],
-                     ],
-           'outputs': [['addr', 'char[]'],  # PP_NetAddress_Private[]
-                       ['addresses_count', 'int32_t'],
-                      ]
-          },
-          {'name': 'PPB_NetworkList_Private_GetDisplayName',
-           'inputs': [['resource', 'PP_Resource'],
-                      ['index', 'int32_t'],
-                     ],
-           'outputs': [['display_name', 'char[]'],
-                      ]
-          },
-          {'name': 'PPB_NetworkList_Private_GetMTU',
-           'inputs': [['resource', 'PP_Resource'],
-                      ['index', 'int32_t'],
-                     ],
-           'outputs': [['mtu', 'int32_t'],
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_network_monitor_private.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_network_monitor_private.srpc
deleted file mode 100644
index e2a4d54..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_network_monitor_private.srpc
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (c) 2012 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# This file declares the RPC methods used to implement
-# PPB_NetworkMonitor_Private calls from the plugin.  The functions are described
-# in ppapi/c/private/ppb_network_monitor.h.
-
-{
- 'name': 'PpbNetworkMonitorPrivate',
- 'rpcs': [
-          {'name': 'PPB_NetworkMonitor_Private_Create',
-           'inputs': [['instance', 'PP_Instance'],
-                     ],
-           'outputs': [['out_resource', 'PP_Resource'],
-                      ]
-          },
-          {'name': 'PPB_NetworkMonitor_Private_IsNetworkMonitor',
-           'inputs': [['resource', 'PP_Resource'],
-                     ],
-           'outputs': [['out_bool', 'int32_t'],
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_client.cc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_client.cc
deleted file mode 100644
index ac50015..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_client.cc
+++ /dev/null
@@ -1,3579 +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.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// Automatically generated code.  See srpcgen.py
-//
-// NaCl Simple Remote Procedure Call interface abstractions.
-
-#include "untrusted/srpcgen/ppb_rpc.h"
-#ifdef __native_client__
-#ifndef UNREFERENCED_PARAMETER
-#define UNREFERENCED_PARAMETER(P) do { (void) P; } while (0)
-#endif  // UNREFERENCED_PARAMETER
-#else
-#include "native_client/src/include/portability.h"
-#endif  // __native_client__
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/ppb_core.h"
-
-NaClSrpcError PpbRpcClient::PPB_GetInterface(
-    NaClSrpcChannel* channel,
-    const char* interface_name,
-    int32_t* exports_interface_name)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_GetInterface:s:i",
-      interface_name,
-      exports_interface_name
-  );
-  return retval;
-}
-
-NaClSrpcError PpbAudioRpcClient::PPB_Audio_Create(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource config,
-    PP_Resource* out_resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Audio_Create:ii:i",
-      instance,
-      config,
-      out_resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbAudioRpcClient::PPB_Audio_IsAudio(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* out_bool)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Audio_IsAudio:i:i",
-      resource,
-      out_bool
-  );
-  return retval;
-}
-
-NaClSrpcError PpbAudioRpcClient::PPB_Audio_GetCurrentConfig(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    PP_Resource* out_resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Audio_GetCurrentConfig:i:i",
-      resource,
-      out_resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbAudioRpcClient::PPB_Audio_StopPlayback(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* out_bool)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Audio_StopPlayback:i:i",
-      resource,
-      out_bool
-  );
-  return retval;
-}
-
-NaClSrpcError PpbAudioRpcClient::PPB_Audio_StartPlayback(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* out_bool)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Audio_StartPlayback:i:i",
-      resource,
-      out_bool
-  );
-  return retval;
-}
-
-NaClSrpcError PpbAudioConfigRpcClient::PPB_AudioConfig_CreateStereo16Bit(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t sample_rate,
-    int32_t sample_frame_count,
-    PP_Resource* resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_AudioConfig_CreateStereo16Bit:iii:i",
-      instance,
-      sample_rate,
-      sample_frame_count,
-      resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbAudioConfigRpcClient::PPB_AudioConfig_IsAudioConfig(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* out_bool)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_AudioConfig_IsAudioConfig:i:i",
-      resource,
-      out_bool
-  );
-  return retval;
-}
-
-NaClSrpcError PpbAudioConfigRpcClient::PPB_AudioConfig_RecommendSampleFrameCount_1_0(
-    NaClSrpcChannel* channel,
-    int32_t request_sample_rate,
-    int32_t request_sample_frame_count,
-    int32_t* out_sample_frame_count)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_AudioConfig_RecommendSampleFrameCount_1_0:ii:i",
-      request_sample_rate,
-      request_sample_frame_count,
-      out_sample_frame_count
-  );
-  return retval;
-}
-
-NaClSrpcError PpbAudioConfigRpcClient::PPB_AudioConfig_RecommendSampleFrameCount(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t request_sample_rate,
-    int32_t request_sample_frame_count,
-    int32_t* out_sample_frame_count)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_AudioConfig_RecommendSampleFrameCount:iii:i",
-      instance,
-      request_sample_rate,
-      request_sample_frame_count,
-      out_sample_frame_count
-  );
-  return retval;
-}
-
-NaClSrpcError PpbAudioConfigRpcClient::PPB_AudioConfig_GetSampleRate(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* sample_rate)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_AudioConfig_GetSampleRate:i:i",
-      resource,
-      sample_rate
-  );
-  return retval;
-}
-
-NaClSrpcError PpbAudioConfigRpcClient::PPB_AudioConfig_GetSampleFrameCount(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* sample_frame_count)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_AudioConfig_GetSampleFrameCount:i:i",
-      resource,
-      sample_frame_count
-  );
-  return retval;
-}
-
-NaClSrpcError PpbAudioConfigRpcClient::PPB_AudioConfig_RecommendSampleRate(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t* sample_rate)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_AudioConfig_RecommendSampleRate:i:i",
-      instance,
-      sample_rate
-  );
-  return retval;
-}
-
-NaClSrpcError PpbCoreRpcClient::PPB_Core_AddRefResource(
-    NaClSrpcChannel* channel,
-    PP_Resource resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Core_AddRefResource:i:",
-      resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbCoreRpcClient::PPB_Core_ReleaseResource(
-    NaClSrpcChannel* channel,
-    PP_Resource resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Core_ReleaseResource:i:",
-      resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbCoreRpcClient::ReleaseResourceMultipleTimes(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t count)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "ReleaseResourceMultipleTimes:ii:",
-      resource,
-      count
-  );
-  return retval;
-}
-
-NaClSrpcError PpbCoreRpcClient::PPB_Core_GetTime(
-    NaClSrpcChannel* channel,
-    double* time)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Core_GetTime::d",
-      time
-  );
-  return retval;
-}
-
-NaClSrpcError PpbCoreRpcClient::PPB_Core_GetTimeTicks(
-    NaClSrpcChannel* channel,
-    double* time_ticks)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Core_GetTimeTicks::d",
-      time_ticks
-  );
-  return retval;
-}
-
-NaClSrpcError PpbCoreRpcClient::PPB_Core_CallOnMainThread(
-    NaClSrpcChannel* channel,
-    int32_t delay_in_milliseconds,
-    int32_t callback_id,
-    int32_t result)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Core_CallOnMainThread:iii:",
-      delay_in_milliseconds,
-      callback_id,
-      result
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileIORpcClient::PPB_FileIO_Create(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource* resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileIO_Create:i:i",
-      instance,
-      resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileIORpcClient::PPB_FileIO_IsFileIO(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileIO_IsFileIO:i:i",
-      resource,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileIORpcClient::PPB_FileIO_Open(
-    NaClSrpcChannel* channel,
-    PP_Resource file_io,
-    PP_Resource file_ref,
-    int32_t open_flags,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileIO_Open:iiii:i",
-      file_io,
-      file_ref,
-      open_flags,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileIORpcClient::PPB_FileIO_Query(
-    NaClSrpcChannel* channel,
-    PP_Resource file_io,
-    int32_t bytes_to_read,
-    int32_t callback_id,
-    nacl_abi_size_t* info_bytes, char* info,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileIO_Query:iii:Ci",
-      file_io,
-      bytes_to_read,
-      callback_id,
-      info_bytes, info,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileIORpcClient::PPB_FileIO_Touch(
-    NaClSrpcChannel* channel,
-    PP_Resource file_io,
-    double last_access_time,
-    double last_modified_time,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileIO_Touch:iddi:i",
-      file_io,
-      last_access_time,
-      last_modified_time,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileIORpcClient::PPB_FileIO_Read(
-    NaClSrpcChannel* channel,
-    PP_Resource file_io,
-    int64_t offset,
-    int32_t bytes_to_read,
-    int32_t callback_id,
-    nacl_abi_size_t* buffer_bytes, char* buffer,
-    int32_t* pp_error_or_bytes)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileIO_Read:ilii:Ci",
-      file_io,
-      offset,
-      bytes_to_read,
-      callback_id,
-      buffer_bytes, buffer,
-      pp_error_or_bytes
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileIORpcClient::PPB_FileIO_Write(
-    NaClSrpcChannel* channel,
-    PP_Resource file_io,
-    int64_t offset,
-    nacl_abi_size_t buffer_bytes, char* buffer,
-    int32_t bytes_to_write,
-    int32_t callback_id,
-    int32_t* pp_error_or_bytes)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileIO_Write:ilCii:i",
-      file_io,
-      offset,
-      buffer_bytes, buffer,
-      bytes_to_write,
-      callback_id,
-      pp_error_or_bytes
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileIORpcClient::PPB_FileIO_SetLength(
-    NaClSrpcChannel* channel,
-    PP_Resource file_io,
-    int64_t length,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileIO_SetLength:ili:i",
-      file_io,
-      length,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileIORpcClient::PPB_FileIO_Flush(
-    NaClSrpcChannel* channel,
-    PP_Resource file_io,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileIO_Flush:ii:i",
-      file_io,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileIORpcClient::PPB_FileIO_Close(
-    NaClSrpcChannel* channel,
-    PP_Resource file_io)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileIO_Close:i:",
-      file_io
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileRefRpcClient::PPB_FileRef_Create(
-    NaClSrpcChannel* channel,
-    PP_Resource file_system,
-    nacl_abi_size_t path_bytes, char* path,
-    PP_Resource* resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileRef_Create:iC:i",
-      file_system,
-      path_bytes, path,
-      resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileRefRpcClient::PPB_FileRef_IsFileRef(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileRef_IsFileRef:i:i",
-      resource,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileRefRpcClient::PPB_FileRef_GetFileSystemType(
-    NaClSrpcChannel* channel,
-    PP_Resource file_ref,
-    int32_t* file_system_type)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileRef_GetFileSystemType:i:i",
-      file_ref,
-      file_system_type
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileRefRpcClient::PPB_FileRef_GetName(
-    NaClSrpcChannel* channel,
-    PP_Resource file_ref,
-    nacl_abi_size_t* name_bytes, char* name)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileRef_GetName:i:C",
-      file_ref,
-      name_bytes, name
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileRefRpcClient::PPB_FileRef_GetPath(
-    NaClSrpcChannel* channel,
-    PP_Resource file_ref,
-    nacl_abi_size_t* path_bytes, char* path)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileRef_GetPath:i:C",
-      file_ref,
-      path_bytes, path
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileRefRpcClient::PPB_FileRef_GetParent(
-    NaClSrpcChannel* channel,
-    PP_Resource file_ref,
-    PP_Resource* parent)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileRef_GetParent:i:i",
-      file_ref,
-      parent
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileRefRpcClient::PPB_FileRef_MakeDirectory(
-    NaClSrpcChannel* channel,
-    PP_Resource directory_ref,
-    int32_t make_ancestors,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileRef_MakeDirectory:iii:i",
-      directory_ref,
-      make_ancestors,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileRefRpcClient::PPB_FileRef_Touch(
-    NaClSrpcChannel* channel,
-    PP_Resource file_ref,
-    double last_access_time,
-    double last_modified_time,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileRef_Touch:iddi:i",
-      file_ref,
-      last_access_time,
-      last_modified_time,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileRefRpcClient::PPB_FileRef_Delete(
-    NaClSrpcChannel* channel,
-    PP_Resource file_ref,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileRef_Delete:ii:i",
-      file_ref,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileRefRpcClient::PPB_FileRef_Rename(
-    NaClSrpcChannel* channel,
-    PP_Resource file_ref,
-    PP_Resource new_file_ref,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileRef_Rename:iii:i",
-      file_ref,
-      new_file_ref,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileSystemRpcClient::PPB_FileSystem_Create(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t file_system_type,
-    PP_Resource* resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileSystem_Create:ii:i",
-      instance,
-      file_system_type,
-      resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileSystemRpcClient::PPB_FileSystem_IsFileSystem(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileSystem_IsFileSystem:i:i",
-      resource,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileSystemRpcClient::PPB_FileSystem_Open(
-    NaClSrpcChannel* channel,
-    PP_Resource file_system,
-    int64_t expected_size,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileSystem_Open:ili:i",
-      file_system,
-      expected_size,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFileSystemRpcClient::PPB_FileSystem_GetType(
-    NaClSrpcChannel* channel,
-    PP_Resource file_system,
-    int32_t* type)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_FileSystem_GetType:i:i",
-      file_system,
-      type
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFindRpcClient::PPB_Find_NumberOfFindResultsChanged(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t total,
-    int32_t final_result)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Find_NumberOfFindResultsChanged:iii:",
-      instance,
-      total,
-      final_result
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFindRpcClient::PPB_Find_SelectedFindResultChanged(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t index)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Find_SelectedFindResultChanged:ii:",
-      instance,
-      index
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFontRpcClient::PPB_Font_GetFontFamilies(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    nacl_abi_size_t* font_families_bytes, char* font_families)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Font_GetFontFamilies:i:C",
-      instance,
-      font_families_bytes, font_families
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFontRpcClient::PPB_Font_Create(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    nacl_abi_size_t description_bytes, char* description,
-    nacl_abi_size_t face_bytes, char* face,
-    PP_Resource* font)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Font_Create:iCC:i",
-      instance,
-      description_bytes, description,
-      face_bytes, face,
-      font
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFontRpcClient::PPB_Font_IsFont(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* is_font)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Font_IsFont:i:i",
-      resource,
-      is_font
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFontRpcClient::PPB_Font_Describe(
-    NaClSrpcChannel* channel,
-    PP_Resource font,
-    nacl_abi_size_t* description_bytes, char* description,
-    nacl_abi_size_t* face_bytes, char* face,
-    nacl_abi_size_t* metrics_bytes, char* metrics,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Font_Describe:i:CCCi",
-      font,
-      description_bytes, description,
-      face_bytes, face,
-      metrics_bytes, metrics,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFontRpcClient::PPB_Font_DrawTextAt(
-    NaClSrpcChannel* channel,
-    PP_Resource font,
-    PP_Resource image_data,
-    nacl_abi_size_t text_run_bytes, char* text_run,
-    nacl_abi_size_t text_bytes, char* text,
-    nacl_abi_size_t position_bytes, char* position,
-    int32_t color,
-    nacl_abi_size_t clip_bytes, char* clip,
-    int32_t image_data_is_opaque,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Font_DrawTextAt:iiCCCiCi:i",
-      font,
-      image_data,
-      text_run_bytes, text_run,
-      text_bytes, text,
-      position_bytes, position,
-      color,
-      clip_bytes, clip,
-      image_data_is_opaque,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFontRpcClient::PPB_Font_MeasureText(
-    NaClSrpcChannel* channel,
-    PP_Resource font,
-    nacl_abi_size_t text_run_bytes, char* text_run,
-    nacl_abi_size_t text_bytes, char* text,
-    int32_t* width)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Font_MeasureText:iCC:i",
-      font,
-      text_run_bytes, text_run,
-      text_bytes, text,
-      width
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFontRpcClient::PPB_Font_CharacterOffsetForPixel(
-    NaClSrpcChannel* channel,
-    PP_Resource font,
-    nacl_abi_size_t text_run_bytes, char* text_run,
-    nacl_abi_size_t text_bytes, char* text,
-    int32_t pixel_position,
-    int32_t* offset)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Font_CharacterOffsetForPixel:iCCi:i",
-      font,
-      text_run_bytes, text_run,
-      text_bytes, text,
-      pixel_position,
-      offset
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFontRpcClient::PPB_Font_PixelOffsetForCharacter(
-    NaClSrpcChannel* channel,
-    PP_Resource font,
-    nacl_abi_size_t text_run_bytes, char* text_run,
-    nacl_abi_size_t text_bytes, char* text,
-    int32_t char_offset,
-    int32_t* offset)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Font_PixelOffsetForCharacter:iCCi:i",
-      font,
-      text_run_bytes, text_run,
-      text_bytes, text,
-      char_offset,
-      offset
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFullscreenRpcClient::PPB_Fullscreen_SetFullscreen(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t fullscreen,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Fullscreen_SetFullscreen:ii:i",
-      instance,
-      fullscreen,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbFullscreenRpcClient::PPB_Fullscreen_GetScreenSize(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    nacl_abi_size_t* size_bytes, char* size,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Fullscreen_GetScreenSize:i:Ci",
-      instance,
-      size_bytes, size,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGamepadRpcClient::PPB_Gamepad_Sample(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    nacl_abi_size_t* data_bytes, char* data)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Gamepad_Sample:i:C",
-      instance,
-      data_bytes, data
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics2DRpcClient::PPB_Graphics2D_Create(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    nacl_abi_size_t size_bytes, char* size,
-    int32_t is_always_opaque,
-    PP_Resource* resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics2D_Create:iCi:i",
-      instance,
-      size_bytes, size,
-      is_always_opaque,
-      resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics2DRpcClient::PPB_Graphics2D_IsGraphics2D(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics2D_IsGraphics2D:i:i",
-      resource,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics2DRpcClient::PPB_Graphics2D_Describe(
-    NaClSrpcChannel* channel,
-    PP_Resource graphics_2d,
-    nacl_abi_size_t* size_bytes, char* size,
-    int32_t* is_always_opaque,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics2D_Describe:i:Cii",
-      graphics_2d,
-      size_bytes, size,
-      is_always_opaque,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics2DRpcClient::PPB_Graphics2D_PaintImageData(
-    NaClSrpcChannel* channel,
-    PP_Resource graphics_2d,
-    PP_Resource image,
-    nacl_abi_size_t top_left_bytes, char* top_left,
-    nacl_abi_size_t src_rect_bytes, char* src_rect)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics2D_PaintImageData:iiCC:",
-      graphics_2d,
-      image,
-      top_left_bytes, top_left,
-      src_rect_bytes, src_rect
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics2DRpcClient::PPB_Graphics2D_Scroll(
-    NaClSrpcChannel* channel,
-    PP_Resource graphics_2d,
-    nacl_abi_size_t clip_rect_bytes, char* clip_rect,
-    nacl_abi_size_t amount_bytes, char* amount)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics2D_Scroll:iCC:",
-      graphics_2d,
-      clip_rect_bytes, clip_rect,
-      amount_bytes, amount
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics2DRpcClient::PPB_Graphics2D_ReplaceContents(
-    NaClSrpcChannel* channel,
-    PP_Resource graphics_2d,
-    PP_Resource image)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics2D_ReplaceContents:ii:",
-      graphics_2d,
-      image
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics2DRpcClient::PPB_Graphics2D_Flush(
-    NaClSrpcChannel* channel,
-    PP_Resource graphics_2d,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics2D_Flush:ii:i",
-      graphics_2d,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3D_GetAttribMaxValue(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t attribute,
-    int32_t* value,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3D_GetAttribMaxValue:ii:ii",
-      instance,
-      attribute,
-      value,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3D_Create(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource share_context,
-    nacl_abi_size_t attrib_list_bytes, int32_t* attrib_list,
-    PP_Resource* resource_id)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3D_Create:iiI:i",
-      instance,
-      share_context,
-      attrib_list_bytes, attrib_list,
-      resource_id
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3D_GetAttribs(
-    NaClSrpcChannel* channel,
-    PP_Resource context,
-    nacl_abi_size_t input_attrib_list_bytes, int32_t* input_attrib_list,
-    nacl_abi_size_t* output_attrib_list_bytes, int32_t* output_attrib_list,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3D_GetAttribs:iI:Ii",
-      context,
-      input_attrib_list_bytes, input_attrib_list,
-      output_attrib_list_bytes, output_attrib_list,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3D_SetAttribs(
-    NaClSrpcChannel* channel,
-    PP_Resource context,
-    nacl_abi_size_t attrib_list_bytes, int32_t* attrib_list,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3D_SetAttribs:iI:i",
-      context,
-      attrib_list_bytes, attrib_list,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3D_GetError(
-    NaClSrpcChannel* channel,
-    PP_Resource context,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3D_GetError:i:i",
-      context,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3D_SwapBuffers(
-    NaClSrpcChannel* channel,
-    PP_Resource context,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3D_SwapBuffers:ii:i",
-      context,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_CreateRaw(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource share_context,
-    nacl_abi_size_t attrib_list_bytes, int32_t* attrib_list,
-    PP_Resource* resource_id)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3DTrusted_CreateRaw:iiI:i",
-      instance,
-      share_context,
-      attrib_list_bytes, attrib_list,
-      resource_id
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_InitCommandBuffer(
-    NaClSrpcChannel* channel,
-    PP_Resource resource_id,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3DTrusted_InitCommandBuffer:i:i",
-      resource_id,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_SetGetBuffer(
-    NaClSrpcChannel* channel,
-    PP_Resource resource_id,
-    int32_t shm_id)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3DTrusted_SetGetBuffer:ii:",
-      resource_id,
-      shm_id
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_GetState(
-    NaClSrpcChannel* channel,
-    PP_Resource resource_id,
-    nacl_abi_size_t* state_bytes, char* state)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3DTrusted_GetState:i:C",
-      resource_id,
-      state_bytes, state
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_Flush(
-    NaClSrpcChannel* channel,
-    PP_Resource resource_id,
-    int32_t put_offset)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3DTrusted_Flush:ii:",
-      resource_id,
-      put_offset
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_FlushSync(
-    NaClSrpcChannel* channel,
-    PP_Resource resource_id,
-    int32_t put_offset,
-    nacl_abi_size_t* state_bytes, char* state)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3DTrusted_FlushSync:ii:C",
-      resource_id,
-      put_offset,
-      state_bytes, state
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_FlushSyncFast(
-    NaClSrpcChannel* channel,
-    PP_Resource resource_id,
-    int32_t put_offset,
-    int32_t last_known_offset,
-    nacl_abi_size_t* state_bytes, char* state)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3DTrusted_FlushSyncFast:iii:C",
-      resource_id,
-      put_offset,
-      last_known_offset,
-      state_bytes, state
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_CreateTransferBuffer(
-    NaClSrpcChannel* channel,
-    PP_Resource resource_id,
-    int32_t size,
-    int32_t request_id,
-    int32_t* id)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3DTrusted_CreateTransferBuffer:iii:i",
-      resource_id,
-      size,
-      request_id,
-      id
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_DestroyTransferBuffer(
-    NaClSrpcChannel* channel,
-    PP_Resource resource_id,
-    int32_t id)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3DTrusted_DestroyTransferBuffer:ii:",
-      resource_id,
-      id
-  );
-  return retval;
-}
-
-NaClSrpcError PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_GetTransferBuffer(
-    NaClSrpcChannel* channel,
-    PP_Resource resource_id,
-    int32_t id,
-    NaClSrpcImcDescType* shm_desc,
-    int32_t* shm_size)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Graphics3DTrusted_GetTransferBuffer:ii:hi",
-      resource_id,
-      id,
-      shm_desc,
-      shm_size
-  );
-  return retval;
-}
-
-NaClSrpcError PpbHostResolverPrivateRpcClient::PPB_HostResolver_Private_Create(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource* resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_HostResolver_Private_Create:i:i",
-      instance,
-      resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbHostResolverPrivateRpcClient::PPB_HostResolver_Private_IsHostResolver(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* is_host_resolver)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_HostResolver_Private_IsHostResolver:i:i",
-      resource,
-      is_host_resolver
-  );
-  return retval;
-}
-
-NaClSrpcError PpbHostResolverPrivateRpcClient::PPB_HostResolver_Private_Resolve(
-    NaClSrpcChannel* channel,
-    PP_Resource host_resolver,
-    const char* host,
-    int32_t port,
-    nacl_abi_size_t hint_bytes, char* hint,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_HostResolver_Private_Resolve:isiCi:i",
-      host_resolver,
-      host,
-      port,
-      hint_bytes, hint,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbHostResolverPrivateRpcClient::PPB_HostResolver_Private_GetCanonicalName(
-    NaClSrpcChannel* channel,
-    PP_Resource host_resolver,
-    nacl_abi_size_t* canonical_name_bytes, char* canonical_name)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_HostResolver_Private_GetCanonicalName:i:C",
-      host_resolver,
-      canonical_name_bytes, canonical_name
-  );
-  return retval;
-}
-
-NaClSrpcError PpbHostResolverPrivateRpcClient::PPB_HostResolver_Private_GetSize(
-    NaClSrpcChannel* channel,
-    PP_Resource host_resolver,
-    int32_t* size)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_HostResolver_Private_GetSize:i:i",
-      host_resolver,
-      size
-  );
-  return retval;
-}
-
-NaClSrpcError PpbHostResolverPrivateRpcClient::PPB_HostResolver_Private_GetNetAddress(
-    NaClSrpcChannel* channel,
-    PP_Resource host_resolver,
-    int32_t index,
-    nacl_abi_size_t* addr_bytes, char* addr,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_HostResolver_Private_GetNetAddress:ii:Ci",
-      host_resolver,
-      index,
-      addr_bytes, addr,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbImageDataRpcClient::PPB_ImageData_GetNativeImageDataFormat(
-    NaClSrpcChannel* channel,
-    int32_t* format)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_ImageData_GetNativeImageDataFormat::i",
-      format
-  );
-  return retval;
-}
-
-NaClSrpcError PpbImageDataRpcClient::PPB_ImageData_IsImageDataFormatSupported(
-    NaClSrpcChannel* channel,
-    int32_t format,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_ImageData_IsImageDataFormatSupported:i:i",
-      format,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbImageDataRpcClient::PPB_ImageData_Create(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t format,
-    nacl_abi_size_t size_bytes, char* size,
-    int32_t init_to_zero,
-    PP_Resource* resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_ImageData_Create:iiCi:i",
-      instance,
-      format,
-      size_bytes, size,
-      init_to_zero,
-      resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbImageDataRpcClient::PPB_ImageData_IsImageData(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_ImageData_IsImageData:i:i",
-      resource,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbImageDataRpcClient::PPB_ImageData_Describe(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    nacl_abi_size_t* desc_bytes, char* desc,
-    NaClSrpcImcDescType* shm,
-    int32_t* shm_size,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_ImageData_Describe:i:Chii",
-      resource,
-      desc_bytes, desc,
-      shm,
-      shm_size,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbInputEventRpcClient::PPB_InputEvent_RequestInputEvents(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t event_classes,
-    int32_t filtered,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_InputEvent_RequestInputEvents:iii:i",
-      instance,
-      event_classes,
-      filtered,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbInputEventRpcClient::PPB_InputEvent_ClearInputEventRequest(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t event_classes)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_InputEvent_ClearInputEventRequest:ii:",
-      instance,
-      event_classes
-  );
-  return retval;
-}
-
-NaClSrpcError PpbInputEventRpcClient::PPB_InputEvent_CreateMouseInputEvent(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t type,
-    double time_stamp,
-    int32_t modifiers,
-    int32_t mouse_button,
-    int32_t mouse_position_x,
-    int32_t mouse_position_y,
-    int32_t click_count,
-    int32_t mouse_movement_x,
-    int32_t mouse_movement_y,
-    PP_Resource* resource_id)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_InputEvent_CreateMouseInputEvent:iidiiiiiii:i",
-      instance,
-      type,
-      time_stamp,
-      modifiers,
-      mouse_button,
-      mouse_position_x,
-      mouse_position_y,
-      click_count,
-      mouse_movement_x,
-      mouse_movement_y,
-      resource_id
-  );
-  return retval;
-}
-
-NaClSrpcError PpbInputEventRpcClient::PPB_InputEvent_CreateWheelInputEvent(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    double time_stamp,
-    int32_t modifiers,
-    double wheel_delta_x,
-    double wheel_delta_y,
-    double wheel_ticks_x,
-    double wheel_ticks_y,
-    int32_t scroll_by_page,
-    PP_Resource* resource_id)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_InputEvent_CreateWheelInputEvent:ididdddi:i",
-      instance,
-      time_stamp,
-      modifiers,
-      wheel_delta_x,
-      wheel_delta_y,
-      wheel_ticks_x,
-      wheel_ticks_y,
-      scroll_by_page,
-      resource_id
-  );
-  return retval;
-}
-
-NaClSrpcError PpbInputEventRpcClient::PPB_InputEvent_CreateKeyboardInputEvent(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t type,
-    double time_stamp,
-    int32_t modifiers,
-    int32_t key_code,
-    nacl_abi_size_t character_text_bytes, char* character_text,
-    PP_Resource* resource_id)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_InputEvent_CreateKeyboardInputEvent:iidiiC:i",
-      instance,
-      type,
-      time_stamp,
-      modifiers,
-      key_code,
-      character_text_bytes, character_text,
-      resource_id
-  );
-  return retval;
-}
-
-NaClSrpcError PpbInstanceRpcClient::PPB_Instance_BindGraphics(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource graphics_device,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Instance_BindGraphics:ii:i",
-      instance,
-      graphics_device,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbInstanceRpcClient::PPB_Instance_IsFullFrame(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t* is_full_frame)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Instance_IsFullFrame:i:i",
-      instance,
-      is_full_frame
-  );
-  return retval;
-}
-
-NaClSrpcError PpbMessagingRpcClient::PPB_Messaging_PostMessage(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    nacl_abi_size_t message_bytes, char* message)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Messaging_PostMessage:iC:",
-      instance,
-      message_bytes, message
-  );
-  return retval;
-}
-
-NaClSrpcError PpbMouseCursorRpcClient::PPB_MouseCursor_SetCursor(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t type,
-    PP_Resource custom_image,
-    nacl_abi_size_t hot_spot_bytes, char* hot_spot,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_MouseCursor_SetCursor:iiiC:i",
-      instance,
-      type,
-      custom_image,
-      hot_spot_bytes, hot_spot,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbMouseLockRpcClient::PPB_MouseLock_LockMouse(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_MouseLock_LockMouse:ii:i",
-      instance,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbMouseLockRpcClient::PPB_MouseLock_UnlockMouse(
-    NaClSrpcChannel* channel,
-    PP_Instance instance)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_MouseLock_UnlockMouse:i:",
-      instance
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_AreEqual(
-    NaClSrpcChannel* channel,
-    nacl_abi_size_t addr1_bytes, char* addr1,
-    nacl_abi_size_t addr2_bytes, char* addr2,
-    int32_t* equals)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetAddress_Private_AreEqual:CC:i",
-      addr1_bytes, addr1,
-      addr2_bytes, addr2,
-      equals
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_AreHostsEqual(
-    NaClSrpcChannel* channel,
-    nacl_abi_size_t addr1_bytes, char* addr1,
-    nacl_abi_size_t addr2_bytes, char* addr2,
-    int32_t* equals)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetAddress_Private_AreHostsEqual:CC:i",
-      addr1_bytes, addr1,
-      addr2_bytes, addr2,
-      equals
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_Describe(
-    NaClSrpcChannel* channel,
-    int32_t module,
-    nacl_abi_size_t addr_bytes, char* addr,
-    int32_t include_port,
-    nacl_abi_size_t* description_bytes, char* description)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetAddress_Private_Describe:iCi:C",
-      module,
-      addr_bytes, addr,
-      include_port,
-      description_bytes, description
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_ReplacePort(
-    NaClSrpcChannel* channel,
-    nacl_abi_size_t src_addr_bytes, char* src_addr,
-    int32_t port,
-    nacl_abi_size_t* dst_addr_bytes, char* dst_addr,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetAddress_Private_ReplacePort:Ci:Ci",
-      src_addr_bytes, src_addr,
-      port,
-      dst_addr_bytes, dst_addr,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_GetAnyAddress(
-    NaClSrpcChannel* channel,
-    int32_t is_ipv6,
-    nacl_abi_size_t* addr_bytes, char* addr)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetAddress_Private_GetAnyAddress:i:C",
-      is_ipv6,
-      addr_bytes, addr
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_GetFamily(
-    NaClSrpcChannel* channel,
-    nacl_abi_size_t addr_bytes, char* addr,
-    int32_t* addr_family)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetAddress_Private_GetFamily:C:i",
-      addr_bytes, addr,
-      addr_family
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_GetPort(
-    NaClSrpcChannel* channel,
-    nacl_abi_size_t addr_bytes, char* addr,
-    int32_t* port)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetAddress_Private_GetPort:C:i",
-      addr_bytes, addr,
-      port
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_GetAddress(
-    NaClSrpcChannel* channel,
-    nacl_abi_size_t addr_bytes, char* addr,
-    nacl_abi_size_t* address_bytes, char* address,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetAddress_Private_GetAddress:C:Ci",
-      addr_bytes, addr,
-      address_bytes, address,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_GetScopeID(
-    NaClSrpcChannel* channel,
-    nacl_abi_size_t addr_bytes, char* addr,
-    int32_t* scope_id)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetAddress_Private_GetScopeID:C:i",
-      addr_bytes, addr,
-      scope_id
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_CreateFromIPv4Address(
-    NaClSrpcChannel* channel,
-    nacl_abi_size_t ip_bytes, char* ip,
-    int32_t port,
-    nacl_abi_size_t* addr_bytes, char* addr)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetAddress_Private_CreateFromIPv4Address:Ci:C",
-      ip_bytes, ip,
-      port,
-      addr_bytes, addr
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetAddressPrivateRpcClient::PPB_NetAddress_Private_CreateFromIPv6Address(
-    NaClSrpcChannel* channel,
-    nacl_abi_size_t ip_bytes, char* ip,
-    int32_t scope_id,
-    int32_t port,
-    nacl_abi_size_t* addr_bytes, char* addr)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetAddress_Private_CreateFromIPv6Address:Cii:C",
-      ip_bytes, ip,
-      scope_id,
-      port,
-      addr_bytes, addr
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetworkListPrivateClient::PPB_NetworkList_Private_IsNetworkList(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* out_bool)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetworkList_Private_IsNetworkList:i:i",
-      resource,
-      out_bool
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetworkListPrivateClient::PPB_NetworkList_Private_GetCount(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* count)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetworkList_Private_GetCount:i:i",
-      resource,
-      count
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetworkListPrivateClient::PPB_NetworkList_Private_GetName(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t index,
-    nacl_abi_size_t* name_bytes, char* name)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetworkList_Private_GetName:ii:C",
-      resource,
-      index,
-      name_bytes, name
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetworkListPrivateClient::PPB_NetworkList_Private_GetType(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t index,
-    int32_t* type)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetworkList_Private_GetType:ii:i",
-      resource,
-      index,
-      type
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetworkListPrivateClient::PPB_NetworkList_Private_GetState(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t index,
-    int32_t* state)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetworkList_Private_GetState:ii:i",
-      resource,
-      index,
-      state
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetworkListPrivateClient::PPB_NetworkList_Private_GetIpAddresses(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t index,
-    nacl_abi_size_t* addr_bytes, char* addr,
-    int32_t* addresses_count)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetworkList_Private_GetIpAddresses:ii:Ci",
-      resource,
-      index,
-      addr_bytes, addr,
-      addresses_count
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetworkListPrivateClient::PPB_NetworkList_Private_GetDisplayName(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t index,
-    nacl_abi_size_t* display_name_bytes, char* display_name)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetworkList_Private_GetDisplayName:ii:C",
-      resource,
-      index,
-      display_name_bytes, display_name
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetworkListPrivateClient::PPB_NetworkList_Private_GetMTU(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t index,
-    int32_t* mtu)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetworkList_Private_GetMTU:ii:i",
-      resource,
-      index,
-      mtu
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetworkMonitorPrivateClient::PPB_NetworkMonitor_Private_Create(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource* out_resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetworkMonitor_Private_Create:i:i",
-      instance,
-      out_resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbNetworkMonitorPrivateClient::PPB_NetworkMonitor_Private_IsNetworkMonitor(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* out_bool)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_NetworkMonitor_Private_IsNetworkMonitor:i:i",
-      resource,
-      out_bool
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTCPServerSocketPrivateRpcClient::PPB_TCPServerSocket_Private_Create(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource* resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_TCPServerSocket_Private_Create:i:i",
-      instance,
-      resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTCPServerSocketPrivateRpcClient::PPB_TCPServerSocket_Private_IsTCPServerSocket(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* is_tcp_server_socket)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_TCPServerSocket_Private_IsTCPServerSocket:i:i",
-      resource,
-      is_tcp_server_socket
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTCPServerSocketPrivateRpcClient::PPB_TCPServerSocket_Private_Listen(
-    NaClSrpcChannel* channel,
-    PP_Resource tcp_server_socket,
-    nacl_abi_size_t addr_bytes, char* addr,
-    int32_t backlog,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_TCPServerSocket_Private_Listen:iCii:i",
-      tcp_server_socket,
-      addr_bytes, addr,
-      backlog,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTCPServerSocketPrivateRpcClient::PPB_TCPServerSocket_Private_Accept(
-    NaClSrpcChannel* channel,
-    PP_Resource tcp_server_socket,
-    int32_t callback_id,
-    PP_Resource* tcp_socket,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_TCPServerSocket_Private_Accept:ii:ii",
-      tcp_server_socket,
-      callback_id,
-      tcp_socket,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTCPServerSocketPrivateRpcClient::PPB_TCPServerSocket_Private_StopListening(
-    NaClSrpcChannel* channel,
-    PP_Resource tcp_server_socket)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_TCPServerSocket_Private_StopListening:i:",
-      tcp_server_socket
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_Create(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource* resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_TCPSocket_Private_Create:i:i",
-      instance,
-      resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_IsTCPSocket(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* is_tcp_socket)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_TCPSocket_Private_IsTCPSocket:i:i",
-      resource,
-      is_tcp_socket
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_Connect(
-    NaClSrpcChannel* channel,
-    PP_Resource tcp_socket,
-    const char* host,
-    int32_t port,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_TCPSocket_Private_Connect:isii:i",
-      tcp_socket,
-      host,
-      port,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_ConnectWithNetAddress(
-    NaClSrpcChannel* channel,
-    PP_Resource tcp_socket,
-    nacl_abi_size_t addr_bytes, char* addr,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_TCPSocket_Private_ConnectWithNetAddress:iCi:i",
-      tcp_socket,
-      addr_bytes, addr,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_GetLocalAddress(
-    NaClSrpcChannel* channel,
-    PP_Resource tcp_socket,
-    nacl_abi_size_t* local_addr_bytes, char* local_addr,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_TCPSocket_Private_GetLocalAddress:i:Ci",
-      tcp_socket,
-      local_addr_bytes, local_addr,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_GetRemoteAddress(
-    NaClSrpcChannel* channel,
-    PP_Resource tcp_socket,
-    nacl_abi_size_t* remote_addr_bytes, char* remote_addr,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_TCPSocket_Private_GetRemoteAddress:i:Ci",
-      tcp_socket,
-      remote_addr_bytes, remote_addr,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_SSLHandshake(
-    NaClSrpcChannel* channel,
-    PP_Resource tcp_socket,
-    const char* server_name,
-    int32_t server_port,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_TCPSocket_Private_SSLHandshake:isii:i",
-      tcp_socket,
-      server_name,
-      server_port,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_Read(
-    NaClSrpcChannel* channel,
-    PP_Resource tcp_socket,
-    int32_t bytes_to_read,
-    int32_t callback_id,
-    nacl_abi_size_t* buffer_bytes, char* buffer,
-    int32_t* pp_error_or_bytes)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_TCPSocket_Private_Read:iii:Ci",
-      tcp_socket,
-      bytes_to_read,
-      callback_id,
-      buffer_bytes, buffer,
-      pp_error_or_bytes
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_Write(
-    NaClSrpcChannel* channel,
-    PP_Resource tcp_socket,
-    nacl_abi_size_t buffer_bytes, char* buffer,
-    int32_t bytes_to_write,
-    int32_t callback_id,
-    int32_t* pp_error_or_bytes)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_TCPSocket_Private_Write:iCii:i",
-      tcp_socket,
-      buffer_bytes, buffer,
-      bytes_to_write,
-      callback_id,
-      pp_error_or_bytes
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTCPSocketPrivateRpcClient::PPB_TCPSocket_Private_Disconnect(
-    NaClSrpcChannel* channel,
-    PP_Resource tcp_socket)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_TCPSocket_Private_Disconnect:i:",
-      tcp_socket
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTestingRpcClient::PPB_Testing_ReadImageData(
-    NaClSrpcChannel* channel,
-    PP_Resource device_context_2d,
-    PP_Resource image,
-    nacl_abi_size_t top_left_bytes, char* top_left,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Testing_ReadImageData:iiC:i",
-      device_context_2d,
-      image,
-      top_left_bytes, top_left,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTestingRpcClient::PPB_Testing_RunMessageLoop(
-    NaClSrpcChannel* channel,
-    PP_Instance instance)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Testing_RunMessageLoop:i:",
-      instance
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTestingRpcClient::PPB_Testing_QuitMessageLoop(
-    NaClSrpcChannel* channel,
-    PP_Instance instance)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Testing_QuitMessageLoop:i:",
-      instance
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTestingRpcClient::PPB_Testing_GetLiveObjectsForInstance(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t* live_object_count)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Testing_GetLiveObjectsForInstance:i:i",
-      instance,
-      live_object_count
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTestingRpcClient::PPB_Testing_SimulateInputEvent(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource input_event)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Testing_SimulateInputEvent:ii:",
-      instance,
-      input_event
-  );
-  return retval;
-}
-
-NaClSrpcError PpbTestingRpcClient::PPB_Testing_GetDocumentURL(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    nacl_abi_size_t* components_bytes, char* components,
-    nacl_abi_size_t* url_bytes, char* url)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Testing_GetDocumentURL:i:CC",
-      instance,
-      components_bytes, components,
-      url_bytes, url
-  );
-  return retval;
-}
-
-NaClSrpcError PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_Create(
-    NaClSrpcChannel* channel,
-    PP_Instance instance_id,
-    PP_Resource* resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_UDPSocket_Private_Create:i:i",
-      instance_id,
-      resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_IsUDPSocket(
-    NaClSrpcChannel* channel,
-    PP_Resource resource_id,
-    int32_t* is_udp_socket_private)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_UDPSocket_Private_IsUDPSocket:i:i",
-      resource_id,
-      is_udp_socket_private
-  );
-  return retval;
-}
-
-NaClSrpcError PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_SetSocketFeature(
-    NaClSrpcChannel* channel,
-    PP_Resource udp_socket,
-    int32_t name,
-    nacl_abi_size_t value_bytes, char* value,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_UDPSocket_Private_SetSocketFeature:iiC:i",
-      udp_socket,
-      name,
-      value_bytes, value,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_Bind(
-    NaClSrpcChannel* channel,
-    PP_Resource udp_socket,
-    nacl_abi_size_t addr_bytes, char* addr,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_UDPSocket_Private_Bind:iCi:i",
-      udp_socket,
-      addr_bytes, addr,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_GetBoundAddress(
-    NaClSrpcChannel* channel,
-    PP_Resource udp_socket,
-    nacl_abi_size_t* addr_bytes, char* addr,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_UDPSocket_Private_GetBoundAddress:i:Ci",
-      udp_socket,
-      addr_bytes, addr,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_RecvFrom(
-    NaClSrpcChannel* channel,
-    PP_Resource udp_socket,
-    int32_t num_bytes,
-    int32_t callback_id,
-    nacl_abi_size_t* buffer_bytes, char* buffer,
-    int32_t* pp_error_or_bytes)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_UDPSocket_Private_RecvFrom:iii:Ci",
-      udp_socket,
-      num_bytes,
-      callback_id,
-      buffer_bytes, buffer,
-      pp_error_or_bytes
-  );
-  return retval;
-}
-
-NaClSrpcError PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_GetRecvFromAddress(
-    NaClSrpcChannel* channel,
-    PP_Resource udp_socket,
-    nacl_abi_size_t* addr_bytes, char* addr,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_UDPSocket_Private_GetRecvFromAddress:i:Ci",
-      udp_socket,
-      addr_bytes, addr,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_SendTo(
-    NaClSrpcChannel* channel,
-    PP_Resource udp_socket,
-    nacl_abi_size_t buffer_bytes, char* buffer,
-    int32_t num_bytes,
-    nacl_abi_size_t addr_bytes, char* addr,
-    int32_t callback_id,
-    int32_t* pp_error_or_bytes)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_UDPSocket_Private_SendTo:iCiCi:i",
-      udp_socket,
-      buffer_bytes, buffer,
-      num_bytes,
-      addr_bytes, addr,
-      callback_id,
-      pp_error_or_bytes
-  );
-  return retval;
-}
-
-NaClSrpcError PpbUDPSocketPrivateRpcClient::PPB_UDPSocket_Private_Close(
-    NaClSrpcChannel* channel,
-    PP_Resource udp_socket)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_UDPSocket_Private_Close:i:",
-      udp_socket
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLLoaderRpcClient::PPB_URLLoader_Create(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource* resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLLoader_Create:i:i",
-      instance,
-      resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLLoaderRpcClient::PPB_URLLoader_IsURLLoader(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* is_url_loader)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLLoader_IsURLLoader:i:i",
-      resource,
-      is_url_loader
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLLoaderRpcClient::PPB_URLLoader_Open(
-    NaClSrpcChannel* channel,
-    PP_Resource loader,
-    PP_Resource request,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLLoader_Open:iii:i",
-      loader,
-      request,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLLoaderRpcClient::PPB_URLLoader_FollowRedirect(
-    NaClSrpcChannel* channel,
-    PP_Resource loader,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLLoader_FollowRedirect:ii:i",
-      loader,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLLoaderRpcClient::PPB_URLLoader_GetUploadProgress(
-    NaClSrpcChannel* channel,
-    PP_Resource loader,
-    int64_t* bytes_sent,
-    int64_t* total_bytes_to_be_sent,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLLoader_GetUploadProgress:i:lli",
-      loader,
-      bytes_sent,
-      total_bytes_to_be_sent,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLLoaderRpcClient::PPB_URLLoader_GetDownloadProgress(
-    NaClSrpcChannel* channel,
-    PP_Resource loader,
-    int64_t* bytes_received,
-    int64_t* total_bytes_to_be_received,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLLoader_GetDownloadProgress:i:lli",
-      loader,
-      bytes_received,
-      total_bytes_to_be_received,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLLoaderRpcClient::PPB_URLLoader_GetResponseInfo(
-    NaClSrpcChannel* channel,
-    PP_Resource loader,
-    PP_Resource* response)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLLoader_GetResponseInfo:i:i",
-      loader,
-      response
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLLoaderRpcClient::PPB_URLLoader_ReadResponseBody(
-    NaClSrpcChannel* channel,
-    PP_Resource loader,
-    int32_t bytes_to_read,
-    int32_t callback_id,
-    nacl_abi_size_t* buffer_bytes, char* buffer,
-    int32_t* pp_error_or_bytes)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLLoader_ReadResponseBody:iii:Ci",
-      loader,
-      bytes_to_read,
-      callback_id,
-      buffer_bytes, buffer,
-      pp_error_or_bytes
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLLoaderRpcClient::PPB_URLLoader_FinishStreamingToFile(
-    NaClSrpcChannel* channel,
-    PP_Resource loader,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLLoader_FinishStreamingToFile:ii:i",
-      loader,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLLoaderRpcClient::PPB_URLLoader_Close(
-    NaClSrpcChannel* channel,
-    PP_Resource loader)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLLoader_Close:i:",
-      loader
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLRequestInfoRpcClient::PPB_URLRequestInfo_Create(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource* resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLRequestInfo_Create:i:i",
-      instance,
-      resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLRequestInfoRpcClient::PPB_URLRequestInfo_IsURLRequestInfo(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLRequestInfo_IsURLRequestInfo:i:i",
-      resource,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLRequestInfoRpcClient::PPB_URLRequestInfo_SetProperty(
-    NaClSrpcChannel* channel,
-    PP_Resource request,
-    int32_t property,
-    nacl_abi_size_t value_bytes, char* value,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLRequestInfo_SetProperty:iiC:i",
-      request,
-      property,
-      value_bytes, value,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLRequestInfoRpcClient::PPB_URLRequestInfo_AppendDataToBody(
-    NaClSrpcChannel* channel,
-    PP_Resource request,
-    nacl_abi_size_t data_bytes, char* data,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLRequestInfo_AppendDataToBody:iC:i",
-      request,
-      data_bytes, data,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLRequestInfoRpcClient::PPB_URLRequestInfo_AppendFileToBody(
-    NaClSrpcChannel* channel,
-    PP_Resource request,
-    PP_Resource file_ref,
-    int64_t start_offset,
-    int64_t number_of_bytes,
-    double expected_last_modified_time,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLRequestInfo_AppendFileToBody:iilld:i",
-      request,
-      file_ref,
-      start_offset,
-      number_of_bytes,
-      expected_last_modified_time,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLResponseInfoRpcClient::PPB_URLResponseInfo_IsURLResponseInfo(
-    NaClSrpcChannel* channel,
-    PP_Resource resource,
-    int32_t* success)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLResponseInfo_IsURLResponseInfo:i:i",
-      resource,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLResponseInfoRpcClient::PPB_URLResponseInfo_GetProperty(
-    NaClSrpcChannel* channel,
-    PP_Resource response,
-    int32_t property,
-    nacl_abi_size_t* value_bytes, char* value)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLResponseInfo_GetProperty:ii:C",
-      response,
-      property,
-      value_bytes, value
-  );
-  return retval;
-}
-
-NaClSrpcError PpbURLResponseInfoRpcClient::PPB_URLResponseInfo_GetBodyAsFileRef(
-    NaClSrpcChannel* channel,
-    PP_Resource response,
-    PP_Resource* file_ref)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_URLResponseInfo_GetBodyAsFileRef:i:i",
-      response,
-      file_ref
-  );
-  return retval;
-}
-
-NaClSrpcError PpbWebSocketRpcClient::PPB_WebSocket_Create(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource* resource)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_WebSocket_Create:i:i",
-      instance,
-      resource
-  );
-  return retval;
-}
-
-NaClSrpcError PpbWebSocketRpcClient::PPB_WebSocket_IsWebSocket(
-    NaClSrpcChannel* channel,
-    PP_Resource instance,
-    int32_t* is_websocket)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_WebSocket_IsWebSocket:i:i",
-      instance,
-      is_websocket
-  );
-  return retval;
-}
-
-NaClSrpcError PpbWebSocketRpcClient::PPB_WebSocket_Connect(
-    NaClSrpcChannel* channel,
-    PP_Resource ws,
-    nacl_abi_size_t url_bytes, char* url,
-    nacl_abi_size_t protocols_bytes, char* protocols,
-    int32_t protocol_count,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_WebSocket_Connect:iCCii:i",
-      ws,
-      url_bytes, url,
-      protocols_bytes, protocols,
-      protocol_count,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbWebSocketRpcClient::PPB_WebSocket_Close(
-    NaClSrpcChannel* channel,
-    PP_Resource ws,
-    int32_t code,
-    nacl_abi_size_t reason_bytes, char* reason,
-    int32_t callback_id,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_WebSocket_Close:iiCi:i",
-      ws,
-      code,
-      reason_bytes, reason,
-      callback_id,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbWebSocketRpcClient::PPB_WebSocket_ReceiveMessage(
-    NaClSrpcChannel* channel,
-    PP_Resource ws,
-    int32_t callback_id,
-    int32_t* pp_error,
-    nacl_abi_size_t* sync_read_buffer_bytes, char* sync_read_buffer)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_WebSocket_ReceiveMessage:ii:iC",
-      ws,
-      callback_id,
-      pp_error,
-      sync_read_buffer_bytes, sync_read_buffer
-  );
-  return retval;
-}
-
-NaClSrpcError PpbWebSocketRpcClient::PPB_WebSocket_SendMessage(
-    NaClSrpcChannel* channel,
-    PP_Resource ws,
-    nacl_abi_size_t message_bytes, char* message,
-    int32_t* pp_error)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_WebSocket_SendMessage:iC:i",
-      ws,
-      message_bytes, message,
-      pp_error
-  );
-  return retval;
-}
-
-NaClSrpcError PpbWebSocketRpcClient::PPB_WebSocket_GetBufferedAmount(
-    NaClSrpcChannel* channel,
-    PP_Resource ws,
-    int64_t* buffered_amount)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_WebSocket_GetBufferedAmount:i:l",
-      ws,
-      buffered_amount
-  );
-  return retval;
-}
-
-NaClSrpcError PpbWebSocketRpcClient::PPB_WebSocket_GetCloseCode(
-    NaClSrpcChannel* channel,
-    PP_Resource ws,
-    int32_t* close_code)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_WebSocket_GetCloseCode:i:i",
-      ws,
-      close_code
-  );
-  return retval;
-}
-
-NaClSrpcError PpbWebSocketRpcClient::PPB_WebSocket_GetCloseReason(
-    NaClSrpcChannel* channel,
-    PP_Resource ws,
-    nacl_abi_size_t* reason_bytes, char* reason)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_WebSocket_GetCloseReason:i:C",
-      ws,
-      reason_bytes, reason
-  );
-  return retval;
-}
-
-NaClSrpcError PpbWebSocketRpcClient::PPB_WebSocket_GetCloseWasClean(
-    NaClSrpcChannel* channel,
-    PP_Resource ws,
-    int32_t* was_clean)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_WebSocket_GetCloseWasClean:i:i",
-      ws,
-      was_clean
-  );
-  return retval;
-}
-
-NaClSrpcError PpbWebSocketRpcClient::PPB_WebSocket_GetExtensions(
-    NaClSrpcChannel* channel,
-    PP_Resource ws,
-    nacl_abi_size_t* extensions_bytes, char* extensions)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_WebSocket_GetExtensions:i:C",
-      ws,
-      extensions_bytes, extensions
-  );
-  return retval;
-}
-
-NaClSrpcError PpbWebSocketRpcClient::PPB_WebSocket_GetProtocol(
-    NaClSrpcChannel* channel,
-    PP_Resource ws,
-    nacl_abi_size_t* protocol_bytes, char* protocol)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_WebSocket_GetProtocol:i:C",
-      ws,
-      protocol_bytes, protocol
-  );
-  return retval;
-}
-
-NaClSrpcError PpbWebSocketRpcClient::PPB_WebSocket_GetReadyState(
-    NaClSrpcChannel* channel,
-    PP_Resource ws,
-    int32_t* ready_state)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_WebSocket_GetReadyState:i:i",
-      ws,
-      ready_state
-  );
-  return retval;
-}
-
-NaClSrpcError PpbWebSocketRpcClient::PPB_WebSocket_GetURL(
-    NaClSrpcChannel* channel,
-    PP_Resource ws,
-    nacl_abi_size_t* url_bytes, char* url)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_WebSocket_GetURL:i:C",
-      ws,
-      url_bytes, url
-  );
-  return retval;
-}
-
-NaClSrpcError PpbZoomRpcClient::PPB_Zoom_ZoomChanged(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    double factor)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Zoom_ZoomChanged:id:",
-      instance,
-      factor
-  );
-  return retval;
-}
-
-NaClSrpcError PpbZoomRpcClient::PPB_Zoom_ZoomLimitsChanged(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    double minimum_factor,
-    double maximum_factor)  {
-  VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
-         ("%s: PPAPI calls are not supported off the main thread\n",
-          __FUNCTION__));
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Zoom_ZoomLimitsChanged:idd:",
-      instance,
-      minimum_factor,
-      maximum_factor
-  );
-  return retval;
-}
-
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_server.cc
deleted file mode 100644
index da42e3d..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_server.cc
+++ /dev/null
@@ -1,3047 +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.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// Automatically generated code.  See srpcgen.py
-//
-// NaCl Simple Remote Procedure Call interface abstractions.
-
-#include "trusted/srpcgen/ppb_rpc.h"
-#ifdef __native_client__
-#ifndef UNREFERENCED_PARAMETER
-#define UNREFERENCED_PARAMETER(P) do { (void) P; } while (0)
-#endif  // UNREFERENCED_PARAMETER
-#else
-#include "native_client/src/include/portability.h"
-#endif  // __native_client__
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-
-namespace {
-
-static void PPB_GetInterfaceDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbRpcServer::PPB_GetInterface(
-      rpc,
-      done,
-      inputs[0]->arrays.str,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Audio_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbAudioRpcServer::PPB_Audio_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Audio_IsAudioDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbAudioRpcServer::PPB_Audio_IsAudio(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Audio_GetCurrentConfigDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbAudioRpcServer::PPB_Audio_GetCurrentConfig(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Audio_StopPlaybackDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbAudioRpcServer::PPB_Audio_StopPlayback(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Audio_StartPlaybackDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbAudioRpcServer::PPB_Audio_StartPlayback(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_AudioConfig_CreateStereo16BitDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbAudioConfigRpcServer::PPB_AudioConfig_CreateStereo16Bit(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_AudioConfig_IsAudioConfigDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbAudioConfigRpcServer::PPB_AudioConfig_IsAudioConfig(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_AudioConfig_RecommendSampleFrameCount_1_0Dispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbAudioConfigRpcServer::PPB_AudioConfig_RecommendSampleFrameCount_1_0(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_AudioConfig_RecommendSampleFrameCountDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbAudioConfigRpcServer::PPB_AudioConfig_RecommendSampleFrameCount(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_AudioConfig_GetSampleRateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbAudioConfigRpcServer::PPB_AudioConfig_GetSampleRate(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_AudioConfig_GetSampleFrameCountDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbAudioConfigRpcServer::PPB_AudioConfig_GetSampleFrameCount(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_AudioConfig_RecommendSampleRateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbAudioConfigRpcServer::PPB_AudioConfig_RecommendSampleRate(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Core_AddRefResourceDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbCoreRpcServer::PPB_Core_AddRefResource(
-      rpc,
-      done,
-      inputs[0]->u.ival
-  );
-}
-
-static void PPB_Core_ReleaseResourceDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbCoreRpcServer::PPB_Core_ReleaseResource(
-      rpc,
-      done,
-      inputs[0]->u.ival
-  );
-}
-
-static void ReleaseResourceMultipleTimesDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbCoreRpcServer::ReleaseResourceMultipleTimes(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival
-  );
-}
-
-static void PPB_Core_GetTimeDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(inputs);
-  PpbCoreRpcServer::PPB_Core_GetTime(
-      rpc,
-      done,
-      &(outputs[0]->u.dval)
-  );
-}
-
-static void PPB_Core_GetTimeTicksDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(inputs);
-  PpbCoreRpcServer::PPB_Core_GetTimeTicks(
-      rpc,
-      done,
-      &(outputs[0]->u.dval)
-  );
-}
-
-static void PPB_Core_CallOnMainThreadDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbCoreRpcServer::PPB_Core_CallOnMainThread(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival
-  );
-}
-
-static void PPB_FileIO_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileIORpcServer::PPB_FileIO_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileIO_IsFileIODispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileIORpcServer::PPB_FileIO_IsFileIO(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileIO_OpenDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileIORpcServer::PPB_FileIO_Open(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival,
-      inputs[3]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileIO_QueryDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileIORpcServer::PPB_FileIO_Query(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_FileIO_TouchDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileIORpcServer::PPB_FileIO_Touch(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.dval,
-      inputs[2]->u.dval,
-      inputs[3]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileIO_ReadDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileIORpcServer::PPB_FileIO_Read(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.lval,
-      inputs[2]->u.ival,
-      inputs[3]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_FileIO_WriteDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileIORpcServer::PPB_FileIO_Write(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.lval,
-      inputs[2]->u.count, inputs[2]->arrays.carr,
-      inputs[3]->u.ival,
-      inputs[4]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileIO_SetLengthDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileIORpcServer::PPB_FileIO_SetLength(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.lval,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileIO_FlushDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileIORpcServer::PPB_FileIO_Flush(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileIO_CloseDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbFileIORpcServer::PPB_FileIO_Close(
-      rpc,
-      done,
-      inputs[0]->u.ival
-  );
-}
-
-static void PPB_FileRef_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileRefRpcServer::PPB_FileRef_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileRef_IsFileRefDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileRefRpcServer::PPB_FileRef_IsFileRef(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileRef_GetFileSystemTypeDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileRefRpcServer::PPB_FileRef_GetFileSystemType(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileRef_GetNameDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileRefRpcServer::PPB_FileRef_GetName(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_FileRef_GetPathDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileRefRpcServer::PPB_FileRef_GetPath(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_FileRef_GetParentDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileRefRpcServer::PPB_FileRef_GetParent(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileRef_MakeDirectoryDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileRefRpcServer::PPB_FileRef_MakeDirectory(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileRef_TouchDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileRefRpcServer::PPB_FileRef_Touch(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.dval,
-      inputs[2]->u.dval,
-      inputs[3]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileRef_DeleteDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileRefRpcServer::PPB_FileRef_Delete(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileRef_RenameDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileRefRpcServer::PPB_FileRef_Rename(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileSystem_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileSystemRpcServer::PPB_FileSystem_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileSystem_IsFileSystemDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileSystemRpcServer::PPB_FileSystem_IsFileSystem(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileSystem_OpenDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileSystemRpcServer::PPB_FileSystem_Open(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.lval,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_FileSystem_GetTypeDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFileSystemRpcServer::PPB_FileSystem_GetType(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Find_NumberOfFindResultsChangedDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbFindRpcServer::PPB_Find_NumberOfFindResultsChanged(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival
-  );
-}
-
-static void PPB_Find_SelectedFindResultChangedDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbFindRpcServer::PPB_Find_SelectedFindResultChanged(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival
-  );
-}
-
-static void PPB_Font_GetFontFamiliesDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFontRpcServer::PPB_Font_GetFontFamilies(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_Font_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFontRpcServer::PPB_Font_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      inputs[2]->u.count, inputs[2]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Font_IsFontDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFontRpcServer::PPB_Font_IsFont(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Font_DescribeDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFontRpcServer::PPB_Font_Describe(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.count), outputs[1]->arrays.carr,
-      &(outputs[2]->u.count), outputs[2]->arrays.carr,
-      &(outputs[3]->u.ival)
-  );
-}
-
-static void PPB_Font_DrawTextAtDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFontRpcServer::PPB_Font_DrawTextAt(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.count, inputs[2]->arrays.carr,
-      inputs[3]->u.count, inputs[3]->arrays.carr,
-      inputs[4]->u.count, inputs[4]->arrays.carr,
-      inputs[5]->u.ival,
-      inputs[6]->u.count, inputs[6]->arrays.carr,
-      inputs[7]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Font_MeasureTextDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFontRpcServer::PPB_Font_MeasureText(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      inputs[2]->u.count, inputs[2]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Font_CharacterOffsetForPixelDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFontRpcServer::PPB_Font_CharacterOffsetForPixel(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      inputs[2]->u.count, inputs[2]->arrays.carr,
-      inputs[3]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Font_PixelOffsetForCharacterDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFontRpcServer::PPB_Font_PixelOffsetForCharacter(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      inputs[2]->u.count, inputs[2]->arrays.carr,
-      inputs[3]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Fullscreen_SetFullscreenDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFullscreenRpcServer::PPB_Fullscreen_SetFullscreen(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Fullscreen_GetScreenSizeDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbFullscreenRpcServer::PPB_Fullscreen_GetScreenSize(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_Gamepad_SampleDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGamepadRpcServer::PPB_Gamepad_Sample(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_Graphics2D_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics2DRpcServer::PPB_Graphics2D_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Graphics2D_IsGraphics2DDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics2DRpcServer::PPB_Graphics2D_IsGraphics2D(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Graphics2D_DescribeDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics2DRpcServer::PPB_Graphics2D_Describe(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.ival),
-      &(outputs[2]->u.ival)
-  );
-}
-
-static void PPB_Graphics2D_PaintImageDataDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbGraphics2DRpcServer::PPB_Graphics2D_PaintImageData(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.count, inputs[2]->arrays.carr,
-      inputs[3]->u.count, inputs[3]->arrays.carr
-  );
-}
-
-static void PPB_Graphics2D_ScrollDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbGraphics2DRpcServer::PPB_Graphics2D_Scroll(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      inputs[2]->u.count, inputs[2]->arrays.carr
-  );
-}
-
-static void PPB_Graphics2D_ReplaceContentsDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbGraphics2DRpcServer::PPB_Graphics2D_ReplaceContents(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival
-  );
-}
-
-static void PPB_Graphics2D_FlushDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics2DRpcServer::PPB_Graphics2D_Flush(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Graphics3D_GetAttribMaxValueDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics3DRpcServer::PPB_Graphics3D_GetAttribMaxValue(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival),
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_Graphics3D_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics3DRpcServer::PPB_Graphics3D_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.count, inputs[2]->arrays.iarr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Graphics3D_GetAttribsDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics3DRpcServer::PPB_Graphics3D_GetAttribs(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.iarr,
-      &(outputs[0]->u.count), outputs[0]->arrays.iarr,
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_Graphics3D_SetAttribsDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics3DRpcServer::PPB_Graphics3D_SetAttribs(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.iarr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Graphics3D_GetErrorDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics3DRpcServer::PPB_Graphics3D_GetError(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Graphics3D_SwapBuffersDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics3DRpcServer::PPB_Graphics3D_SwapBuffers(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Graphics3DTrusted_CreateRawDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_CreateRaw(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.count, inputs[2]->arrays.iarr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Graphics3DTrusted_InitCommandBufferDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_InitCommandBuffer(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Graphics3DTrusted_SetGetBufferDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_SetGetBuffer(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival
-  );
-}
-
-static void PPB_Graphics3DTrusted_GetStateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_GetState(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_Graphics3DTrusted_FlushDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_Flush(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival
-  );
-}
-
-static void PPB_Graphics3DTrusted_FlushSyncDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_FlushSync(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_Graphics3DTrusted_FlushSyncFastDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_FlushSyncFast(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_Graphics3DTrusted_CreateTransferBufferDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_CreateTransferBuffer(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Graphics3DTrusted_DestroyTransferBufferDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_DestroyTransferBuffer(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival
-  );
-}
-
-static void PPB_Graphics3DTrusted_GetTransferBufferDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_GetTransferBuffer(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.hval),
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_HostResolver_Private_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbHostResolverPrivateRpcServer::PPB_HostResolver_Private_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_HostResolver_Private_IsHostResolverDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbHostResolverPrivateRpcServer::PPB_HostResolver_Private_IsHostResolver(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_HostResolver_Private_ResolveDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbHostResolverPrivateRpcServer::PPB_HostResolver_Private_Resolve(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->arrays.str,
-      inputs[2]->u.ival,
-      inputs[3]->u.count, inputs[3]->arrays.carr,
-      inputs[4]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_HostResolver_Private_GetCanonicalNameDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbHostResolverPrivateRpcServer::PPB_HostResolver_Private_GetCanonicalName(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_HostResolver_Private_GetSizeDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbHostResolverPrivateRpcServer::PPB_HostResolver_Private_GetSize(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_HostResolver_Private_GetNetAddressDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbHostResolverPrivateRpcServer::PPB_HostResolver_Private_GetNetAddress(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_ImageData_GetNativeImageDataFormatDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(inputs);
-  PpbImageDataRpcServer::PPB_ImageData_GetNativeImageDataFormat(
-      rpc,
-      done,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_ImageData_IsImageDataFormatSupportedDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbImageDataRpcServer::PPB_ImageData_IsImageDataFormatSupported(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_ImageData_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbImageDataRpcServer::PPB_ImageData_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.count, inputs[2]->arrays.carr,
-      inputs[3]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_ImageData_IsImageDataDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbImageDataRpcServer::PPB_ImageData_IsImageData(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_ImageData_DescribeDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbImageDataRpcServer::PPB_ImageData_Describe(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.hval),
-      &(outputs[2]->u.ival),
-      &(outputs[3]->u.ival)
-  );
-}
-
-static void PPB_InputEvent_RequestInputEventsDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbInputEventRpcServer::PPB_InputEvent_RequestInputEvents(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_InputEvent_ClearInputEventRequestDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbInputEventRpcServer::PPB_InputEvent_ClearInputEventRequest(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival
-  );
-}
-
-static void PPB_InputEvent_CreateMouseInputEventDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbInputEventRpcServer::PPB_InputEvent_CreateMouseInputEvent(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.dval,
-      inputs[3]->u.ival,
-      inputs[4]->u.ival,
-      inputs[5]->u.ival,
-      inputs[6]->u.ival,
-      inputs[7]->u.ival,
-      inputs[8]->u.ival,
-      inputs[9]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_InputEvent_CreateWheelInputEventDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbInputEventRpcServer::PPB_InputEvent_CreateWheelInputEvent(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.dval,
-      inputs[2]->u.ival,
-      inputs[3]->u.dval,
-      inputs[4]->u.dval,
-      inputs[5]->u.dval,
-      inputs[6]->u.dval,
-      inputs[7]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_InputEvent_CreateKeyboardInputEventDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbInputEventRpcServer::PPB_InputEvent_CreateKeyboardInputEvent(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.dval,
-      inputs[3]->u.ival,
-      inputs[4]->u.ival,
-      inputs[5]->u.count, inputs[5]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Instance_BindGraphicsDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbInstanceRpcServer::PPB_Instance_BindGraphics(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Instance_IsFullFrameDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbInstanceRpcServer::PPB_Instance_IsFullFrame(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Messaging_PostMessageDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbMessagingRpcServer::PPB_Messaging_PostMessage(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr
-  );
-}
-
-static void PPB_MouseCursor_SetCursorDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbMouseCursorRpcServer::PPB_MouseCursor_SetCursor(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival,
-      inputs[3]->u.count, inputs[3]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_MouseLock_LockMouseDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbMouseLockRpcServer::PPB_MouseLock_LockMouse(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_MouseLock_UnlockMouseDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbMouseLockRpcServer::PPB_MouseLock_UnlockMouse(
-      rpc,
-      done,
-      inputs[0]->u.ival
-  );
-}
-
-static void PPB_NetAddress_Private_AreEqualDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_AreEqual(
-      rpc,
-      done,
-      inputs[0]->u.count, inputs[0]->arrays.carr,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_NetAddress_Private_AreHostsEqualDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_AreHostsEqual(
-      rpc,
-      done,
-      inputs[0]->u.count, inputs[0]->arrays.carr,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_NetAddress_Private_DescribeDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_Describe(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_NetAddress_Private_ReplacePortDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_ReplacePort(
-      rpc,
-      done,
-      inputs[0]->u.count, inputs[0]->arrays.carr,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_NetAddress_Private_GetAnyAddressDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_GetAnyAddress(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_NetAddress_Private_GetFamilyDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_GetFamily(
-      rpc,
-      done,
-      inputs[0]->u.count, inputs[0]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_NetAddress_Private_GetPortDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_GetPort(
-      rpc,
-      done,
-      inputs[0]->u.count, inputs[0]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_NetAddress_Private_GetAddressDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_GetAddress(
-      rpc,
-      done,
-      inputs[0]->u.count, inputs[0]->arrays.carr,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_NetAddress_Private_GetScopeIDDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_GetScopeID(
-      rpc,
-      done,
-      inputs[0]->u.count, inputs[0]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_NetAddress_Private_CreateFromIPv4AddressDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_CreateFromIPv4Address(
-      rpc,
-      done,
-      inputs[0]->u.count, inputs[0]->arrays.carr,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_NetAddress_Private_CreateFromIPv6AddressDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetAddressPrivateRpcServer::PPB_NetAddress_Private_CreateFromIPv6Address(
-      rpc,
-      done,
-      inputs[0]->u.count, inputs[0]->arrays.carr,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_NetworkList_Private_IsNetworkListDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetworkListPrivateServer::PPB_NetworkList_Private_IsNetworkList(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_NetworkList_Private_GetCountDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetworkListPrivateServer::PPB_NetworkList_Private_GetCount(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_NetworkList_Private_GetNameDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetworkListPrivateServer::PPB_NetworkList_Private_GetName(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_NetworkList_Private_GetTypeDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetworkListPrivateServer::PPB_NetworkList_Private_GetType(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_NetworkList_Private_GetStateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetworkListPrivateServer::PPB_NetworkList_Private_GetState(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_NetworkList_Private_GetIpAddressesDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetworkListPrivateServer::PPB_NetworkList_Private_GetIpAddresses(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_NetworkList_Private_GetDisplayNameDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetworkListPrivateServer::PPB_NetworkList_Private_GetDisplayName(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_NetworkList_Private_GetMTUDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetworkListPrivateServer::PPB_NetworkList_Private_GetMTU(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_NetworkMonitor_Private_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetworkMonitorPrivateServer::PPB_NetworkMonitor_Private_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_NetworkMonitor_Private_IsNetworkMonitorDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbNetworkMonitorPrivateServer::PPB_NetworkMonitor_Private_IsNetworkMonitor(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_TCPServerSocket_Private_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTCPServerSocketPrivateRpcServer::PPB_TCPServerSocket_Private_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_TCPServerSocket_Private_IsTCPServerSocketDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTCPServerSocketPrivateRpcServer::PPB_TCPServerSocket_Private_IsTCPServerSocket(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_TCPServerSocket_Private_ListenDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTCPServerSocketPrivateRpcServer::PPB_TCPServerSocket_Private_Listen(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      inputs[2]->u.ival,
-      inputs[3]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_TCPServerSocket_Private_AcceptDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTCPServerSocketPrivateRpcServer::PPB_TCPServerSocket_Private_Accept(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival),
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_TCPServerSocket_Private_StopListeningDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbTCPServerSocketPrivateRpcServer::PPB_TCPServerSocket_Private_StopListening(
-      rpc,
-      done,
-      inputs[0]->u.ival
-  );
-}
-
-static void PPB_TCPSocket_Private_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_TCPSocket_Private_IsTCPSocketDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_IsTCPSocket(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_TCPSocket_Private_ConnectDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_Connect(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->arrays.str,
-      inputs[2]->u.ival,
-      inputs[3]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_TCPSocket_Private_ConnectWithNetAddressDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_ConnectWithNetAddress(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_TCPSocket_Private_GetLocalAddressDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_GetLocalAddress(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_TCPSocket_Private_GetRemoteAddressDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_GetRemoteAddress(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_TCPSocket_Private_SSLHandshakeDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_SSLHandshake(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->arrays.str,
-      inputs[2]->u.ival,
-      inputs[3]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_TCPSocket_Private_ReadDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_Read(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_TCPSocket_Private_WriteDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_Write(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      inputs[2]->u.ival,
-      inputs[3]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_TCPSocket_Private_DisconnectDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbTCPSocketPrivateRpcServer::PPB_TCPSocket_Private_Disconnect(
-      rpc,
-      done,
-      inputs[0]->u.ival
-  );
-}
-
-static void PPB_Testing_ReadImageDataDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTestingRpcServer::PPB_Testing_ReadImageData(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.count, inputs[2]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Testing_RunMessageLoopDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbTestingRpcServer::PPB_Testing_RunMessageLoop(
-      rpc,
-      done,
-      inputs[0]->u.ival
-  );
-}
-
-static void PPB_Testing_QuitMessageLoopDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbTestingRpcServer::PPB_Testing_QuitMessageLoop(
-      rpc,
-      done,
-      inputs[0]->u.ival
-  );
-}
-
-static void PPB_Testing_GetLiveObjectsForInstanceDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTestingRpcServer::PPB_Testing_GetLiveObjectsForInstance(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_Testing_SimulateInputEventDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbTestingRpcServer::PPB_Testing_SimulateInputEvent(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival
-  );
-}
-
-static void PPB_Testing_GetDocumentURLDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbTestingRpcServer::PPB_Testing_GetDocumentURL(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.count), outputs[1]->arrays.carr
-  );
-}
-
-static void PPB_UDPSocket_Private_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_UDPSocket_Private_IsUDPSocketDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_IsUDPSocket(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_UDPSocket_Private_SetSocketFeatureDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_SetSocketFeature(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.count, inputs[2]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_UDPSocket_Private_BindDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_Bind(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_UDPSocket_Private_GetBoundAddressDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_GetBoundAddress(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_UDPSocket_Private_RecvFromDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_RecvFrom(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_UDPSocket_Private_GetRecvFromAddressDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_GetRecvFromAddress(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_UDPSocket_Private_SendToDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_SendTo(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      inputs[2]->u.ival,
-      inputs[3]->u.count, inputs[3]->arrays.carr,
-      inputs[4]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_UDPSocket_Private_CloseDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbUDPSocketPrivateRpcServer::PPB_UDPSocket_Private_Close(
-      rpc,
-      done,
-      inputs[0]->u.ival
-  );
-}
-
-static void PPB_URLLoader_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLLoaderRpcServer::PPB_URLLoader_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_URLLoader_IsURLLoaderDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLLoaderRpcServer::PPB_URLLoader_IsURLLoader(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_URLLoader_OpenDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLLoaderRpcServer::PPB_URLLoader_Open(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_URLLoader_FollowRedirectDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLLoaderRpcServer::PPB_URLLoader_FollowRedirect(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_URLLoader_GetUploadProgressDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLLoaderRpcServer::PPB_URLLoader_GetUploadProgress(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.lval),
-      &(outputs[1]->u.lval),
-      &(outputs[2]->u.ival)
-  );
-}
-
-static void PPB_URLLoader_GetDownloadProgressDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLLoaderRpcServer::PPB_URLLoader_GetDownloadProgress(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.lval),
-      &(outputs[1]->u.lval),
-      &(outputs[2]->u.ival)
-  );
-}
-
-static void PPB_URLLoader_GetResponseInfoDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLLoaderRpcServer::PPB_URLLoader_GetResponseInfo(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_URLLoader_ReadResponseBodyDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLLoaderRpcServer::PPB_URLLoader_ReadResponseBody(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr,
-      &(outputs[1]->u.ival)
-  );
-}
-
-static void PPB_URLLoader_FinishStreamingToFileDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLLoaderRpcServer::PPB_URLLoader_FinishStreamingToFile(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_URLLoader_CloseDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbURLLoaderRpcServer::PPB_URLLoader_Close(
-      rpc,
-      done,
-      inputs[0]->u.ival
-  );
-}
-
-static void PPB_URLRequestInfo_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLRequestInfoRpcServer::PPB_URLRequestInfo_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_URLRequestInfo_IsURLRequestInfoDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLRequestInfoRpcServer::PPB_URLRequestInfo_IsURLRequestInfo(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_URLRequestInfo_SetPropertyDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLRequestInfoRpcServer::PPB_URLRequestInfo_SetProperty(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.count, inputs[2]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_URLRequestInfo_AppendDataToBodyDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLRequestInfoRpcServer::PPB_URLRequestInfo_AppendDataToBody(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_URLRequestInfo_AppendFileToBodyDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLRequestInfoRpcServer::PPB_URLRequestInfo_AppendFileToBody(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.lval,
-      inputs[3]->u.lval,
-      inputs[4]->u.dval,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_URLResponseInfo_IsURLResponseInfoDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLResponseInfoRpcServer::PPB_URLResponseInfo_IsURLResponseInfo(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_URLResponseInfo_GetPropertyDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLResponseInfoRpcServer::PPB_URLResponseInfo_GetProperty(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_URLResponseInfo_GetBodyAsFileRefDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbURLResponseInfoRpcServer::PPB_URLResponseInfo_GetBodyAsFileRef(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_WebSocket_CreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbWebSocketRpcServer::PPB_WebSocket_Create(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_WebSocket_IsWebSocketDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbWebSocketRpcServer::PPB_WebSocket_IsWebSocket(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_WebSocket_ConnectDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbWebSocketRpcServer::PPB_WebSocket_Connect(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      inputs[2]->u.count, inputs[2]->arrays.carr,
-      inputs[3]->u.ival,
-      inputs[4]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_WebSocket_CloseDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbWebSocketRpcServer::PPB_WebSocket_Close(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.count, inputs[2]->arrays.carr,
-      inputs[3]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_WebSocket_ReceiveMessageDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbWebSocketRpcServer::PPB_WebSocket_ReceiveMessage(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival),
-      &(outputs[1]->u.count), outputs[1]->arrays.carr
-  );
-}
-
-static void PPB_WebSocket_SendMessageDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbWebSocketRpcServer::PPB_WebSocket_SendMessage(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_WebSocket_GetBufferedAmountDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbWebSocketRpcServer::PPB_WebSocket_GetBufferedAmount(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.lval)
-  );
-}
-
-static void PPB_WebSocket_GetCloseCodeDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbWebSocketRpcServer::PPB_WebSocket_GetCloseCode(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_WebSocket_GetCloseReasonDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbWebSocketRpcServer::PPB_WebSocket_GetCloseReason(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_WebSocket_GetCloseWasCleanDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbWebSocketRpcServer::PPB_WebSocket_GetCloseWasClean(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_WebSocket_GetExtensionsDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbWebSocketRpcServer::PPB_WebSocket_GetExtensions(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_WebSocket_GetProtocolDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbWebSocketRpcServer::PPB_WebSocket_GetProtocol(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_WebSocket_GetReadyStateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbWebSocketRpcServer::PPB_WebSocket_GetReadyState(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPB_WebSocket_GetURLDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PpbWebSocketRpcServer::PPB_WebSocket_GetURL(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPB_Zoom_ZoomChangedDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbZoomRpcServer::PPB_Zoom_ZoomChanged(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.dval
-  );
-}
-
-static void PPB_Zoom_ZoomLimitsChangedDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PpbZoomRpcServer::PPB_Zoom_ZoomLimitsChanged(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.dval,
-      inputs[2]->u.dval
-  );
-}
-
-}  // namespace
-
-NaClSrpcHandlerDesc PpbRpcs::srpc_methods[] = {
-  { "PPB_GetInterface:s:i", PPB_GetInterfaceDispatcher },
-  { "PPB_Audio_Create:ii:i", PPB_Audio_CreateDispatcher },
-  { "PPB_Audio_IsAudio:i:i", PPB_Audio_IsAudioDispatcher },
-  { "PPB_Audio_GetCurrentConfig:i:i", PPB_Audio_GetCurrentConfigDispatcher },
-  { "PPB_Audio_StopPlayback:i:i", PPB_Audio_StopPlaybackDispatcher },
-  { "PPB_Audio_StartPlayback:i:i", PPB_Audio_StartPlaybackDispatcher },
-  { "PPB_AudioConfig_CreateStereo16Bit:iii:i", PPB_AudioConfig_CreateStereo16BitDispatcher },
-  { "PPB_AudioConfig_IsAudioConfig:i:i", PPB_AudioConfig_IsAudioConfigDispatcher },
-  { "PPB_AudioConfig_RecommendSampleFrameCount_1_0:ii:i", PPB_AudioConfig_RecommendSampleFrameCount_1_0Dispatcher },
-  { "PPB_AudioConfig_RecommendSampleFrameCount:iii:i", PPB_AudioConfig_RecommendSampleFrameCountDispatcher },
-  { "PPB_AudioConfig_GetSampleRate:i:i", PPB_AudioConfig_GetSampleRateDispatcher },
-  { "PPB_AudioConfig_GetSampleFrameCount:i:i", PPB_AudioConfig_GetSampleFrameCountDispatcher },
-  { "PPB_AudioConfig_RecommendSampleRate:i:i", PPB_AudioConfig_RecommendSampleRateDispatcher },
-  { "PPB_Core_AddRefResource:i:", PPB_Core_AddRefResourceDispatcher },
-  { "PPB_Core_ReleaseResource:i:", PPB_Core_ReleaseResourceDispatcher },
-  { "ReleaseResourceMultipleTimes:ii:", ReleaseResourceMultipleTimesDispatcher },
-  { "PPB_Core_GetTime::d", PPB_Core_GetTimeDispatcher },
-  { "PPB_Core_GetTimeTicks::d", PPB_Core_GetTimeTicksDispatcher },
-  { "PPB_Core_CallOnMainThread:iii:", PPB_Core_CallOnMainThreadDispatcher },
-  { "PPB_FileIO_Create:i:i", PPB_FileIO_CreateDispatcher },
-  { "PPB_FileIO_IsFileIO:i:i", PPB_FileIO_IsFileIODispatcher },
-  { "PPB_FileIO_Open:iiii:i", PPB_FileIO_OpenDispatcher },
-  { "PPB_FileIO_Query:iii:Ci", PPB_FileIO_QueryDispatcher },
-  { "PPB_FileIO_Touch:iddi:i", PPB_FileIO_TouchDispatcher },
-  { "PPB_FileIO_Read:ilii:Ci", PPB_FileIO_ReadDispatcher },
-  { "PPB_FileIO_Write:ilCii:i", PPB_FileIO_WriteDispatcher },
-  { "PPB_FileIO_SetLength:ili:i", PPB_FileIO_SetLengthDispatcher },
-  { "PPB_FileIO_Flush:ii:i", PPB_FileIO_FlushDispatcher },
-  { "PPB_FileIO_Close:i:", PPB_FileIO_CloseDispatcher },
-  { "PPB_FileRef_Create:iC:i", PPB_FileRef_CreateDispatcher },
-  { "PPB_FileRef_IsFileRef:i:i", PPB_FileRef_IsFileRefDispatcher },
-  { "PPB_FileRef_GetFileSystemType:i:i", PPB_FileRef_GetFileSystemTypeDispatcher },
-  { "PPB_FileRef_GetName:i:C", PPB_FileRef_GetNameDispatcher },
-  { "PPB_FileRef_GetPath:i:C", PPB_FileRef_GetPathDispatcher },
-  { "PPB_FileRef_GetParent:i:i", PPB_FileRef_GetParentDispatcher },
-  { "PPB_FileRef_MakeDirectory:iii:i", PPB_FileRef_MakeDirectoryDispatcher },
-  { "PPB_FileRef_Touch:iddi:i", PPB_FileRef_TouchDispatcher },
-  { "PPB_FileRef_Delete:ii:i", PPB_FileRef_DeleteDispatcher },
-  { "PPB_FileRef_Rename:iii:i", PPB_FileRef_RenameDispatcher },
-  { "PPB_FileSystem_Create:ii:i", PPB_FileSystem_CreateDispatcher },
-  { "PPB_FileSystem_IsFileSystem:i:i", PPB_FileSystem_IsFileSystemDispatcher },
-  { "PPB_FileSystem_Open:ili:i", PPB_FileSystem_OpenDispatcher },
-  { "PPB_FileSystem_GetType:i:i", PPB_FileSystem_GetTypeDispatcher },
-  { "PPB_Find_NumberOfFindResultsChanged:iii:", PPB_Find_NumberOfFindResultsChangedDispatcher },
-  { "PPB_Find_SelectedFindResultChanged:ii:", PPB_Find_SelectedFindResultChangedDispatcher },
-  { "PPB_Font_GetFontFamilies:i:C", PPB_Font_GetFontFamiliesDispatcher },
-  { "PPB_Font_Create:iCC:i", PPB_Font_CreateDispatcher },
-  { "PPB_Font_IsFont:i:i", PPB_Font_IsFontDispatcher },
-  { "PPB_Font_Describe:i:CCCi", PPB_Font_DescribeDispatcher },
-  { "PPB_Font_DrawTextAt:iiCCCiCi:i", PPB_Font_DrawTextAtDispatcher },
-  { "PPB_Font_MeasureText:iCC:i", PPB_Font_MeasureTextDispatcher },
-  { "PPB_Font_CharacterOffsetForPixel:iCCi:i", PPB_Font_CharacterOffsetForPixelDispatcher },
-  { "PPB_Font_PixelOffsetForCharacter:iCCi:i", PPB_Font_PixelOffsetForCharacterDispatcher },
-  { "PPB_Fullscreen_SetFullscreen:ii:i", PPB_Fullscreen_SetFullscreenDispatcher },
-  { "PPB_Fullscreen_GetScreenSize:i:Ci", PPB_Fullscreen_GetScreenSizeDispatcher },
-  { "PPB_Gamepad_Sample:i:C", PPB_Gamepad_SampleDispatcher },
-  { "PPB_Graphics2D_Create:iCi:i", PPB_Graphics2D_CreateDispatcher },
-  { "PPB_Graphics2D_IsGraphics2D:i:i", PPB_Graphics2D_IsGraphics2DDispatcher },
-  { "PPB_Graphics2D_Describe:i:Cii", PPB_Graphics2D_DescribeDispatcher },
-  { "PPB_Graphics2D_PaintImageData:iiCC:", PPB_Graphics2D_PaintImageDataDispatcher },
-  { "PPB_Graphics2D_Scroll:iCC:", PPB_Graphics2D_ScrollDispatcher },
-  { "PPB_Graphics2D_ReplaceContents:ii:", PPB_Graphics2D_ReplaceContentsDispatcher },
-  { "PPB_Graphics2D_Flush:ii:i", PPB_Graphics2D_FlushDispatcher },
-  { "PPB_Graphics3D_GetAttribMaxValue:ii:ii", PPB_Graphics3D_GetAttribMaxValueDispatcher },
-  { "PPB_Graphics3D_Create:iiI:i", PPB_Graphics3D_CreateDispatcher },
-  { "PPB_Graphics3D_GetAttribs:iI:Ii", PPB_Graphics3D_GetAttribsDispatcher },
-  { "PPB_Graphics3D_SetAttribs:iI:i", PPB_Graphics3D_SetAttribsDispatcher },
-  { "PPB_Graphics3D_GetError:i:i", PPB_Graphics3D_GetErrorDispatcher },
-  { "PPB_Graphics3D_SwapBuffers:ii:i", PPB_Graphics3D_SwapBuffersDispatcher },
-  { "PPB_Graphics3DTrusted_CreateRaw:iiI:i", PPB_Graphics3DTrusted_CreateRawDispatcher },
-  { "PPB_Graphics3DTrusted_InitCommandBuffer:i:i", PPB_Graphics3DTrusted_InitCommandBufferDispatcher },
-  { "PPB_Graphics3DTrusted_SetGetBuffer:ii:", PPB_Graphics3DTrusted_SetGetBufferDispatcher },
-  { "PPB_Graphics3DTrusted_GetState:i:C", PPB_Graphics3DTrusted_GetStateDispatcher },
-  { "PPB_Graphics3DTrusted_Flush:ii:", PPB_Graphics3DTrusted_FlushDispatcher },
-  { "PPB_Graphics3DTrusted_FlushSync:ii:C", PPB_Graphics3DTrusted_FlushSyncDispatcher },
-  { "PPB_Graphics3DTrusted_FlushSyncFast:iii:C", PPB_Graphics3DTrusted_FlushSyncFastDispatcher },
-  { "PPB_Graphics3DTrusted_CreateTransferBuffer:iii:i", PPB_Graphics3DTrusted_CreateTransferBufferDispatcher },
-  { "PPB_Graphics3DTrusted_DestroyTransferBuffer:ii:", PPB_Graphics3DTrusted_DestroyTransferBufferDispatcher },
-  { "PPB_Graphics3DTrusted_GetTransferBuffer:ii:hi", PPB_Graphics3DTrusted_GetTransferBufferDispatcher },
-  { "PPB_HostResolver_Private_Create:i:i", PPB_HostResolver_Private_CreateDispatcher },
-  { "PPB_HostResolver_Private_IsHostResolver:i:i", PPB_HostResolver_Private_IsHostResolverDispatcher },
-  { "PPB_HostResolver_Private_Resolve:isiCi:i", PPB_HostResolver_Private_ResolveDispatcher },
-  { "PPB_HostResolver_Private_GetCanonicalName:i:C", PPB_HostResolver_Private_GetCanonicalNameDispatcher },
-  { "PPB_HostResolver_Private_GetSize:i:i", PPB_HostResolver_Private_GetSizeDispatcher },
-  { "PPB_HostResolver_Private_GetNetAddress:ii:Ci", PPB_HostResolver_Private_GetNetAddressDispatcher },
-  { "PPB_ImageData_GetNativeImageDataFormat::i", PPB_ImageData_GetNativeImageDataFormatDispatcher },
-  { "PPB_ImageData_IsImageDataFormatSupported:i:i", PPB_ImageData_IsImageDataFormatSupportedDispatcher },
-  { "PPB_ImageData_Create:iiCi:i", PPB_ImageData_CreateDispatcher },
-  { "PPB_ImageData_IsImageData:i:i", PPB_ImageData_IsImageDataDispatcher },
-  { "PPB_ImageData_Describe:i:Chii", PPB_ImageData_DescribeDispatcher },
-  { "PPB_InputEvent_RequestInputEvents:iii:i", PPB_InputEvent_RequestInputEventsDispatcher },
-  { "PPB_InputEvent_ClearInputEventRequest:ii:", PPB_InputEvent_ClearInputEventRequestDispatcher },
-  { "PPB_InputEvent_CreateMouseInputEvent:iidiiiiiii:i", PPB_InputEvent_CreateMouseInputEventDispatcher },
-  { "PPB_InputEvent_CreateWheelInputEvent:ididdddi:i", PPB_InputEvent_CreateWheelInputEventDispatcher },
-  { "PPB_InputEvent_CreateKeyboardInputEvent:iidiiC:i", PPB_InputEvent_CreateKeyboardInputEventDispatcher },
-  { "PPB_Instance_BindGraphics:ii:i", PPB_Instance_BindGraphicsDispatcher },
-  { "PPB_Instance_IsFullFrame:i:i", PPB_Instance_IsFullFrameDispatcher },
-  { "PPB_Messaging_PostMessage:iC:", PPB_Messaging_PostMessageDispatcher },
-  { "PPB_MouseCursor_SetCursor:iiiC:i", PPB_MouseCursor_SetCursorDispatcher },
-  { "PPB_MouseLock_LockMouse:ii:i", PPB_MouseLock_LockMouseDispatcher },
-  { "PPB_MouseLock_UnlockMouse:i:", PPB_MouseLock_UnlockMouseDispatcher },
-  { "PPB_NetAddress_Private_AreEqual:CC:i", PPB_NetAddress_Private_AreEqualDispatcher },
-  { "PPB_NetAddress_Private_AreHostsEqual:CC:i", PPB_NetAddress_Private_AreHostsEqualDispatcher },
-  { "PPB_NetAddress_Private_Describe:iCi:C", PPB_NetAddress_Private_DescribeDispatcher },
-  { "PPB_NetAddress_Private_ReplacePort:Ci:Ci", PPB_NetAddress_Private_ReplacePortDispatcher },
-  { "PPB_NetAddress_Private_GetAnyAddress:i:C", PPB_NetAddress_Private_GetAnyAddressDispatcher },
-  { "PPB_NetAddress_Private_GetFamily:C:i", PPB_NetAddress_Private_GetFamilyDispatcher },
-  { "PPB_NetAddress_Private_GetPort:C:i", PPB_NetAddress_Private_GetPortDispatcher },
-  { "PPB_NetAddress_Private_GetAddress:C:Ci", PPB_NetAddress_Private_GetAddressDispatcher },
-  { "PPB_NetAddress_Private_GetScopeID:C:i", PPB_NetAddress_Private_GetScopeIDDispatcher },
-  { "PPB_NetAddress_Private_CreateFromIPv4Address:Ci:C", PPB_NetAddress_Private_CreateFromIPv4AddressDispatcher },
-  { "PPB_NetAddress_Private_CreateFromIPv6Address:Cii:C", PPB_NetAddress_Private_CreateFromIPv6AddressDispatcher },
-  { "PPB_NetworkList_Private_IsNetworkList:i:i", PPB_NetworkList_Private_IsNetworkListDispatcher },
-  { "PPB_NetworkList_Private_GetCount:i:i", PPB_NetworkList_Private_GetCountDispatcher },
-  { "PPB_NetworkList_Private_GetName:ii:C", PPB_NetworkList_Private_GetNameDispatcher },
-  { "PPB_NetworkList_Private_GetType:ii:i", PPB_NetworkList_Private_GetTypeDispatcher },
-  { "PPB_NetworkList_Private_GetState:ii:i", PPB_NetworkList_Private_GetStateDispatcher },
-  { "PPB_NetworkList_Private_GetIpAddresses:ii:Ci", PPB_NetworkList_Private_GetIpAddressesDispatcher },
-  { "PPB_NetworkList_Private_GetDisplayName:ii:C", PPB_NetworkList_Private_GetDisplayNameDispatcher },
-  { "PPB_NetworkList_Private_GetMTU:ii:i", PPB_NetworkList_Private_GetMTUDispatcher },
-  { "PPB_NetworkMonitor_Private_Create:i:i", PPB_NetworkMonitor_Private_CreateDispatcher },
-  { "PPB_NetworkMonitor_Private_IsNetworkMonitor:i:i", PPB_NetworkMonitor_Private_IsNetworkMonitorDispatcher },
-  { "PPB_TCPServerSocket_Private_Create:i:i", PPB_TCPServerSocket_Private_CreateDispatcher },
-  { "PPB_TCPServerSocket_Private_IsTCPServerSocket:i:i", PPB_TCPServerSocket_Private_IsTCPServerSocketDispatcher },
-  { "PPB_TCPServerSocket_Private_Listen:iCii:i", PPB_TCPServerSocket_Private_ListenDispatcher },
-  { "PPB_TCPServerSocket_Private_Accept:ii:ii", PPB_TCPServerSocket_Private_AcceptDispatcher },
-  { "PPB_TCPServerSocket_Private_StopListening:i:", PPB_TCPServerSocket_Private_StopListeningDispatcher },
-  { "PPB_TCPSocket_Private_Create:i:i", PPB_TCPSocket_Private_CreateDispatcher },
-  { "PPB_TCPSocket_Private_IsTCPSocket:i:i", PPB_TCPSocket_Private_IsTCPSocketDispatcher },
-  { "PPB_TCPSocket_Private_Connect:isii:i", PPB_TCPSocket_Private_ConnectDispatcher },
-  { "PPB_TCPSocket_Private_ConnectWithNetAddress:iCi:i", PPB_TCPSocket_Private_ConnectWithNetAddressDispatcher },
-  { "PPB_TCPSocket_Private_GetLocalAddress:i:Ci", PPB_TCPSocket_Private_GetLocalAddressDispatcher },
-  { "PPB_TCPSocket_Private_GetRemoteAddress:i:Ci", PPB_TCPSocket_Private_GetRemoteAddressDispatcher },
-  { "PPB_TCPSocket_Private_SSLHandshake:isii:i", PPB_TCPSocket_Private_SSLHandshakeDispatcher },
-  { "PPB_TCPSocket_Private_Read:iii:Ci", PPB_TCPSocket_Private_ReadDispatcher },
-  { "PPB_TCPSocket_Private_Write:iCii:i", PPB_TCPSocket_Private_WriteDispatcher },
-  { "PPB_TCPSocket_Private_Disconnect:i:", PPB_TCPSocket_Private_DisconnectDispatcher },
-  { "PPB_Testing_ReadImageData:iiC:i", PPB_Testing_ReadImageDataDispatcher },
-  { "PPB_Testing_RunMessageLoop:i:", PPB_Testing_RunMessageLoopDispatcher },
-  { "PPB_Testing_QuitMessageLoop:i:", PPB_Testing_QuitMessageLoopDispatcher },
-  { "PPB_Testing_GetLiveObjectsForInstance:i:i", PPB_Testing_GetLiveObjectsForInstanceDispatcher },
-  { "PPB_Testing_SimulateInputEvent:ii:", PPB_Testing_SimulateInputEventDispatcher },
-  { "PPB_Testing_GetDocumentURL:i:CC", PPB_Testing_GetDocumentURLDispatcher },
-  { "PPB_UDPSocket_Private_Create:i:i", PPB_UDPSocket_Private_CreateDispatcher },
-  { "PPB_UDPSocket_Private_IsUDPSocket:i:i", PPB_UDPSocket_Private_IsUDPSocketDispatcher },
-  { "PPB_UDPSocket_Private_SetSocketFeature:iiC:i", PPB_UDPSocket_Private_SetSocketFeatureDispatcher },
-  { "PPB_UDPSocket_Private_Bind:iCi:i", PPB_UDPSocket_Private_BindDispatcher },
-  { "PPB_UDPSocket_Private_GetBoundAddress:i:Ci", PPB_UDPSocket_Private_GetBoundAddressDispatcher },
-  { "PPB_UDPSocket_Private_RecvFrom:iii:Ci", PPB_UDPSocket_Private_RecvFromDispatcher },
-  { "PPB_UDPSocket_Private_GetRecvFromAddress:i:Ci", PPB_UDPSocket_Private_GetRecvFromAddressDispatcher },
-  { "PPB_UDPSocket_Private_SendTo:iCiCi:i", PPB_UDPSocket_Private_SendToDispatcher },
-  { "PPB_UDPSocket_Private_Close:i:", PPB_UDPSocket_Private_CloseDispatcher },
-  { "PPB_URLLoader_Create:i:i", PPB_URLLoader_CreateDispatcher },
-  { "PPB_URLLoader_IsURLLoader:i:i", PPB_URLLoader_IsURLLoaderDispatcher },
-  { "PPB_URLLoader_Open:iii:i", PPB_URLLoader_OpenDispatcher },
-  { "PPB_URLLoader_FollowRedirect:ii:i", PPB_URLLoader_FollowRedirectDispatcher },
-  { "PPB_URLLoader_GetUploadProgress:i:lli", PPB_URLLoader_GetUploadProgressDispatcher },
-  { "PPB_URLLoader_GetDownloadProgress:i:lli", PPB_URLLoader_GetDownloadProgressDispatcher },
-  { "PPB_URLLoader_GetResponseInfo:i:i", PPB_URLLoader_GetResponseInfoDispatcher },
-  { "PPB_URLLoader_ReadResponseBody:iii:Ci", PPB_URLLoader_ReadResponseBodyDispatcher },
-  { "PPB_URLLoader_FinishStreamingToFile:ii:i", PPB_URLLoader_FinishStreamingToFileDispatcher },
-  { "PPB_URLLoader_Close:i:", PPB_URLLoader_CloseDispatcher },
-  { "PPB_URLRequestInfo_Create:i:i", PPB_URLRequestInfo_CreateDispatcher },
-  { "PPB_URLRequestInfo_IsURLRequestInfo:i:i", PPB_URLRequestInfo_IsURLRequestInfoDispatcher },
-  { "PPB_URLRequestInfo_SetProperty:iiC:i", PPB_URLRequestInfo_SetPropertyDispatcher },
-  { "PPB_URLRequestInfo_AppendDataToBody:iC:i", PPB_URLRequestInfo_AppendDataToBodyDispatcher },
-  { "PPB_URLRequestInfo_AppendFileToBody:iilld:i", PPB_URLRequestInfo_AppendFileToBodyDispatcher },
-  { "PPB_URLResponseInfo_IsURLResponseInfo:i:i", PPB_URLResponseInfo_IsURLResponseInfoDispatcher },
-  { "PPB_URLResponseInfo_GetProperty:ii:C", PPB_URLResponseInfo_GetPropertyDispatcher },
-  { "PPB_URLResponseInfo_GetBodyAsFileRef:i:i", PPB_URLResponseInfo_GetBodyAsFileRefDispatcher },
-  { "PPB_WebSocket_Create:i:i", PPB_WebSocket_CreateDispatcher },
-  { "PPB_WebSocket_IsWebSocket:i:i", PPB_WebSocket_IsWebSocketDispatcher },
-  { "PPB_WebSocket_Connect:iCCii:i", PPB_WebSocket_ConnectDispatcher },
-  { "PPB_WebSocket_Close:iiCi:i", PPB_WebSocket_CloseDispatcher },
-  { "PPB_WebSocket_ReceiveMessage:ii:iC", PPB_WebSocket_ReceiveMessageDispatcher },
-  { "PPB_WebSocket_SendMessage:iC:i", PPB_WebSocket_SendMessageDispatcher },
-  { "PPB_WebSocket_GetBufferedAmount:i:l", PPB_WebSocket_GetBufferedAmountDispatcher },
-  { "PPB_WebSocket_GetCloseCode:i:i", PPB_WebSocket_GetCloseCodeDispatcher },
-  { "PPB_WebSocket_GetCloseReason:i:C", PPB_WebSocket_GetCloseReasonDispatcher },
-  { "PPB_WebSocket_GetCloseWasClean:i:i", PPB_WebSocket_GetCloseWasCleanDispatcher },
-  { "PPB_WebSocket_GetExtensions:i:C", PPB_WebSocket_GetExtensionsDispatcher },
-  { "PPB_WebSocket_GetProtocol:i:C", PPB_WebSocket_GetProtocolDispatcher },
-  { "PPB_WebSocket_GetReadyState:i:i", PPB_WebSocket_GetReadyStateDispatcher },
-  { "PPB_WebSocket_GetURL:i:C", PPB_WebSocket_GetURLDispatcher },
-  { "PPB_Zoom_ZoomChanged:id:", PPB_Zoom_ZoomChangedDispatcher },
-  { "PPB_Zoom_ZoomLimitsChanged:idd:", PPB_Zoom_ZoomLimitsChangedDispatcher },
-  { NULL, NULL }
-};
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_tcp_server_socket_private.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_tcp_server_socket_private.srpc
deleted file mode 100644
index 63a9ce1..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_tcp_server_socket_private.srpc
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright (c) 2012 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# RPC methods used to implement PPB_TCPSocket_Private calls from the
-# plugin.  See ppapi/c/private/ppb_tcp_server_socket_private.h for
-# interface details.
-
-{
-  'name': 'PpbTCPServerSocketPrivateRpc',
-  'rpcs': [
-    {'name': 'PPB_TCPServerSocket_Private_Create',
-     'inputs': [['instance', 'PP_Instance'],
-               ],
-     'outputs': [['resource', 'PP_Resource'],
-                ]
-    },
-    {'name': 'PPB_TCPServerSocket_Private_IsTCPServerSocket',
-     'inputs': [['resource', 'PP_Resource'],
-               ],
-     'outputs': [['is_tcp_server_socket', 'int32_t'],   # PP_Bool
-                ]
-    },
-    {'name': 'PPB_TCPServerSocket_Private_Listen',
-     'inputs': [['tcp_server_socket', 'PP_Resource'],
-                ['addr', 'char[]'],                     # PP_NetAddress_Private*
-                ['backlog', 'int32_t'],
-		['callback_id', 'int32_t'],             # PP_CompletionCallback
-               ],
-     'outputs': [['pp_error', 'int32_t'],
-                ]
-    },
-    {'name': 'PPB_TCPServerSocket_Private_Accept',
-     'inputs': [['tcp_server_socket', 'PP_Resource'],
-                ['callback_id', 'int32_t'],             # PP_CompletionCallback
-               ],
-     'outputs': [['tcp_socket', 'PP_Resource'],
-                 ['pp_error', 'int32_t'],
-                ]
-    },
-    {'name': 'PPB_TCPServerSocket_Private_StopListening',
-     'inputs':  [['tcp_server_socket', 'PP_Resource'],
-                ],
-     'outputs': []
-    },
-  ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_tcp_socket_private.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_tcp_socket_private.srpc
deleted file mode 100644
index f8f805a..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_tcp_socket_private.srpc
+++ /dev/null
@@ -1,87 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# RPC methods used to implement PPB_TCPSocket_Private calls from the plugin.
-# See ppapi/c/private/ppb_tcp_socket_private.h for interface details.
-
-{
-  'name': 'PpbTCPSocketPrivateRpc',
-  'rpcs': [
-    {'name': 'PPB_TCPSocket_Private_Create',
-     'inputs': [['instance', 'PP_Instance'],         # PP_Instance
-               ],
-     'outputs': [['resource', 'PP_Resource'],        # PP_Resource
-                ]
-    },
-    {'name': 'PPB_TCPSocket_Private_IsTCPSocket',
-     'inputs': [['resource', 'PP_Resource'],         # PP_Resource
-               ],
-     'outputs': [['is_tcp_socket', 'int32_t'],       # PP_Bool
-                ]
-    },
-    {'name': 'PPB_TCPSocket_Private_Connect',
-     'inputs': [['tcp_socket', 'PP_Resource'],       # PP_Resource
-                ['host', 'string'],                  # const char*
-                ['port', 'int32_t'],                 # uint16_t
-                ['callback_id', 'int32_t'],          # PP_CompletionCallback
-                ],
-     'outputs': [['pp_error', 'int32_t'],
-                 ]
-    },
-    {'name': 'PPB_TCPSocket_Private_ConnectWithNetAddress',
-     'inputs': [['tcp_socket', 'PP_Resource'],       # PP_Resource
-                ['addr', 'char[]'],                  # PP_NetAddress_Private*
-                ['callback_id', 'int32_t'],          # PP_CompletionCallback
-                ],
-     'outputs': [['pp_error', 'int32_t'],
-                 ]
-    },
-    {'name': 'PPB_TCPSocket_Private_GetLocalAddress',
-     'inputs': [['tcp_socket', 'PP_Resource'],       # PP_Resource
-                ],
-     'outputs': [['local_addr', 'char[]'],           # PP_NetAddress_Private*
-                 ['success', 'int32_t'],             # PP_Bool
-                 ]
-    },
-    {'name': 'PPB_TCPSocket_Private_GetRemoteAddress',
-     'inputs': [['tcp_socket', 'PP_Resource'],       # PP_Resource
-                ],
-     'outputs': [['remote_addr', 'char[]'],          # PP_NetAddress_Private*
-                 ['success', 'int32_t'],             # PP_Bool
-                 ]
-    },
-    {'name': 'PPB_TCPSocket_Private_SSLHandshake',
-     'inputs': [['tcp_socket', 'PP_Resource'],       # PP_Resource
-                ['server_name', 'string'],           # const char*
-                ['server_port', 'int32_t'],          # uint16_t
-                ['callback_id', 'int32_t'],          # PP_CompletionCallback
-		],
-     'outputs': [['pp_error', 'int32_t'],
-                 ]
-    },
-    {'name': 'PPB_TCPSocket_Private_Read',
-     'inputs': [['tcp_socket', 'PP_Resource'],       # PP_Resource
-                ['bytes_to_read', 'int32_t'],
-		['callback_id', 'int32_t'],          # PP_CompletionCallback
-		],
-     'outputs': [['buffer', 'char[]'],               # char*
-                 ['pp_error_or_bytes', 'int32_t'],
-		 ]
-    },
-    {'name': 'PPB_TCPSocket_Private_Write',
-     'inputs': [['tcp_socket', 'PP_Resource'],       # PP_Resource
-                ['buffer', 'char[]'],                # const char*
-                ['bytes_to_write', 'int32_t'],
-                ['callback_id', 'int32_t'],          # PP_CompletionCallback
-		],
-     'outputs': [['pp_error_or_bytes', 'int32_t'],
-                 ]
-    },
-    {'name': 'PPB_TCPSocket_Private_Disconnect',
-     'inputs': [['tcp_socket', 'PP_Resource'],       # PP_Resource
-                ],
-     'outputs': []
-    },
-   ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_testing.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_testing.srpc
deleted file mode 100644
index 10482be..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_testing.srpc
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPB_Testing calls from the plugin.
-# See ppapi/c/dev/ppb_testing_dev.h for interface details.
-{
- 'name': 'PpbTestingRpc',
- 'rpcs': [
-          {'name': 'PPB_Testing_ReadImageData',
-           'inputs': [['device_context_2d', 'PP_Resource'],
-                      ['image', 'PP_Resource'],
-                      ['top_left', 'char[]'],       # PP_Point
-                    ],
-           'outputs': [['success', 'int32_t'],      # PP_Bool
-                      ]
-          },
-          {'name': 'PPB_Testing_RunMessageLoop',
-           'inputs': [['instance', 'PP_Instance'],
-                     ],
-           'outputs': [
-                      ]
-          },
-          {'name': 'PPB_Testing_QuitMessageLoop',
-           'inputs': [['instance', 'PP_Instance'],
-                     ],
-           'outputs': [
-                      ]
-          },
-          {'name': 'PPB_Testing_GetLiveObjectsForInstance',
-           'inputs': [['instance', 'PP_Instance'],
-                     ],
-           'outputs': [['live_object_count', 'int32_t'],  # uint32_t
-                      ]
-          },
-          {'name': 'PPB_Testing_SimulateInputEvent',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['input_event', 'PP_Resource'],
-                     ],
-           'outputs': [
-                      ]
-          },
-	  {'name': 'PPB_Testing_GetDocumentURL',
-	   'inputs': [['instance', 'PP_Instance'],
-	             ],
-           'outputs': [['components', 'char[]'],          # PP_URLComponents_Dev
-                       ['url', 'char[]'],                 # PP_Var
-		      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_udp_socket_private.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_udp_socket_private.srpc
deleted file mode 100644
index 395012c7..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_udp_socket_private.srpc
+++ /dev/null
@@ -1,78 +0,0 @@
-# Copyright (c) 2012 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# RPC methods used to implement PPB_UDPSocket_Private calls from the plugin.
-# See ppapi/c/private/ppb_udp_socket_private.h for interface details.
-
-{
-  'name': 'PpbUDPSocketPrivateRpc',
-  'rpcs': [
-    {'name': 'PPB_UDPSocket_Private_Create',
-     'inputs': [['instance_id', 'PP_Instance'],        # PP_Instance
-                ],
-     'outputs': [['resource', 'PP_Resource'],          # PP_Resource
-                 ]
-    },
-    {'name': 'PPB_UDPSocket_Private_IsUDPSocket',
-     'inputs': [['resource_id', 'PP_Resource'],        # PP_Resource
-                ],
-     'outputs': [['is_udp_socket_private', 'int32_t'], # PP_Bool
-                 ]
-    },
-    {'name': 'PPB_UDPSocket_Private_SetSocketFeature',
-     'inputs': [['udp_socket', 'PP_Resource'],         # PP_Resource
-                ['name', 'int32_t'],               # PP_UDPSocketFeature_Private
-                ['value', 'char[]'],                   # PP_Var
-                ],
-     'outputs': [['pp_error', 'int32_t'],
-                ]
-    },
-    {'name': 'PPB_UDPSocket_Private_Bind',
-     'inputs': [['udp_socket', 'PP_Resource'],         # PP_Resource
-                ['addr', 'char[]'],                    # PP_NetAddress_Private*
-                ['callback_id', 'int32_t'],            # PP_CompletionCallback
-		],
-     'outputs': [['pp_error', 'int32_t'],
-                 ]
-    },
-    {'name': 'PPB_UDPSocket_Private_GetBoundAddress',
-     'inputs': [['udp_socket', 'PP_Resource'],         # PP_Resource
-                ],
-     'outputs': [['addr', 'char[]'],                   # PP_NetAddress_Private*
-                 ['success', 'int32_t'],               # PP_Bool
-		 ]
-    },
-    {'name': 'PPB_UDPSocket_Private_RecvFrom',
-     'inputs': [['udp_socket', 'PP_Resource'],         # PP_Resource
-                ['num_bytes', 'int32_t'],
-                ['callback_id', 'int32_t'],            # PP_CompletionCallback
-                ],
-     'outputs': [['buffer', 'char[]'],                 # char*
-                 ['pp_error_or_bytes', 'int32_t'],
-                 ]
-    },
-    {'name': 'PPB_UDPSocket_Private_GetRecvFromAddress',
-     'inputs': [['udp_socket', 'PP_Resource'],         # PP_Resource
-                ],
-     'outputs': [['addr', 'char[]'],                   # PP_NetAddress_Private*
-                 ['success', 'int32_t'],               # PP_Bool
-		 ]
-    },
-    {'name': 'PPB_UDPSocket_Private_SendTo',
-     'inputs': [['udp_socket', 'PP_Resource'],         # PP_Resource
-                ['buffer', 'char[]'],                  # const char*
-                ['num_bytes', 'int32_t'],
-                ['addr', 'char[]'],                    # PP_NetAddress_Private*
-                ['callback_id', 'int32_t']             # PP_CompletionCallback
-                ],
-     'outputs': [['pp_error_or_bytes', 'int32_t'],
-                 ]
-    },
-    {'name': 'PPB_UDPSocket_Private_Close',
-     'inputs': [['udp_socket', 'PP_Resource'],         # PP_Resource
-                ],
-     'outputs': []
-    },
-   ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_url_loader.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_url_loader.srpc
deleted file mode 100644
index ff7ba35..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_url_loader.srpc
+++ /dev/null
@@ -1,83 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# RPC methods used to implement PPB_URLLoader calls from the plugin.
-# See ppapi/c/ppb_url_loader.h for interface details.
-
-{
- 'name': 'PpbURLLoaderRpc',
- 'rpcs': [
-          {'name': 'PPB_URLLoader_Create',
-           'inputs': [['instance', 'PP_Instance'],    # PP_Instance
-                     ],
-           'outputs': [['resource', 'PP_Resource'],   # PP_Resource
-                      ]
-          },
-          {'name': 'PPB_URLLoader_IsURLLoader',
-           'inputs': [['resource', 'PP_Resource'],    # PP_Resource
-                     ],
-           'outputs': [['is_url_loader', 'int32_t'],  # PP_Bool
-                      ]
-          },
-          {'name': 'PPB_URLLoader_Open',
-           'inputs': [['loader', 'PP_Resource'],      # PP_Resource
-                      ['request', 'PP_Resource'],     # PP_Resource
-                      ['callback_id', 'int32_t'],     # PP_CompletionCallback
-                     ],
-           'outputs': [['pp_error', 'int32_t'],       # int32_t
-                      ]
-          },
-          {'name': 'PPB_URLLoader_FollowRedirect',
-           'inputs': [['loader', 'PP_Resource'],      # PP_Resource
-                      ['callback_id', 'int32_t'],     # PP_CompletionCallback
-                     ],
-           'outputs': [['pp_error', 'int32_t'],       # int32_t
-                      ]
-          },
-          {'name': 'PPB_URLLoader_GetUploadProgress',
-           'inputs': [['loader', 'PP_Resource'],      # PP_Resource
-                     ],
-           'outputs': [['bytes_sent', 'int64_t'],              # int64_t*
-                       ['total_bytes_to_be_sent', 'int64_t'],  # int64_t*
-                       ['success', 'int32_t'],                 # PP_Bool
-                      ]
-          },
-          {'name': 'PPB_URLLoader_GetDownloadProgress',
-           'inputs': [['loader', 'PP_Resource'],      # PP_Resource
-                     ],
-           'outputs': [['bytes_received', 'int64_t'],              # int64_t*
-                       ['total_bytes_to_be_received', 'int64_t'],  # int64_t*
-                       ['success', 'int32_t'],                     # PP_Bool
-                      ]
-          },
-          {'name': 'PPB_URLLoader_GetResponseInfo',
-           'inputs': [['loader', 'PP_Resource'],      # PP_Resource
-                     ],
-           'outputs': [['response', 'PP_Resource'],   # PP_Resource
-                      ]
-          },
-          {'name': 'PPB_URLLoader_ReadResponseBody',
-           'inputs': [['loader', 'PP_Resource'],      # PP_Resource
-                      ['bytes_to_read', 'int32_t'],   # int32_t
-                      ['callback_id', 'int32_t'],     # PP_CompletionCallback
-                     ],
-           'outputs': [['buffer', 'char[]'],              # char*
-                       ['pp_error_or_bytes', 'int32_t'],  # int32_t
-                      ]
-          },
-          {'name': 'PPB_URLLoader_FinishStreamingToFile',
-           'inputs': [['loader', 'PP_Resource'],      # PP_Resource
-                      ['callback_id', 'int32_t'],     # PP_CompletionCallback
-                     ],
-           'outputs': [['pp_error', 'int32_t'],       # int32_t
-                      ]
-          },
-          {'name': 'PPB_URLLoader_Close',
-           'inputs': [['loader', 'PP_Resource'],      # PP_Resource
-                     ],
-           'outputs': [
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_url_request_info.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_url_request_info.srpc
deleted file mode 100644
index 91964bf..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_url_request_info.srpc
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright (c) 2010 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# RPC methods used to implement PPB_URLRequestInfo calls from the plugin.
-# See ppapi/c/ppb_url_request_info.h for interface details.
-
-{
- 'name': 'PpbURLRequestInfoRpc',
- 'rpcs': [
-          {'name': 'PPB_URLRequestInfo_Create',
-           'inputs': [['instance', 'PP_Instance'],     # PP_Instance
-                     ],
-           'outputs': [['resource', 'PP_Resource'],    # PP_Resource
-                      ]
-          },
-          {'name': 'PPB_URLRequestInfo_IsURLRequestInfo',
-           'inputs': [['resource', 'PP_Resource'],     # PP_Resource
-                     ],
-           'outputs': [['success', 'int32_t'],         # PP_Bool
-                      ]
-          },
-          {'name': 'PPB_URLRequestInfo_SetProperty',
-           'inputs': [['request', 'PP_Resource'],      # PP_Resource
-                      ['property', 'int32_t'],         # PP_URLRequestProperty
-                      ['value', 'char[]'],             # PP_Var
-                     ],
-           'outputs': [['success', 'int32_t'],         # PP_Bool
-                      ]
-          },
-          {'name': 'PPB_URLRequestInfo_AppendDataToBody',
-           'inputs': [['request', 'PP_Resource'],      # PP_Resource
-                      ['data', 'char[]'],              # char* + uint32_t
-                     ],
-           'outputs': [['success', 'int32_t'],         # PP_Bool
-                      ]
-          },
-          {'name': 'PPB_URLRequestInfo_AppendFileToBody',
-           'inputs': [['request', 'PP_Resource'],      # PP_Resource
-                      ['file_ref', 'PP_Resource'],     # PP_Resource
-                      ['start_offset', 'int64_t'],     # int64_t
-                      ['number_of_bytes', 'int64_t'],  # int64_t
-                      ['expected_last_modified_time', 'double'],  # PP_Time
-                     ],
-           'outputs': [['success', 'int32_t'],         # PP_Bool
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_url_response_info.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_url_response_info.srpc
deleted file mode 100644
index 47a9f4a..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_url_response_info.srpc
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (c) 2010 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# RPC methods used to implement PPB_URLResponseInfo calls from the plugin.
-# See ppapi/c/ppb_url_response_info.h for interface details.
-
-{
- 'name': 'PpbURLResponseInfoRpc',
- 'rpcs': [
-          {'name': 'PPB_URLResponseInfo_IsURLResponseInfo',
-           'inputs': [['resource', 'PP_Resource'],   # PP_Resource
-                     ],
-           'outputs': [['success', 'int32_t'],       # PP_Bool
-                      ]
-          },
-          {'name': 'PPB_URLResponseInfo_GetProperty',
-           'inputs': [['response', 'PP_Resource'],   # PP_Resource
-                      ['property', 'int32_t'],       # PP_URLResponseProperty
-                     ],
-           'outputs': [['value', 'char[]'],          # PP_Var
-                      ]
-          },
-          {'name': 'PPB_URLResponseInfo_GetBodyAsFileRef',
-           'inputs': [['response', 'PP_Resource'],   # PP_Resource
-                     ],
-           'outputs': [['file_ref', 'PP_Resource'],  # PP_Resource
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_websocket.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_websocket.srpc
deleted file mode 100644
index 44ed145..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_websocket.srpc
+++ /dev/null
@@ -1,106 +0,0 @@
-# Copyright (c) 2012 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# RPC methods used to implement PPB_WebSocket calls from the plugin.
-# See ppapi/c/ppb_websocket.h for interface details.
-
-{
- 'name': 'PpbWebSocketRpc',
- 'rpcs': [
-          {'name': 'PPB_WebSocket_Create',
-           'inputs': [['instance', 'PP_Instance'],     # PP_Instance
-                     ],
-           'outputs': [['resource', 'PP_Resource'],    # PP_Resource
-                      ]
-          },
-          {'name': 'PPB_WebSocket_IsWebSocket',
-           'inputs': [['instance', 'PP_Resource'],     # PP_Resource
-                     ],
-           'outputs': [['is_websocket', 'int32_t'],    # PP_Bool
-                      ]
-          },
-          {'name': 'PPB_WebSocket_Connect',
-           'inputs': [['ws', 'PP_Resource'],           # PP_Resource
-                       ['url', 'char[]'],              # PP_Var
-                       ['protocols', 'char[]'],        # PP_Var[]
-                       ['protocol_count', 'int32_t'],  # uint32_t
-                       ['callback_id', 'int32_t'],     # PP_CompletionCallback
-                     ],
-           'outputs': [['pp_error', 'int32_t'],        # int32_t
-                      ]
-          },
-          {'name': 'PPB_WebSocket_Close',
-           'inputs': [['ws', 'PP_Resource'],           # PP_Resource
-                      ['code', 'int32_t'],             # uint16_t
-                      ['reason', 'char[]'],            # PP_Var
-                      ['callback_id', 'int32_t'],      # PP_CompletionCallback
-                     ],
-           'outputs': [['pp_error', 'int32_t'],        # int32_t
-                      ]
-          },
-          {'name': 'PPB_WebSocket_ReceiveMessage',
-           'inputs': [['ws', 'PP_Resource'],           # PP_Resource
-                      ['callback_id', 'int32_t'],      # PP_CompletionCallback
-                     ],
-           'outputs': [['pp_error', 'int32_t'],        # int32_t
-                       ['sync_read_buffer', 'char[]'], # PP_Var
-                      ]
-          },
-          {'name': 'PPB_WebSocket_SendMessage',
-           'inputs': [['ws', 'PP_Resource'],           # PP_Resource
-                      ['message', 'char[]'],           # PP_Var
-                     ],
-           'outputs': [['pp_error', 'int32_t'],        # int32_t
-                      ]
-          },
-          {'name': 'PPB_WebSocket_GetBufferedAmount',
-           'inputs': [['ws', 'PP_Resource'],           # PP_Resource
-                     ],
-           'outputs': [['buffered_amount', 'int64_t'], # uint64_t
-                      ]
-          },
-          {'name': 'PPB_WebSocket_GetCloseCode',
-           'inputs': [['ws', 'PP_Resource'],           # PP_Resource
-                     ],
-           'outputs': [['close_code', 'int32_t'],      # uint16_t
-                      ]
-          },
-          {'name': 'PPB_WebSocket_GetCloseReason',
-           'inputs': [['ws', 'PP_Resource'],           # PP_Resource
-                     ],
-           'outputs': [['reason', 'char[]'],           # PP_Var
-                      ]
-          },
-          {'name': 'PPB_WebSocket_GetCloseWasClean',
-            'inputs': [['ws', 'PP_Resource'],          # PP_Resource
-                      ],
-            'outputs': [['was_clean', 'int32_t'],      # PP_Bool
-                       ]
-          },
-          {'name': 'PPB_WebSocket_GetExtensions',
-            'inputs': [['ws', 'PP_Resource'],          # PP_Resource
-                      ],
-            'outputs': [['extensions', 'char[]'],      # PP_Var
-                       ]
-          },
-          {'name': 'PPB_WebSocket_GetProtocol',
-            'inputs': [['ws', 'PP_Resource'],          # PP_Resource
-                      ],
-            'outputs': [['protocol', 'char[]'],        # PP_Var
-                       ]
-          },
-          {'name': 'PPB_WebSocket_GetReadyState',
-            'inputs': [['ws', 'PP_Resource'],          # PP_Resource
-                      ],
-            'outputs': [['ready_state', 'int32_t'],    # PP_WebSocketReadyState
-                       ]
-          },
-          {'name': 'PPB_WebSocket_GetURL',
-            'inputs': [['ws', 'PP_Resource'],          # PP_Resource
-                      ],
-            'outputs': [['url', 'char[]'],             # PP_Var
-                       ]
-          }
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_zoom.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_zoom.srpc
deleted file mode 100644
index 5e88dc1..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_zoom.srpc
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement the PPB_Zoom interface.
-# See ppapi/c/dev/ppb_zoom_dev.h for interface details.
-{
- 'name': 'PpbZoomRpc',
- 'rpcs': [
-          {'name': 'PPB_Zoom_ZoomChanged',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['factor', 'double'],
-                     ],
-           'outputs': [
-                      ]
-          },
-          {'name': 'PPB_Zoom_ZoomLimitsChanged',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['minimum_factor', 'double'],
-                      ['maximum_factor', 'double'],
-                     ],
-           'outputs': [
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppp.srpc
deleted file mode 100644
index f97b073..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppp.srpc
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (c) 2010 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# This file declares the RPC methods used to implement PPAPI calls from
-# the browser to the plugin.  It implements the interface in ppapi/c/ppp.h.
-{
- 'name': 'PppRpc',
- 'rpcs': [
-          # PPP_Initialize is called once to initialize the plugin.
-          # It is effectively a class initializer for the plugin type.
-          {'name': 'PPP_InitializeModule',
-           'inputs': [['module', 'PP_Module'],
-                      ['upcall_channel_desc', 'handle'],
-                      ['service_description', 'string'],
-                     ],
-           'outputs': [['success', 'int32_t'],
-                      ]
-          },
-          # PPP_ShutdownModule stops the plugin.
-          {'name': 'PPP_ShutdownModule',
-           'inputs': [],
-           'outputs': []
-          },
-          # PPP_GetInterface checks whether the plugin exports a specified
-          # interface name.
-          {'name': 'PPP_GetInterface',
-           'inputs': [['interface_name', 'string'],
-                     ],
-           'outputs': [['exports_interface_name', 'int32_t'],
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_audio.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_audio.srpc
deleted file mode 100644
index 71d37e5..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_audio.srpc
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (c) 2010 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# This file declares the RPC methods used to implement PPB_Audio
-# calls from the browser.  The functions are described in
-# ppapi/c/ppb_audio.h.
-{
- 'name': 'PppAudioRpc',
- 'rpcs': [
-          # Stream Created
-          {'name': 'PPP_Audio_StreamCreated',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['out_shm', 'handle'],
-                      ['out_shm_size', 'int32_t'],
-                      ['out_socket', 'handle'],
-                     ],
-           'outputs': [],
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_find.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_find.srpc
deleted file mode 100644
index 94a603e..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_find.srpc
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPP_Find calls to the plugin.
-# See ppapi/c/dev/ppp_find_dev.h for interface details.
-{
- 'name': 'PppFindRpc',
- 'rpcs': [
-          {'name': 'PPP_Find_StartFind',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['text', 'char[]'],
-                      ['case_sensitive', 'int32_t'],  # PP_Bool
-                     ],
-           'outputs': [['supports_find', 'int32_t'],  # PP_Bool
-                      ]
-          },
-          {'name': 'PPP_Find_SelectFindResult',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['forward', 'int32_t'],         # PP_Bool
-                     ],
-           'outputs': [
-                      ]
-          },
-          {'name': 'PPP_Find_StopFind',
-           'inputs': [['instance', 'PP_Instance'],
-                     ],
-           'outputs': [
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_input_event.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_input_event.srpc
deleted file mode 100644
index 0b90212..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_input_event.srpc
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement the PPP_InputEvent interface.
-# See ppapi/c/ppp_input_event.h for interface details.
-{
- 'name': 'PppInputEventRpc',
- 'rpcs': [
-          {'name': 'PPP_InputEvent_HandleInputEvent',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['resource', 'PP_Resource'],
-                      ['event_data', 'char[]'],  # InputEventData
-                      ['character_text', 'char[]'] # character text
-                     ],
-           'outputs': [['handled', 'int32_t'] # PP_Bool
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance.srpc
deleted file mode 100644
index 37ef109..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance.srpc
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPP_Instance interface.
-# See ppapi/c/ppp_instance.h for interface details.
-{
- 'name': 'PppInstanceRpc',
- 'rpcs': [
-          # Generic comment: PPAPI uses Did... apparently to indicate that the
-          # return value indicates the plugin successfully responded to the
-          # action requested.
-          # Sets the instance's parameters.
-          {'name': 'PPP_Instance_DidCreate',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                      ['argc', 'int32_t'],  # uint32_t
-                      ['argn', 'char[]'],  # char*[]
-                      ['argv', 'char[]'],  # char*[]
-                      ],
-           'outputs': [['success', 'int32_t'],  # PP_Bool
-                      ]
-          },
-          # Deletes an instance of a plugin.
-          {'name': 'PPP_Instance_DidDestroy',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                     ],
-           'outputs': []
-          },
-          # Changes the position, size, or clipping rectangle of the instance.
-          {'name': 'PPP_Instance_DidChangeView',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                      ['resource', 'PP_Resource'],  # PP_Resource
-                      ['view_data', 'char[]'],      # ViewData
-                     ],
-           'outputs': []
-          },
-          # Processes a bool indicating that the instance gained or lost focus.
-          {'name': 'PPP_Instance_DidChangeFocus',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                      ['has_focus', 'bool'],  # PP_Bool
-                      ],
-           'outputs': []
-          },
-          # Passes URL information to a full-frame instance.
-          {'name': 'PPP_Instance_HandleDocumentLoad',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                      ['url_loader', 'PP_Resource'],  # PP_Resource
-                      ],
-           'outputs': [['success', 'int32_t'],  # PP_Bool
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.cc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.cc
deleted file mode 100644
index 054c2ec..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.cc
+++ /dev/null
@@ -1,65 +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 "ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace ppapi_proxy {
-
-PPP_Instance_Combined::PPP_Instance_Combined()
-    : initialized_(false),
-      did_change_view_1_0_(NULL) {
-  memset(&instance_1_1_, 0, sizeof(instance_1_1_));
-}
-
-void PPP_Instance_Combined::Init1_0(const PPP_Instance_1_0* instance_if) {
-  initialized_ = true;
-  did_change_view_1_0_ = instance_if->DidChangeView;
-  instance_1_1_.DidCreate = instance_if->DidCreate;
-  instance_1_1_.DidDestroy = instance_if->DidDestroy;
-  instance_1_1_.DidChangeView = NULL;
-  instance_1_1_.DidChangeFocus = instance_if->DidChangeFocus;
-  instance_1_1_.HandleDocumentLoad = instance_if->HandleDocumentLoad;
-}
-
-void PPP_Instance_Combined::Init1_1(const PPP_Instance_1_1* instance_if) {
-  initialized_ = true;
-  instance_1_1_ = *instance_if;
-}
-
-PP_Bool PPP_Instance_Combined::DidCreate(PP_Instance instance,
-                                         uint32_t argc,
-                                         const char* argn[],
-                                         const char* argv[]) {
-  return instance_1_1_.DidCreate(instance, argc, argn, argv);
-}
-
-void PPP_Instance_Combined::DidDestroy(PP_Instance instance) {
-  return instance_1_1_.DidDestroy(instance);
-}
-
-void PPP_Instance_Combined::DidChangeView(PP_Instance instance,
-                                          PP_Resource view_resource,
-                                          const struct PP_Rect* position,
-                                          const struct PP_Rect* clip) {
-  if (instance_1_1_.DidChangeView)
-    instance_1_1_.DidChangeView(instance, view_resource);
-  else
-    did_change_view_1_0_(instance, position, clip);
-}
-
-void PPP_Instance_Combined::DidChangeFocus(PP_Instance instance,
-                                           PP_Bool has_focus) {
-  instance_1_1_.DidChangeFocus(instance, has_focus);
-}
-
-PP_Bool PPP_Instance_Combined::HandleDocumentLoad(PP_Instance instance,
-                                                  PP_Resource url_loader) {
-  return instance_1_1_.HandleDocumentLoad(instance, url_loader);
-}
-
-}  // namespace ppapi_proxy
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.h b/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.h
deleted file mode 100644
index d794d51..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PPAPI_NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PPP_INSTANCE_COMBINED_H_
-#define PPAPI_NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PPP_INSTANCE_COMBINED_H_
-
-#include "ppapi/c/ppp_instance.h"
-
-namespace ppapi_proxy {
-
-// This exposes the 1.1 interface and forwards it to the 1.0 interface is
-// necessary.
-struct  PPP_Instance_Combined {
- public:
-  // You must call one of the Init functions after the constructor.
-  PPP_Instance_Combined();
-
-  void Init1_0(const PPP_Instance_1_0* instance_if);
-  void Init1_1(const PPP_Instance_1_1* instance_if);
-
-  bool initialized() const { return initialized_; }
-
-  PP_Bool DidCreate(PP_Instance instance,
-                    uint32_t argc,
-                    const char* argn[],
-                    const char* argv[]);
-  void DidDestroy(PP_Instance instance);
-
-  // This version of DidChangeView encapsulates all arguments for both 1.0
-  // and 1.1 versions of this function. Conversion from 1.1 -> 1.0 is easy,
-  // but this class doesn't have the necessary context (resource interfaces)
-  // to do the conversion, so the caller must do it.
-  void DidChangeView(PP_Instance instance,
-                     PP_Resource view_resource,
-                     const struct PP_Rect* position,
-                     const struct PP_Rect* clip);
-
-  void DidChangeFocus(PP_Instance instance, PP_Bool has_focus);
-  PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader);
-
- private:
-  bool initialized_;
-
-  // For version 1.0, DidChangeView will be NULL, and DidChangeView_1_0 will
-  // be set below.
-  PPP_Instance_1_1 instance_1_1_;
-
-  // Non-NULL when Instance 1.0 is used.
-  void (*did_change_view_1_0_)(PP_Instance instance,
-                               const struct PP_Rect* position,
-                               const struct PP_Rect* clip);
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // PPAPI_NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PPP_INSTANCE_COMBINED_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_messaging.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_messaging.srpc
deleted file mode 100644
index 5ffd800..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_messaging.srpc
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2010 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPP_Messaging interface.
-# See ppapi/c/ppp_messaging.h for interface details.
-{
- 'name': 'PppMessagingRpc',
- 'rpcs': [
-          {'name': 'PPP_Messaging_HandleMessage',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                      ['message', 'char[]'],  # PP_Var
-                      ],
-           'outputs': []
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_mouse_lock.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_mouse_lock.srpc
deleted file mode 100644
index 32f2e34..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_mouse_lock.srpc
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPP_MouseLock calls to the plugin.
-# See ppapi/c/ppp_mouse_lock.h for interface details.
-{
- 'name': 'PppMouseLockRpc',
- 'rpcs': [
-          {'name': 'PPP_MouseLock_MouseLockLost',
-           'inputs': [['instance', 'PP_Instance'],  # PP_Instance
-                     ],
-           'outputs': []
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_network_monitor_private.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_network_monitor_private.srpc
deleted file mode 100644
index 6df4c38..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_network_monitor_private.srpc
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (c) 2012 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# This file declares the RPC methods called by the browser used to implement
-# PPB_NetworkMonitor_Private interface. Specifically it defines method called by
-# the browser when the network list changes.
-
-{
- 'name': 'PppNetworkMonitorPrivateRpc',
- 'rpcs': [
-          # NetworkListChanged
-          {'name': 'PPP_NetworkMonitor_Private_NetworkListChanged',
-           'inputs': [['network_monitor', 'PP_Resource'],
-                      ['network_list', 'PP_Resource'],
-                     ],
-           'outputs': [],
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_printing.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_printing.srpc
deleted file mode 100644
index 608b933..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_printing.srpc
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPP_Printing calls to the plugin.
-# See ppapi/c/dev/ppp_printing_dev.h for interface details.
-{
- 'name': 'PppPrintingRpc',
- 'rpcs': [
-          {'name': 'PPP_Printing_QuerySupportedFormats',
-           'inputs': [['instance', 'PP_Instance'],
-                     ],
-           'outputs': [['formats', 'int32_t'],   # uint32_t
-                      ]
-          },
-          {'name': 'PPP_Printing_Begin',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['print_settings', 'char[]'],   # PP_PrintSettings_Dev
-                     ],
-           'outputs': [['pages_required', 'int32_t'],
-                      ]
-          },
-          {'name': 'PPP_Printing_PrintPages',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['page_ranges', 'char[]'],      # PP_PrintPageNumberRange_Dev
-                      ['page_range_count', 'int32_t'],  # uint32_t
-                     ],
-           'outputs': [['image_data', 'PP_Resource'],
-                      ]
-          },
-          {'name': 'PPP_Printing_End',
-           'inputs': [['instance', 'PP_Instance'],
-                     ],
-           'outputs': [
-                      ]
-          },
-          {'name': 'PPP_Printing_IsScalingDisabled',
-           'inputs': [['instance', 'PP_Instance'],
-                     ],
-           'outputs': [['result', 'int32_t'],  # PP_Bool
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_client.cc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_client.cc
deleted file mode 100644
index 59f06c5..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_client.cc
+++ /dev/null
@@ -1,427 +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.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// Automatically generated code.  See srpcgen.py
-//
-// NaCl Simple Remote Procedure Call interface abstractions.
-
-#include "trusted/srpcgen/ppp_rpc.h"
-#ifdef __native_client__
-#ifndef UNREFERENCED_PARAMETER
-#define UNREFERENCED_PARAMETER(P) do { (void) P; } while (0)
-#endif  // UNREFERENCED_PARAMETER
-#else
-#include "native_client/src/include/portability.h"
-#endif  // __native_client__
-#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-
-NaClSrpcError CompletionCallbackRpcClient::RunCompletionCallback(
-    NaClSrpcChannel* channel,
-    int32_t callback_id,
-    int32_t result,
-    nacl_abi_size_t read_buffer_bytes, char* read_buffer)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "RunCompletionCallback:iiC:",
-      callback_id,
-      result,
-      read_buffer_bytes, read_buffer
-  );
-  return retval;
-}
-
-NaClSrpcError PppRpcClient::PPP_InitializeModule(
-    NaClSrpcChannel* channel,
-    PP_Module module,
-    NaClSrpcImcDescType upcall_channel_desc,
-    const char* service_description,
-    int32_t* success)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_InitializeModule:ihs:i",
-      module,
-      upcall_channel_desc,
-      service_description,
-      success
-  );
-  return retval;
-}
-
-NaClSrpcError PppRpcClient::PPP_ShutdownModule(
-    NaClSrpcChannel* channel)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_ShutdownModule::"
-  );
-  return retval;
-}
-
-NaClSrpcError PppRpcClient::PPP_GetInterface(
-    NaClSrpcChannel* channel,
-    const char* interface_name,
-    int32_t* exports_interface_name)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_GetInterface:s:i",
-      interface_name,
-      exports_interface_name
-  );
-  return retval;
-}
-
-NaClSrpcError PppAudioRpcClient::PPP_Audio_StreamCreated(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    NaClSrpcImcDescType out_shm,
-    int32_t out_shm_size,
-    NaClSrpcImcDescType out_socket)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Audio_StreamCreated:ihih:",
-      instance,
-      out_shm,
-      out_shm_size,
-      out_socket
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppFindRpcClient::PPP_Find_StartFind(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    nacl_abi_size_t text_bytes, char* text,
-    int32_t case_sensitive,
-    int32_t* supports_find)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Find_StartFind:iCi:i",
-      instance,
-      text_bytes, text,
-      case_sensitive,
-      supports_find
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppFindRpcClient::PPP_Find_SelectFindResult(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t forward)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Find_SelectFindResult:ii:",
-      instance,
-      forward
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppFindRpcClient::PPP_Find_StopFind(
-    NaClSrpcChannel* channel,
-    PP_Instance instance)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Find_StopFind:i:",
-      instance
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppInputEventRpcClient::PPP_InputEvent_HandleInputEvent(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource resource,
-    nacl_abi_size_t event_data_bytes, char* event_data,
-    nacl_abi_size_t character_text_bytes, char* character_text,
-    int32_t* handled)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_InputEvent_HandleInputEvent:iiCC:i",
-      instance,
-      resource,
-      event_data_bytes, event_data,
-      character_text_bytes, character_text,
-      handled
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppInstanceRpcClient::PPP_Instance_DidCreate(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t argc,
-    nacl_abi_size_t argn_bytes, char* argn,
-    nacl_abi_size_t argv_bytes, char* argv,
-    int32_t* success)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Instance_DidCreate:iiCC:i",
-      instance,
-      argc,
-      argn_bytes, argn,
-      argv_bytes, argv,
-      success
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppInstanceRpcClient::PPP_Instance_DidDestroy(
-    NaClSrpcChannel* channel,
-    PP_Instance instance)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Instance_DidDestroy:i:",
-      instance
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppInstanceRpcClient::PPP_Instance_DidChangeView(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource resource,
-    nacl_abi_size_t view_data_bytes, char* view_data)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Instance_DidChangeView:iiC:",
-      instance,
-      resource,
-      view_data_bytes, view_data
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppInstanceRpcClient::PPP_Instance_DidChangeFocus(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    bool has_focus)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Instance_DidChangeFocus:ib:",
-      instance,
-      has_focus
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppInstanceRpcClient::PPP_Instance_HandleDocumentLoad(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    PP_Resource url_loader,
-    int32_t* success)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Instance_HandleDocumentLoad:ii:i",
-      instance,
-      url_loader,
-      success
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppMessagingRpcClient::PPP_Messaging_HandleMessage(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    nacl_abi_size_t message_bytes, char* message)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Messaging_HandleMessage:iC:",
-      instance,
-      message_bytes, message
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppMouseLockRpcClient::PPP_MouseLock_MouseLockLost(
-    NaClSrpcChannel* channel,
-    PP_Instance instance)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_MouseLock_MouseLockLost:i:",
-      instance
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppNetworkMonitorPrivateRpcClient::PPP_NetworkMonitor_Private_NetworkListChanged(
-    NaClSrpcChannel* channel,
-    PP_Resource network_monitor,
-    PP_Resource network_list)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_NetworkMonitor_Private_NetworkListChanged:ii:",
-      network_monitor,
-      network_list
-  );
-  return retval;
-}
-
-NaClSrpcError PppPrintingRpcClient::PPP_Printing_QuerySupportedFormats(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t* formats)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Printing_QuerySupportedFormats:i:i",
-      instance,
-      formats
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppPrintingRpcClient::PPP_Printing_Begin(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    nacl_abi_size_t print_settings_bytes, char* print_settings,
-    int32_t* pages_required)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Printing_Begin:iC:i",
-      instance,
-      print_settings_bytes, print_settings,
-      pages_required
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppPrintingRpcClient::PPP_Printing_PrintPages(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    nacl_abi_size_t page_ranges_bytes, char* page_ranges,
-    int32_t page_range_count,
-    PP_Resource* image_data)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Printing_PrintPages:iCi:i",
-      instance,
-      page_ranges_bytes, page_ranges,
-      page_range_count,
-      image_data
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppPrintingRpcClient::PPP_Printing_End(
-    NaClSrpcChannel* channel,
-    PP_Instance instance)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Printing_End:i:",
-      instance
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppPrintingRpcClient::PPP_Printing_IsScalingDisabled(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t* result)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Printing_IsScalingDisabled:i:i",
-      instance,
-      result
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppSelectionRpcClient::PPP_Selection_GetSelectedText(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    int32_t html,
-    nacl_abi_size_t* selected_text_bytes, char* selected_text)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Selection_GetSelectedText:ii:C",
-      instance,
-      html,
-      selected_text_bytes, selected_text
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-NaClSrpcError PppZoomRpcClient::PPP_Zoom_Zoom(
-    NaClSrpcChannel* channel,
-    PP_Instance instance,
-    double factor,
-    int32_t text_only)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPP_Zoom_Zoom:idi:",
-      instance,
-      factor,
-      text_only
-  );
-  if (retval == NACL_SRPC_RESULT_INTERNAL)
-    ppapi_proxy::CleanUpAfterDeadNexe(instance);
-  return retval;
-}
-
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_server.cc
deleted file mode 100644
index 6ec3f40..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_server.cc
+++ /dev/null
@@ -1,419 +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.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// Automatically generated code.  See srpcgen.py
-//
-// NaCl Simple Remote Procedure Call interface abstractions.
-
-#include "untrusted/srpcgen/ppp_rpc.h"
-#ifdef __native_client__
-#ifndef UNREFERENCED_PARAMETER
-#define UNREFERENCED_PARAMETER(P) do { (void) P; } while (0)
-#endif  // UNREFERENCED_PARAMETER
-#else
-#include "native_client/src/include/portability.h"
-#endif  // __native_client__
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-
-namespace {
-
-static void RunCompletionCallbackDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  CompletionCallbackRpcServer::RunCompletionCallback(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.count, inputs[2]->arrays.carr
-  );
-}
-
-static void PPP_InitializeModuleDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PppRpcServer::PPP_InitializeModule(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.hval,
-      inputs[2]->arrays.str,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPP_ShutdownModuleDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(inputs);
-  UNREFERENCED_PARAMETER(outputs);
-  PppRpcServer::PPP_ShutdownModule(
-      rpc,
-      done
-  );
-}
-
-static void PPP_GetInterfaceDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PppRpcServer::PPP_GetInterface(
-      rpc,
-      done,
-      inputs[0]->arrays.str,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPP_Audio_StreamCreatedDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PppAudioRpcServer::PPP_Audio_StreamCreated(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.hval,
-      inputs[2]->u.ival,
-      inputs[3]->u.hval
-  );
-}
-
-static void PPP_Find_StartFindDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PppFindRpcServer::PPP_Find_StartFind(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPP_Find_SelectFindResultDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PppFindRpcServer::PPP_Find_SelectFindResult(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival
-  );
-}
-
-static void PPP_Find_StopFindDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PppFindRpcServer::PPP_Find_StopFind(
-      rpc,
-      done,
-      inputs[0]->u.ival
-  );
-}
-
-static void PPP_InputEvent_HandleInputEventDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PppInputEventRpcServer::PPP_InputEvent_HandleInputEvent(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.count, inputs[2]->arrays.carr,
-      inputs[3]->u.count, inputs[3]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPP_Instance_DidCreateDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PppInstanceRpcServer::PPP_Instance_DidCreate(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.count, inputs[2]->arrays.carr,
-      inputs[3]->u.count, inputs[3]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPP_Instance_DidDestroyDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PppInstanceRpcServer::PPP_Instance_DidDestroy(
-      rpc,
-      done,
-      inputs[0]->u.ival
-  );
-}
-
-static void PPP_Instance_DidChangeViewDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PppInstanceRpcServer::PPP_Instance_DidChangeView(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.count, inputs[2]->arrays.carr
-  );
-}
-
-static void PPP_Instance_DidChangeFocusDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PppInstanceRpcServer::PPP_Instance_DidChangeFocus(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.bval
-  );
-}
-
-static void PPP_Instance_HandleDocumentLoadDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PppInstanceRpcServer::PPP_Instance_HandleDocumentLoad(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPP_Messaging_HandleMessageDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PppMessagingRpcServer::PPP_Messaging_HandleMessage(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr
-  );
-}
-
-static void PPP_MouseLock_MouseLockLostDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PppMouseLockRpcServer::PPP_MouseLock_MouseLockLost(
-      rpc,
-      done,
-      inputs[0]->u.ival
-  );
-}
-
-static void PPP_NetworkMonitor_Private_NetworkListChangedDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PppNetworkMonitorPrivateRpcServer::PPP_NetworkMonitor_Private_NetworkListChanged(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival
-  );
-}
-
-static void PPP_Printing_QuerySupportedFormatsDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PppPrintingRpcServer::PPP_Printing_QuerySupportedFormats(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPP_Printing_BeginDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PppPrintingRpcServer::PPP_Printing_Begin(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPP_Printing_PrintPagesDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PppPrintingRpcServer::PPP_Printing_PrintPages(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.count, inputs[1]->arrays.carr,
-      inputs[2]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPP_Printing_EndDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PppPrintingRpcServer::PPP_Printing_End(
-      rpc,
-      done,
-      inputs[0]->u.ival
-  );
-}
-
-static void PPP_Printing_IsScalingDisabledDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PppPrintingRpcServer::PPP_Printing_IsScalingDisabled(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      &(outputs[0]->u.ival)
-  );
-}
-
-static void PPP_Selection_GetSelectedTextDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  PppSelectionRpcServer::PPP_Selection_GetSelectedText(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      &(outputs[0]->u.count), outputs[0]->arrays.carr
-  );
-}
-
-static void PPP_Zoom_ZoomDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PppZoomRpcServer::PPP_Zoom_Zoom(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.dval,
-      inputs[2]->u.ival
-  );
-}
-
-}  // namespace
-
-NaClSrpcHandlerDesc PppRpcs::srpc_methods[] = {
-  { "RunCompletionCallback:iiC:", RunCompletionCallbackDispatcher },
-  { "PPP_InitializeModule:ihs:i", PPP_InitializeModuleDispatcher },
-  { "PPP_ShutdownModule::", PPP_ShutdownModuleDispatcher },
-  { "PPP_GetInterface:s:i", PPP_GetInterfaceDispatcher },
-  { "PPP_Audio_StreamCreated:ihih:", PPP_Audio_StreamCreatedDispatcher },
-  { "PPP_Find_StartFind:iCi:i", PPP_Find_StartFindDispatcher },
-  { "PPP_Find_SelectFindResult:ii:", PPP_Find_SelectFindResultDispatcher },
-  { "PPP_Find_StopFind:i:", PPP_Find_StopFindDispatcher },
-  { "PPP_InputEvent_HandleInputEvent:iiCC:i", PPP_InputEvent_HandleInputEventDispatcher },
-  { "PPP_Instance_DidCreate:iiCC:i", PPP_Instance_DidCreateDispatcher },
-  { "PPP_Instance_DidDestroy:i:", PPP_Instance_DidDestroyDispatcher },
-  { "PPP_Instance_DidChangeView:iiC:", PPP_Instance_DidChangeViewDispatcher },
-  { "PPP_Instance_DidChangeFocus:ib:", PPP_Instance_DidChangeFocusDispatcher },
-  { "PPP_Instance_HandleDocumentLoad:ii:i", PPP_Instance_HandleDocumentLoadDispatcher },
-  { "PPP_Messaging_HandleMessage:iC:", PPP_Messaging_HandleMessageDispatcher },
-  { "PPP_MouseLock_MouseLockLost:i:", PPP_MouseLock_MouseLockLostDispatcher },
-  { "PPP_NetworkMonitor_Private_NetworkListChanged:ii:", PPP_NetworkMonitor_Private_NetworkListChangedDispatcher },
-  { "PPP_Printing_QuerySupportedFormats:i:i", PPP_Printing_QuerySupportedFormatsDispatcher },
-  { "PPP_Printing_Begin:iC:i", PPP_Printing_BeginDispatcher },
-  { "PPP_Printing_PrintPages:iCi:i", PPP_Printing_PrintPagesDispatcher },
-  { "PPP_Printing_End:i:", PPP_Printing_EndDispatcher },
-  { "PPP_Printing_IsScalingDisabled:i:i", PPP_Printing_IsScalingDisabledDispatcher },
-  { "PPP_Selection_GetSelectedText:ii:C", PPP_Selection_GetSelectedTextDispatcher },
-  { "PPP_Zoom_Zoom:idi:", PPP_Zoom_ZoomDispatcher },
-  { NULL, NULL }
-};
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_selection.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_selection.srpc
deleted file mode 100644
index 75d52fb..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_selection.srpc
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPP_Selection calls to the plugin.
-# See ppapi/c/dev/ppp_selection_dev.h for interface details.
-{
- 'name': 'PppSelectionRpc',
- 'rpcs': [
-          {'name': 'PPP_Selection_GetSelectedText',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['html', 'int32_t'],              # PP_Bool
-                     ],
-           'outputs': [['selected_text', 'char[]'],     # PP_Var
-                      ],
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_zoom.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_zoom.srpc
deleted file mode 100644
index f9d01c3..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_zoom.srpc
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods used to implement PPP_Zoom calls to the plugin.
-# See ppapi/c/dev/ppp_zoom_dev.h for interface details.
-{
- 'name': 'PppZoomRpc',
- 'rpcs': [
-          {'name': 'PPP_Zoom_Zoom',
-           'inputs': [['instance', 'PP_Instance'],
-                      ['factor', 'double'],
-                      ['text_only', 'int32_t'],      # PP_Bool
-                     ],
-           'outputs': [
-                      ]
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h b/ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h
index d761a00..487a470 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h
+++ b/ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h
@@ -15,10 +15,10 @@
 // Initialize srpc connection to the browser. Some APIs like manifest file
 // opening do not need full ppapi initialization and so can be used after
 // this function returns.
-int IrtInit();
+int IrtInit(void);
 
 // The entry point for the main thread of the PPAPI plugin process.
-int PpapiPluginMain();
+int PpapiPluginMain(void);
 
 void PpapiPluginRegisterThreadCreator(
     const struct PP_ThreadFunctions* new_funcs);
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/proxy_var.cc b/ppapi/native_client/src/shared/ppapi_proxy/proxy_var.cc
deleted file mode 100644
index c1c49cc..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/proxy_var.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "native_client/src/shared/ppapi_proxy/proxy_var.h"
-
-#include "native_client/src/shared/platform/nacl_sync_checked.h"
-#include "native_client/src/untrusted/pthread/pthread.h"
-
-#include <limits>
-
-namespace ppapi_proxy {
-
-namespace {
-
-pthread_mutex_t mu = PTHREAD_MUTEX_INITIALIZER;
-
-}  // namespace
-
-int64_t ProxyVar::unique_var_id = 0;
-
-ProxyVar::ProxyVar(PP_VarType pp_var_type) : pp_var_type_(pp_var_type) {
-  // Roll id of INT64_MAX to 1, because an id of 0 is not valid.
-  nacl::ScopedPthreadMutexLock ml(&mu);
-  if (unique_var_id > std::numeric_limits<int64_t>::max() - 1)
-    unique_var_id = 0;
-  id_ = ++unique_var_id;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/proxy_var.h b/ppapi/native_client/src/shared/ppapi_proxy/proxy_var.h
deleted file mode 100644
index 28c2ae5..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/proxy_var.h
+++ /dev/null
@@ -1,57 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PROXY_VAR_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PROXY_VAR_H_
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/include/nacl_memory.h"
-#include "native_client/src/include/ref_counted.h"
-#include "ppapi/c/pp_var.h"
-
-namespace ppapi_proxy {
-
-// Complex PP_Var types (such as strings) have a copy of the variant's contents
-// cached by the proxy.  This is done so that PP_Vars can be reference counted,
-// and their contents accessed "locally" by NaCl modules without having to
-// perform a complete round trip to the browser for each such operation.
-//
-// Note: this class is intended to be sub-classed to handle specific content
-// types such as strings, dictionaries, or arrays.
-class ProxyVar : public nacl::RefCountedThreadSafe<ProxyVar> {
- public:
-  // The type of this cached object.  Simple types (int, bool, etc.) are not
-  // cached.
-  PP_VarType pp_var_type() const { return pp_var_type_; }
-
-  // The assigned unique id associated with this object.  Use this as the id
-  // for the corresponding PP_Var.
-  int64_t id() const { return id_; }
-
- protected:
-  // Initialize this instance to represent a PP_Var of type |pp_var_type|.
-  // Generates a unique id for this instance, and sets the reference count to 1.
-  // Subclasses should implement ctors that handle specific content data.
-  explicit ProxyVar(PP_VarType pp_var_type);
-
-  virtual ~ProxyVar() {}
-
- private:
-  friend class nacl::RefCountedThreadSafe<ProxyVar>;
-
-  PP_VarType pp_var_type_;
-  int64_t id_;
-
-  // A counter for unique ids.
-  static int64_t unique_var_id;
-
-  ProxyVar();  // Not implemented - do not use.
-  NACL_DISALLOW_COPY_AND_ASSIGN(ProxyVar);
-};
-
-typedef scoped_refptr<ProxyVar> SharedProxyVar;
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PROXY_VAR_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/proxy_var_cache.cc b/ppapi/native_client/src/shared/ppapi_proxy/proxy_var_cache.cc
deleted file mode 100644
index b172869..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/proxy_var_cache.cc
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "native_client/src/shared/ppapi_proxy/proxy_var_cache.h"
-
-#include <limits>
-#include <map>
-
-#include "native_client/src/include/ref_counted.h"
-#include "native_client/src/untrusted/pthread/pthread.h"
-
-namespace ppapi_proxy {
-
-namespace {
-
-pthread_mutex_t mu = PTHREAD_MUTEX_INITIALIZER;
-
-// Convert the given SharedProxyVar to a PP_Var, incrementing the reference
-// count by 1.
-PP_Var GetPPVar(const SharedProxyVar& proxy_var) {
-  PP_Var var;
-  var.type = proxy_var->pp_var_type();
-  var.padding = 0;
-  var.value.as_id = proxy_var->id();
-  proxy_var->AddRef();
-  return var;
-}
-
-}  // namespace
-
-ProxyVarCache* ProxyVarCache::cache_singleton = NULL;
-
-ProxyVarCache& ProxyVarCache::GetInstance() {
-  // When the deprecated scripting is removed, this crash should disappear.
-  // static ProxyVarCache cache_singleton;
-  // return cache_singleton;
-  pthread_mutex_lock(&mu);
-  if (cache_singleton == NULL)
-    cache_singleton = new ProxyVarCache();
-  pthread_mutex_unlock(&mu);
-  return *cache_singleton;
-}
-
-void ProxyVarCache::RetainSharedProxyVar(const SharedProxyVar& proxy_var) {
-  pthread_mutex_lock(&mu);
-  // This implements "insert if absent, retain if present".
-  std::pair<ProxyVarDictionary::iterator, bool> insert_result =
-      proxy_var_cache_.insert(
-          std::pair<int64_t, SharedProxyVar>(proxy_var->id(), proxy_var));
-  if (!insert_result.second) {
-    // Object already exists, bump the retain count.
-    insert_result.first->second->AddRef();
-  }
-  pthread_mutex_unlock(&mu);
-}
-
-void ProxyVarCache::RetainProxyVar(const PP_Var& var) {
-  if (!IsCachedType(var))
-    return;
-  pthread_mutex_lock(&mu);
-  ProxyVarDictionary::iterator iter = proxy_var_cache_.find(var.value.as_id);
-  if (iter != proxy_var_cache_.end()) {
-    iter->second->AddRef();
-  }
-  pthread_mutex_unlock(&mu);
-}
-
-void ProxyVarCache::ReleaseProxyVar(const PP_Var& var) {
-  if (!IsCachedType(var))
-    return;
-  pthread_mutex_lock(&mu);
-  ProxyVarDictionary::iterator iter = proxy_var_cache_.find(var.value.as_id);
-  if (iter != proxy_var_cache_.end()) {
-    // Decrement the reference count by one, as requested.
-    iter->second->Release();
-    // All var reference count updating happens while mu is held, so the
-    // potential race between HasOneRef and AddRef/Release cannot materialize.
-    if (iter->second->HasOneRef()) {
-      // If there is only one reference, it must be from the dictionary.
-      // Delete the dictionary entry.
-      proxy_var_cache_.erase(iter);
-    }
-  }
-  pthread_mutex_unlock(&mu);
-}
-
-SharedProxyVar ProxyVarCache::SharedProxyVarForVar(PP_Var pp_var) const {
-  SharedProxyVar proxy_var;
-  pthread_mutex_lock(&mu);
-  ProxyVarDictionary::const_iterator iter =
-      proxy_var_cache_.find(pp_var.value.as_id);
-  if (iter != proxy_var_cache_.end()) {
-    proxy_var = iter->second;
-  }
-  pthread_mutex_unlock(&mu);
-  return proxy_var;
-}
-
-std::vector<PP_Var> ProxyVarCache::GetLiveVars() {
-  std::vector<PP_Var> live_vars;
-  pthread_mutex_lock(&mu);
-  for (ProxyVarDictionary::const_iterator iter(proxy_var_cache_.begin());
-       iter != proxy_var_cache_.end();
-       ++iter)
-    live_vars.push_back(GetPPVar(iter->second));
-  pthread_mutex_unlock(&mu);
-  return live_vars;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/proxy_var_cache.h b/ppapi/native_client/src/shared/ppapi_proxy/proxy_var_cache.h
deleted file mode 100644
index 2058f2a..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/proxy_var_cache.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PROXY_VAR_CACHE_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PROXY_VAR_CACHE_H_
-
-#include <map>
-#include <vector>
-
-#include "native_client/src/include/nacl_memory.h"
-#include "native_client/src/shared/ppapi_proxy/proxy_var.h"
-#include "ppapi/c/pp_var.h"
-
-namespace ppapi_proxy {
-
-// This class manages the proxy-local cache of ProxyVars. The base factory
-// method generates a unique id that gets used as the PP_Var's id, this id is
-// associated with the variant's content.  The factory also inserts the new
-// instance into the proxy-local cache.
-// Note: There is one proxy var cache per NaCl module instance.
-class ProxyVarCache {
- public:
-  // Return the global proxy var cache.  Always returns a valid (possibly
-  // empty) cache.
-  static ProxyVarCache& GetInstance();
-
-  // If |proxy_var| already exists in the cache, then increment its reference
-  // count.  Otherwise, add it to the cache.  This method does not check the
-  // validity of |proxy_var|, assuming that it's not possible to make a
-  // SharedProxyVar unless you use one of the cacheable subclasses.
-  // TODO(dspringer): Should the contents of the proxy_var in the cache be
-  // replaced with |proxy_var|?  Should there be some kind of assert if an
-  // object with the same id exists in the cache but the contents are different?
-  void RetainSharedProxyVar(const SharedProxyVar& proxy_var);
-
-  // Find the proxy var associated with |id| and increment its ref count.  Does
-  // nothing if no such object exists.  This only operates on vars that are
-  // cached (that is, IsCachedType() returns |true|).  Any other var type is
-  // not cached, and this function does nothing.
-  void RetainProxyVar(const PP_Var& var);
-
-  // Release the cached object associated with |id|.  If the reference count
-  // of the object falls to 0, it gets removed from the cache.  This only
-  // operates on vars that are cached (that is, IsCachedType() returns |true|).
-  // Any other var type is ignored, and this function does nothing.
-  void ReleaseProxyVar(const PP_Var& var);
-
-  // Find the object in the cache associated with |pp_var|.
-  SharedProxyVar SharedProxyVarForVar(PP_Var pp_var) const;
-
-  // Return all live Vars in the tracker. Reference counts are incremented.
-  std::vector<PP_Var> GetLiveVars();
-
- private:
-  // Return whether or not a var type is cached.
-  bool IsCachedType(const PP_Var& var) {
-    return var.type >= PP_VARTYPE_STRING;
-  }
-
-  // The cache of these objects.  The value is a shared pointer so that
-  // instances of subclasses can be inserted.
-  typedef std::map<int64_t, SharedProxyVar> ProxyVarDictionary;
-  ProxyVarDictionary proxy_var_cache_;
-
-  static ProxyVarCache* cache_singleton;
-
-  ProxyVarCache() {}
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PROXY_VAR_CACHE_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/run_srpcgen.py b/ppapi/native_client/src/shared/ppapi_proxy/run_srpcgen.py
deleted file mode 100755
index b6ae923..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/run_srpcgen.py
+++ /dev/null
@@ -1,209 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-"""Driver of srpcgen for ppapi_proxy sources.
-
-This must be run after modifying, adding, or removing .srpc files.
-The lists of .srpc files are in this source file.
-"""
-
-import filecmp
-import optparse
-import os
-import shutil
-import subprocess
-import sys
-import tempfile
-
-# This lists all the units (one header file, one source file) to generate.
-# There is a trusted pair of files and an untrusted pair of files for each.
-# Each element has these keys:
-#       trusted_is_client       True if the trusted side is the client
-#                               and the untrusted side is the server;
-#                               False if the untrusted side is the client
-#                               and the trusted side is the server.
-#       name                    Prefix of the main class name, suffixed
-#                               by Server or Client.
-#       file_basename           Prefix of the output file names, suffixed
-#                               by .h, _server.cc, _client.cc.
-#       srpc_files              List of .srpc input file names.
-#       client_thread_check     (optional) True if the client side should
-#                               be generated with --thread-check.
-#                               This asserts that calls are on the main thread.
-all_units = [
-    {'trusted_is_client': True,
-     'name': 'PppRpcs',
-     'file_basename': 'ppp_rpc',
-     'srpc_files': [
-         'completion_callback.srpc',
-         'ppp.srpc',
-         'ppp_audio.srpc',
-         'ppp_find.srpc',
-         'ppp_input_event.srpc',
-         'ppp_instance.srpc',
-         'ppp_messaging.srpc',
-         'ppp_mouse_lock.srpc',
-         'ppp_network_monitor_private.srpc',
-         'ppp_printing.srpc',
-         'ppp_selection.srpc',
-         'ppp_zoom.srpc',
-         ]},
-    {'trusted_is_client': False,
-     'client_thread_check': True,
-     'name': 'PpbRpcs',
-     'file_basename': 'ppb_rpc',
-     'srpc_files': [
-         'ppb.srpc',
-         'ppb_audio.srpc',
-         'ppb_audio_config.srpc',
-         'ppb_core.srpc',
-         'ppb_file_io.srpc',
-         'ppb_file_ref.srpc',
-         'ppb_file_system.srpc',
-         'ppb_find.srpc',
-         'ppb_font.srpc',
-         'ppb_fullscreen.srpc',
-         'ppb_gamepad.srpc',
-         'ppb_graphics_2d.srpc',
-         'ppb_graphics_3d.srpc',
-         'ppb_host_resolver_private.srpc',
-         'ppb_image_data.srpc',
-         'ppb_input_event.srpc',
-         'ppb_instance.srpc',
-         'ppb_messaging.srpc',
-         'ppb_mouse_cursor.srpc',
-         'ppb_mouse_lock.srpc',
-         'ppb_net_address_private.srpc',
-         'ppb_network_list_private.srpc',
-         'ppb_network_monitor_private.srpc',
-         'ppb_tcp_server_socket_private.srpc',
-         'ppb_tcp_socket_private.srpc',
-         'ppb_testing.srpc',
-         'ppb_udp_socket_private.srpc',
-         'ppb_url_loader.srpc',
-         'ppb_url_request_info.srpc',
-         'ppb_url_response_info.srpc',
-         'ppb_websocket.srpc',
-         'ppb_zoom.srpc',
-         ]},
-    {'trusted_is_client': False,
-     'name': 'PpbUpcalls',
-     'file_basename': 'upcall',
-     'srpc_files': [
-         'upcall.srpc',
-         ]},
-    ]
-
-def GeneratorForUnit(options, unit, is_trusted, output_dir):
-  header_file_name = unit['file_basename'] + '.h'
-  server_file_name = unit['file_basename'] + '_server.cc'
-  client_file_name = unit['file_basename'] + '_client.cc'
-  header_guard = 'GEN_PPAPI_PROXY_%s_H_' % unit['file_basename'].upper()
-
-  is_client = is_trusted == unit['trusted_is_client']
-
-  thread_check = unit.get('client_thread_check', False) == is_client
-
-  header_dir = 'trusted' if is_trusted else 'untrusted'
-
-  header = os.path.join(header_dir, 'srpcgen', header_file_name)
-  source = client_file_name if is_client else server_file_name
-
-  command = [
-      sys.executable, options.srpcgen,
-      '--ppapi',
-      '--include=' + '/'.join([header_dir, 'srpcgen', header_file_name]),
-      '-c' if is_client else '-s',
-      ]
-  if thread_check:
-    command.append('--thread-check')
-  command += [
-      unit['name'],
-      header_guard,
-      os.path.join(output_dir, header),
-      os.path.join(output_dir, source),
-      ]
-  command += [os.path.join(options.source_dir, file)
-              for file in unit['srpc_files']]
-
-  return command, [header, source]
-
-def RunOneUnit(options, unit, is_trusted):
-  result = 0
-  if options.diff_mode:
-    temp_dir = tempfile.mkdtemp(prefix='srpcdiff')
-    try:
-      command, files = GeneratorForUnit(options, unit, is_trusted, temp_dir)
-      result = subprocess.call(command)
-      if result != 0:
-        print 'Command failed: ' + ' '.join(command)
-      else:
-        for file in files:
-          output_file = os.path.join(options.output_dir, file)
-          generated_file = os.path.join(temp_dir, file)
-          if not filecmp.cmp(output_file, generated_file, shallow=False):
-            print '%s is out of date' % output_file
-            result = 1
-    finally:
-      shutil.rmtree(temp_dir, ignore_errors=True)
-  else:
-    command, _ = GeneratorForUnit(options, unit, is_trusted, options.output_dir)
-    print 'Run: ' + ' '.join(command)
-    if not options.dry_run:
-      result = subprocess.call(command)
-  return result
-
-def RunUnits(options, is_trusted):
-  result = 0
-  for unit in all_units:
-    this_result = RunOneUnit(options, unit, is_trusted)
-    if this_result != 0:
-      print 'Error %d on %s.' % (this_result, unit['name'])
-      result = this_result
-  return result
-
-def RunAll(options):
-  trusted_result = RunUnits(options, True)
-  untrusted_result = RunUnits(options, False)
-  return trusted_result or untrusted_result
-
-def Main(argv):
-  parser = optparse.OptionParser(usage='Usage: %prog [options]')
-  parser.add_option('-o', '--output_dir',
-                    help='Directory to receive output files.')
-  parser.add_option('-d', '--source_dir',
-                    help='Directory containing .srpc files.',
-                    default=os.path.dirname(argv[0]))
-  parser.add_option('-s', '--srpcgen',
-                    help='Path to the srpcgen.py script.')
-  parser.add_option('-n', '--dry_run', action='store_true',
-                    help='Just print commands instead of running them.',
-                    default=False)
-  parser.add_option('-c', '--diff_mode', action='store_true',
-                    help='Touch no files, but complain if they would differ',
-                    default=False)
-
-  options, args = parser.parse_args(argv[1:])
-
-  # Get rid of any excess ../ elements so the directory names are
-  # shorter and more obvious to the eye.
-  options.source_dir = os.path.normpath(options.source_dir)
-
-  if options.output_dir is None:
-    options.output_dir = options.source_dir
-
-  if options.srpcgen is None:
-    options.srpcgen = os.path.normpath(os.path.join(options.source_dir,
-                                                    '..', '..', 'tools',
-                                                    'srpcgen.py'))
-
-  if args:
-    parser.print_help()
-    return 1
-
-  return RunAll(options)
-
-if __name__ == '__main__':
-  sys.exit(Main(sys.argv))
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/string_proxy_var.h b/ppapi/native_client/src/shared/ppapi_proxy/string_proxy_var.h
deleted file mode 100644
index 8f90e43..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/string_proxy_var.h
+++ /dev/null
@@ -1,49 +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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_STRING_PROXY_VAR_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_STRING_PROXY_VAR_H_
-
-#include "native_client/src/include/nacl_memory.h"
-#include "native_client/src/shared/ppapi_proxy/proxy_var.h"
-
-#include <string>
-
-namespace ppapi_proxy {
-
-// Subclass of ProxyVar that handles string objects.
-class StringProxyVar : public ProxyVar {
- public:
-  explicit StringProxyVar(const std::string& contents)
-      : ProxyVar(PP_VARTYPE_STRING), contents_(contents) {}
-
-  StringProxyVar(const char* data, size_t len)
-      : ProxyVar(PP_VARTYPE_STRING), contents_(data, len) {}
-
-  const std::string& contents() const { return contents_; }
-
-  // Convenience function to do type checking and down-casting. This returns a
-  // scoped_refptr<>, so you don't have to down-cast the raw pointer.
-  static scoped_refptr<StringProxyVar> CastFromProxyVar(
-      SharedProxyVar proxy_var) {
-    if (proxy_var == NULL || proxy_var->pp_var_type() != PP_VARTYPE_STRING) {
-      scoped_refptr<StringProxyVar> string_var;
-      return string_var;
-    }
-    return scoped_refptr<StringProxyVar>(
-        static_cast<StringProxyVar*>(proxy_var.get()));
-  }
-
- protected:
-  virtual ~StringProxyVar() {}
-
- private:
-  std::string contents_;
-};
-
-typedef scoped_refptr<StringProxyVar> SharedStringProxyVar;
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_STRING_PROXY_VAR_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h b/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h
deleted file mode 100644
index 028ac86..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h
+++ /dev/null
@@ -1,1445 +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.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// Automatically generated code.  See srpcgen.py
-//
-// NaCl Simple Remote Procedure Call interface abstractions.
-
-#ifndef GEN_PPAPI_PROXY_PPB_RPC_H_
-#define GEN_PPAPI_PROXY_PPB_RPC_H_
-
-#ifndef __native_client__
-#include "native_client/src/include/portability.h"
-#endif  // __native_client__
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-
-class PpbRpcServer {
- public:
-  static void PPB_GetInterface(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      const char* interface_name,
-      int32_t* exports_interface_name);
-
- private:
-  PpbRpcServer();
-  PpbRpcServer(const PpbRpcServer&);
-  void operator=(const PpbRpcServer);
-};  // class PpbRpcServer
-
-class PpbAudioRpcServer {
- public:
-  static void PPB_Audio_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource config,
-      PP_Resource* out_resource);
-  static void PPB_Audio_IsAudio(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* out_bool);
-  static void PPB_Audio_GetCurrentConfig(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      PP_Resource* out_resource);
-  static void PPB_Audio_StopPlayback(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* out_bool);
-  static void PPB_Audio_StartPlayback(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* out_bool);
-
- private:
-  PpbAudioRpcServer();
-  PpbAudioRpcServer(const PpbAudioRpcServer&);
-  void operator=(const PpbAudioRpcServer);
-};  // class PpbAudioRpcServer
-
-class PpbAudioConfigRpcServer {
- public:
-  static void PPB_AudioConfig_CreateStereo16Bit(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t sample_rate,
-      int32_t sample_frame_count,
-      PP_Resource* resource);
-  static void PPB_AudioConfig_IsAudioConfig(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* out_bool);
-  static void PPB_AudioConfig_RecommendSampleFrameCount_1_0(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      int32_t request_sample_rate,
-      int32_t request_sample_frame_count,
-      int32_t* out_sample_frame_count);
-  static void PPB_AudioConfig_RecommendSampleFrameCount(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t request_sample_rate,
-      int32_t request_sample_frame_count,
-      int32_t* out_sample_frame_count);
-  static void PPB_AudioConfig_GetSampleRate(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* sample_rate);
-  static void PPB_AudioConfig_GetSampleFrameCount(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* sample_frame_count);
-  static void PPB_AudioConfig_RecommendSampleRate(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t* sample_rate);
-
- private:
-  PpbAudioConfigRpcServer();
-  PpbAudioConfigRpcServer(const PpbAudioConfigRpcServer&);
-  void operator=(const PpbAudioConfigRpcServer);
-};  // class PpbAudioConfigRpcServer
-
-class PpbCoreRpcServer {
- public:
-  static void PPB_Core_AddRefResource(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource);
-  static void PPB_Core_ReleaseResource(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource);
-  static void ReleaseResourceMultipleTimes(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t count);
-  static void PPB_Core_GetTime(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      double* time);
-  static void PPB_Core_GetTimeTicks(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      double* time_ticks);
-  static void PPB_Core_CallOnMainThread(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      int32_t delay_in_milliseconds,
-      int32_t callback_id,
-      int32_t result);
-
- private:
-  PpbCoreRpcServer();
-  PpbCoreRpcServer(const PpbCoreRpcServer&);
-  void operator=(const PpbCoreRpcServer);
-};  // class PpbCoreRpcServer
-
-class PpbFileIORpcServer {
- public:
-  static void PPB_FileIO_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource* resource);
-  static void PPB_FileIO_IsFileIO(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* success);
-  static void PPB_FileIO_Open(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_io,
-      PP_Resource file_ref,
-      int32_t open_flags,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_FileIO_Query(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_io,
-      int32_t bytes_to_read,
-      int32_t callback_id,
-      nacl_abi_size_t* info_bytes, char* info,
-      int32_t* pp_error);
-  static void PPB_FileIO_Touch(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_io,
-      double last_access_time,
-      double last_modified_time,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_FileIO_Read(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_io,
-      int64_t offset,
-      int32_t bytes_to_read,
-      int32_t callback_id,
-      nacl_abi_size_t* buffer_bytes, char* buffer,
-      int32_t* pp_error_or_bytes);
-  static void PPB_FileIO_Write(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_io,
-      int64_t offset,
-      nacl_abi_size_t buffer_bytes, char* buffer,
-      int32_t bytes_to_write,
-      int32_t callback_id,
-      int32_t* pp_error_or_bytes);
-  static void PPB_FileIO_SetLength(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_io,
-      int64_t length,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_FileIO_Flush(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_io,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_FileIO_Close(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_io);
-
- private:
-  PpbFileIORpcServer();
-  PpbFileIORpcServer(const PpbFileIORpcServer&);
-  void operator=(const PpbFileIORpcServer);
-};  // class PpbFileIORpcServer
-
-class PpbFileRefRpcServer {
- public:
-  static void PPB_FileRef_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_system,
-      nacl_abi_size_t path_bytes, char* path,
-      PP_Resource* resource);
-  static void PPB_FileRef_IsFileRef(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* success);
-  static void PPB_FileRef_GetFileSystemType(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_ref,
-      int32_t* file_system_type);
-  static void PPB_FileRef_GetName(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_ref,
-      nacl_abi_size_t* name_bytes, char* name);
-  static void PPB_FileRef_GetPath(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_ref,
-      nacl_abi_size_t* path_bytes, char* path);
-  static void PPB_FileRef_GetParent(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_ref,
-      PP_Resource* parent);
-  static void PPB_FileRef_MakeDirectory(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource directory_ref,
-      int32_t make_ancestors,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_FileRef_Touch(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_ref,
-      double last_access_time,
-      double last_modified_time,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_FileRef_Delete(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_ref,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_FileRef_Rename(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_ref,
-      PP_Resource new_file_ref,
-      int32_t callback_id,
-      int32_t* pp_error);
-
- private:
-  PpbFileRefRpcServer();
-  PpbFileRefRpcServer(const PpbFileRefRpcServer&);
-  void operator=(const PpbFileRefRpcServer);
-};  // class PpbFileRefRpcServer
-
-class PpbFileSystemRpcServer {
- public:
-  static void PPB_FileSystem_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t file_system_type,
-      PP_Resource* resource);
-  static void PPB_FileSystem_IsFileSystem(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* success);
-  static void PPB_FileSystem_Open(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_system,
-      int64_t expected_size,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_FileSystem_GetType(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource file_system,
-      int32_t* type);
-
- private:
-  PpbFileSystemRpcServer();
-  PpbFileSystemRpcServer(const PpbFileSystemRpcServer&);
-  void operator=(const PpbFileSystemRpcServer);
-};  // class PpbFileSystemRpcServer
-
-class PpbFindRpcServer {
- public:
-  static void PPB_Find_NumberOfFindResultsChanged(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t total,
-      int32_t final_result);
-  static void PPB_Find_SelectedFindResultChanged(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t index);
-
- private:
-  PpbFindRpcServer();
-  PpbFindRpcServer(const PpbFindRpcServer&);
-  void operator=(const PpbFindRpcServer);
-};  // class PpbFindRpcServer
-
-class PpbFontRpcServer {
- public:
-  static void PPB_Font_GetFontFamilies(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      nacl_abi_size_t* font_families_bytes, char* font_families);
-  static void PPB_Font_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      nacl_abi_size_t description_bytes, char* description,
-      nacl_abi_size_t face_bytes, char* face,
-      PP_Resource* font);
-  static void PPB_Font_IsFont(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* is_font);
-  static void PPB_Font_Describe(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource font,
-      nacl_abi_size_t* description_bytes, char* description,
-      nacl_abi_size_t* face_bytes, char* face,
-      nacl_abi_size_t* metrics_bytes, char* metrics,
-      int32_t* success);
-  static void PPB_Font_DrawTextAt(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource font,
-      PP_Resource image_data,
-      nacl_abi_size_t text_run_bytes, char* text_run,
-      nacl_abi_size_t text_bytes, char* text,
-      nacl_abi_size_t position_bytes, char* position,
-      int32_t color,
-      nacl_abi_size_t clip_bytes, char* clip,
-      int32_t image_data_is_opaque,
-      int32_t* success);
-  static void PPB_Font_MeasureText(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource font,
-      nacl_abi_size_t text_run_bytes, char* text_run,
-      nacl_abi_size_t text_bytes, char* text,
-      int32_t* width);
-  static void PPB_Font_CharacterOffsetForPixel(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource font,
-      nacl_abi_size_t text_run_bytes, char* text_run,
-      nacl_abi_size_t text_bytes, char* text,
-      int32_t pixel_position,
-      int32_t* offset);
-  static void PPB_Font_PixelOffsetForCharacter(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource font,
-      nacl_abi_size_t text_run_bytes, char* text_run,
-      nacl_abi_size_t text_bytes, char* text,
-      int32_t char_offset,
-      int32_t* offset);
-
- private:
-  PpbFontRpcServer();
-  PpbFontRpcServer(const PpbFontRpcServer&);
-  void operator=(const PpbFontRpcServer);
-};  // class PpbFontRpcServer
-
-class PpbFullscreenRpcServer {
- public:
-  static void PPB_Fullscreen_SetFullscreen(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t fullscreen,
-      int32_t* success);
-  static void PPB_Fullscreen_GetScreenSize(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      nacl_abi_size_t* size_bytes, char* size,
-      int32_t* success);
-
- private:
-  PpbFullscreenRpcServer();
-  PpbFullscreenRpcServer(const PpbFullscreenRpcServer&);
-  void operator=(const PpbFullscreenRpcServer);
-};  // class PpbFullscreenRpcServer
-
-class PpbGamepadRpcServer {
- public:
-  static void PPB_Gamepad_Sample(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      nacl_abi_size_t* data_bytes, char* data);
-
- private:
-  PpbGamepadRpcServer();
-  PpbGamepadRpcServer(const PpbGamepadRpcServer&);
-  void operator=(const PpbGamepadRpcServer);
-};  // class PpbGamepadRpcServer
-
-class PpbGraphics2DRpcServer {
- public:
-  static void PPB_Graphics2D_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      nacl_abi_size_t size_bytes, char* size,
-      int32_t is_always_opaque,
-      PP_Resource* resource);
-  static void PPB_Graphics2D_IsGraphics2D(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* success);
-  static void PPB_Graphics2D_Describe(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource graphics_2d,
-      nacl_abi_size_t* size_bytes, char* size,
-      int32_t* is_always_opaque,
-      int32_t* success);
-  static void PPB_Graphics2D_PaintImageData(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource graphics_2d,
-      PP_Resource image,
-      nacl_abi_size_t top_left_bytes, char* top_left,
-      nacl_abi_size_t src_rect_bytes, char* src_rect);
-  static void PPB_Graphics2D_Scroll(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource graphics_2d,
-      nacl_abi_size_t clip_rect_bytes, char* clip_rect,
-      nacl_abi_size_t amount_bytes, char* amount);
-  static void PPB_Graphics2D_ReplaceContents(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource graphics_2d,
-      PP_Resource image);
-  static void PPB_Graphics2D_Flush(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource graphics_2d,
-      int32_t callback_id,
-      int32_t* pp_error);
-
- private:
-  PpbGraphics2DRpcServer();
-  PpbGraphics2DRpcServer(const PpbGraphics2DRpcServer&);
-  void operator=(const PpbGraphics2DRpcServer);
-};  // class PpbGraphics2DRpcServer
-
-class PpbGraphics3DRpcServer {
- public:
-  static void PPB_Graphics3D_GetAttribMaxValue(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t attribute,
-      int32_t* value,
-      int32_t* pp_error);
-  static void PPB_Graphics3D_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource share_context,
-      nacl_abi_size_t attrib_list_bytes, int32_t* attrib_list,
-      PP_Resource* resource_id);
-  static void PPB_Graphics3D_GetAttribs(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource context,
-      nacl_abi_size_t input_attrib_list_bytes, int32_t* input_attrib_list,
-      nacl_abi_size_t* output_attrib_list_bytes, int32_t* output_attrib_list,
-      int32_t* pp_error);
-  static void PPB_Graphics3D_SetAttribs(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource context,
-      nacl_abi_size_t attrib_list_bytes, int32_t* attrib_list,
-      int32_t* pp_error);
-  static void PPB_Graphics3D_GetError(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource context,
-      int32_t* pp_error);
-  static void PPB_Graphics3D_SwapBuffers(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource context,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_Graphics3DTrusted_CreateRaw(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource share_context,
-      nacl_abi_size_t attrib_list_bytes, int32_t* attrib_list,
-      PP_Resource* resource_id);
-  static void PPB_Graphics3DTrusted_InitCommandBuffer(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource_id,
-      int32_t* success);
-  static void PPB_Graphics3DTrusted_SetGetBuffer(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource_id,
-      int32_t shm_id);
-  static void PPB_Graphics3DTrusted_GetState(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource_id,
-      nacl_abi_size_t* state_bytes, char* state);
-  static void PPB_Graphics3DTrusted_Flush(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource_id,
-      int32_t put_offset);
-  static void PPB_Graphics3DTrusted_FlushSync(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource_id,
-      int32_t put_offset,
-      nacl_abi_size_t* state_bytes, char* state);
-  static void PPB_Graphics3DTrusted_FlushSyncFast(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource_id,
-      int32_t put_offset,
-      int32_t last_known_offset,
-      nacl_abi_size_t* state_bytes, char* state);
-  static void PPB_Graphics3DTrusted_CreateTransferBuffer(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource_id,
-      int32_t size,
-      int32_t request_id,
-      int32_t* id);
-  static void PPB_Graphics3DTrusted_DestroyTransferBuffer(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource_id,
-      int32_t id);
-  static void PPB_Graphics3DTrusted_GetTransferBuffer(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource_id,
-      int32_t id,
-      NaClSrpcImcDescType* shm_desc,
-      int32_t* shm_size);
-
- private:
-  PpbGraphics3DRpcServer();
-  PpbGraphics3DRpcServer(const PpbGraphics3DRpcServer&);
-  void operator=(const PpbGraphics3DRpcServer);
-};  // class PpbGraphics3DRpcServer
-
-class PpbHostResolverPrivateRpcServer {
- public:
-  static void PPB_HostResolver_Private_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource* resource);
-  static void PPB_HostResolver_Private_IsHostResolver(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* is_host_resolver);
-  static void PPB_HostResolver_Private_Resolve(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource host_resolver,
-      const char* host,
-      int32_t port,
-      nacl_abi_size_t hint_bytes, char* hint,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_HostResolver_Private_GetCanonicalName(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource host_resolver,
-      nacl_abi_size_t* canonical_name_bytes, char* canonical_name);
-  static void PPB_HostResolver_Private_GetSize(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource host_resolver,
-      int32_t* size);
-  static void PPB_HostResolver_Private_GetNetAddress(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource host_resolver,
-      int32_t index,
-      nacl_abi_size_t* addr_bytes, char* addr,
-      int32_t* success);
-
- private:
-  PpbHostResolverPrivateRpcServer();
-  PpbHostResolverPrivateRpcServer(const PpbHostResolverPrivateRpcServer&);
-  void operator=(const PpbHostResolverPrivateRpcServer);
-};  // class PpbHostResolverPrivateRpcServer
-
-class PpbImageDataRpcServer {
- public:
-  static void PPB_ImageData_GetNativeImageDataFormat(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      int32_t* format);
-  static void PPB_ImageData_IsImageDataFormatSupported(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      int32_t format,
-      int32_t* success);
-  static void PPB_ImageData_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t format,
-      nacl_abi_size_t size_bytes, char* size,
-      int32_t init_to_zero,
-      PP_Resource* resource);
-  static void PPB_ImageData_IsImageData(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* success);
-  static void PPB_ImageData_Describe(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      nacl_abi_size_t* desc_bytes, char* desc,
-      NaClSrpcImcDescType* shm,
-      int32_t* shm_size,
-      int32_t* success);
-
- private:
-  PpbImageDataRpcServer();
-  PpbImageDataRpcServer(const PpbImageDataRpcServer&);
-  void operator=(const PpbImageDataRpcServer);
-};  // class PpbImageDataRpcServer
-
-class PpbInputEventRpcServer {
- public:
-  static void PPB_InputEvent_RequestInputEvents(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t event_classes,
-      int32_t filtered,
-      int32_t* success);
-  static void PPB_InputEvent_ClearInputEventRequest(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t event_classes);
-  static void PPB_InputEvent_CreateMouseInputEvent(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t type,
-      double time_stamp,
-      int32_t modifiers,
-      int32_t mouse_button,
-      int32_t mouse_position_x,
-      int32_t mouse_position_y,
-      int32_t click_count,
-      int32_t mouse_movement_x,
-      int32_t mouse_movement_y,
-      PP_Resource* resource_id);
-  static void PPB_InputEvent_CreateWheelInputEvent(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      double time_stamp,
-      int32_t modifiers,
-      double wheel_delta_x,
-      double wheel_delta_y,
-      double wheel_ticks_x,
-      double wheel_ticks_y,
-      int32_t scroll_by_page,
-      PP_Resource* resource_id);
-  static void PPB_InputEvent_CreateKeyboardInputEvent(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t type,
-      double time_stamp,
-      int32_t modifiers,
-      int32_t key_code,
-      nacl_abi_size_t character_text_bytes, char* character_text,
-      PP_Resource* resource_id);
-
- private:
-  PpbInputEventRpcServer();
-  PpbInputEventRpcServer(const PpbInputEventRpcServer&);
-  void operator=(const PpbInputEventRpcServer);
-};  // class PpbInputEventRpcServer
-
-class PpbInstanceRpcServer {
- public:
-  static void PPB_Instance_BindGraphics(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource graphics_device,
-      int32_t* success);
-  static void PPB_Instance_IsFullFrame(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t* is_full_frame);
-
- private:
-  PpbInstanceRpcServer();
-  PpbInstanceRpcServer(const PpbInstanceRpcServer&);
-  void operator=(const PpbInstanceRpcServer);
-};  // class PpbInstanceRpcServer
-
-class PpbMessagingRpcServer {
- public:
-  static void PPB_Messaging_PostMessage(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      nacl_abi_size_t message_bytes, char* message);
-
- private:
-  PpbMessagingRpcServer();
-  PpbMessagingRpcServer(const PpbMessagingRpcServer&);
-  void operator=(const PpbMessagingRpcServer);
-};  // class PpbMessagingRpcServer
-
-class PpbMouseCursorRpcServer {
- public:
-  static void PPB_MouseCursor_SetCursor(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t type,
-      PP_Resource custom_image,
-      nacl_abi_size_t hot_spot_bytes, char* hot_spot,
-      int32_t* success);
-
- private:
-  PpbMouseCursorRpcServer();
-  PpbMouseCursorRpcServer(const PpbMouseCursorRpcServer&);
-  void operator=(const PpbMouseCursorRpcServer);
-};  // class PpbMouseCursorRpcServer
-
-class PpbMouseLockRpcServer {
- public:
-  static void PPB_MouseLock_LockMouse(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_MouseLock_UnlockMouse(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance);
-
- private:
-  PpbMouseLockRpcServer();
-  PpbMouseLockRpcServer(const PpbMouseLockRpcServer&);
-  void operator=(const PpbMouseLockRpcServer);
-};  // class PpbMouseLockRpcServer
-
-class PpbNetAddressPrivateRpcServer {
- public:
-  static void PPB_NetAddress_Private_AreEqual(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      nacl_abi_size_t addr1_bytes, char* addr1,
-      nacl_abi_size_t addr2_bytes, char* addr2,
-      int32_t* equals);
-  static void PPB_NetAddress_Private_AreHostsEqual(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      nacl_abi_size_t addr1_bytes, char* addr1,
-      nacl_abi_size_t addr2_bytes, char* addr2,
-      int32_t* equals);
-  static void PPB_NetAddress_Private_Describe(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      int32_t module,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t include_port,
-      nacl_abi_size_t* description_bytes, char* description);
-  static void PPB_NetAddress_Private_ReplacePort(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      nacl_abi_size_t src_addr_bytes, char* src_addr,
-      int32_t port,
-      nacl_abi_size_t* dst_addr_bytes, char* dst_addr,
-      int32_t* success);
-  static void PPB_NetAddress_Private_GetAnyAddress(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      int32_t is_ipv6,
-      nacl_abi_size_t* addr_bytes, char* addr);
-  static void PPB_NetAddress_Private_GetFamily(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t* addr_family);
-  static void PPB_NetAddress_Private_GetPort(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t* port);
-  static void PPB_NetAddress_Private_GetAddress(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      nacl_abi_size_t addr_bytes, char* addr,
-      nacl_abi_size_t* address_bytes, char* address,
-      int32_t* success);
-  static void PPB_NetAddress_Private_GetScopeID(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t* scope_id);
-  static void PPB_NetAddress_Private_CreateFromIPv4Address(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      nacl_abi_size_t ip_bytes, char* ip,
-      int32_t port,
-      nacl_abi_size_t* addr_bytes, char* addr);
-  static void PPB_NetAddress_Private_CreateFromIPv6Address(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      nacl_abi_size_t ip_bytes, char* ip,
-      int32_t scope_id,
-      int32_t port,
-      nacl_abi_size_t* addr_bytes, char* addr);
-
- private:
-  PpbNetAddressPrivateRpcServer();
-  PpbNetAddressPrivateRpcServer(const PpbNetAddressPrivateRpcServer&);
-  void operator=(const PpbNetAddressPrivateRpcServer);
-};  // class PpbNetAddressPrivateRpcServer
-
-class PpbNetworkListPrivateServer {
- public:
-  static void PPB_NetworkList_Private_IsNetworkList(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* out_bool);
-  static void PPB_NetworkList_Private_GetCount(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* count);
-  static void PPB_NetworkList_Private_GetName(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t index,
-      nacl_abi_size_t* name_bytes, char* name);
-  static void PPB_NetworkList_Private_GetType(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t index,
-      int32_t* type);
-  static void PPB_NetworkList_Private_GetState(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t index,
-      int32_t* state);
-  static void PPB_NetworkList_Private_GetIpAddresses(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t index,
-      nacl_abi_size_t* addr_bytes, char* addr,
-      int32_t* addresses_count);
-  static void PPB_NetworkList_Private_GetDisplayName(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t index,
-      nacl_abi_size_t* display_name_bytes, char* display_name);
-  static void PPB_NetworkList_Private_GetMTU(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t index,
-      int32_t* mtu);
-
- private:
-  PpbNetworkListPrivateServer();
-  PpbNetworkListPrivateServer(const PpbNetworkListPrivateServer&);
-  void operator=(const PpbNetworkListPrivateServer);
-};  // class PpbNetworkListPrivateServer
-
-class PpbNetworkMonitorPrivateServer {
- public:
-  static void PPB_NetworkMonitor_Private_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource* out_resource);
-  static void PPB_NetworkMonitor_Private_IsNetworkMonitor(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* out_bool);
-
- private:
-  PpbNetworkMonitorPrivateServer();
-  PpbNetworkMonitorPrivateServer(const PpbNetworkMonitorPrivateServer&);
-  void operator=(const PpbNetworkMonitorPrivateServer);
-};  // class PpbNetworkMonitorPrivateServer
-
-class PpbTCPServerSocketPrivateRpcServer {
- public:
-  static void PPB_TCPServerSocket_Private_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource* resource);
-  static void PPB_TCPServerSocket_Private_IsTCPServerSocket(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* is_tcp_server_socket);
-  static void PPB_TCPServerSocket_Private_Listen(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource tcp_server_socket,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t backlog,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_TCPServerSocket_Private_Accept(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource tcp_server_socket,
-      int32_t callback_id,
-      PP_Resource* tcp_socket,
-      int32_t* pp_error);
-  static void PPB_TCPServerSocket_Private_StopListening(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource tcp_server_socket);
-
- private:
-  PpbTCPServerSocketPrivateRpcServer();
-  PpbTCPServerSocketPrivateRpcServer(const PpbTCPServerSocketPrivateRpcServer&);
-  void operator=(const PpbTCPServerSocketPrivateRpcServer);
-};  // class PpbTCPServerSocketPrivateRpcServer
-
-class PpbTCPSocketPrivateRpcServer {
- public:
-  static void PPB_TCPSocket_Private_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource* resource);
-  static void PPB_TCPSocket_Private_IsTCPSocket(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* is_tcp_socket);
-  static void PPB_TCPSocket_Private_Connect(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource tcp_socket,
-      const char* host,
-      int32_t port,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_TCPSocket_Private_ConnectWithNetAddress(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource tcp_socket,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_TCPSocket_Private_GetLocalAddress(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource tcp_socket,
-      nacl_abi_size_t* local_addr_bytes, char* local_addr,
-      int32_t* success);
-  static void PPB_TCPSocket_Private_GetRemoteAddress(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource tcp_socket,
-      nacl_abi_size_t* remote_addr_bytes, char* remote_addr,
-      int32_t* success);
-  static void PPB_TCPSocket_Private_SSLHandshake(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource tcp_socket,
-      const char* server_name,
-      int32_t server_port,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_TCPSocket_Private_Read(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource tcp_socket,
-      int32_t bytes_to_read,
-      int32_t callback_id,
-      nacl_abi_size_t* buffer_bytes, char* buffer,
-      int32_t* pp_error_or_bytes);
-  static void PPB_TCPSocket_Private_Write(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource tcp_socket,
-      nacl_abi_size_t buffer_bytes, char* buffer,
-      int32_t bytes_to_write,
-      int32_t callback_id,
-      int32_t* pp_error_or_bytes);
-  static void PPB_TCPSocket_Private_Disconnect(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource tcp_socket);
-
- private:
-  PpbTCPSocketPrivateRpcServer();
-  PpbTCPSocketPrivateRpcServer(const PpbTCPSocketPrivateRpcServer&);
-  void operator=(const PpbTCPSocketPrivateRpcServer);
-};  // class PpbTCPSocketPrivateRpcServer
-
-class PpbTestingRpcServer {
- public:
-  static void PPB_Testing_ReadImageData(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource device_context_2d,
-      PP_Resource image,
-      nacl_abi_size_t top_left_bytes, char* top_left,
-      int32_t* success);
-  static void PPB_Testing_RunMessageLoop(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance);
-  static void PPB_Testing_QuitMessageLoop(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance);
-  static void PPB_Testing_GetLiveObjectsForInstance(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t* live_object_count);
-  static void PPB_Testing_SimulateInputEvent(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource input_event);
-  static void PPB_Testing_GetDocumentURL(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      nacl_abi_size_t* components_bytes, char* components,
-      nacl_abi_size_t* url_bytes, char* url);
-
- private:
-  PpbTestingRpcServer();
-  PpbTestingRpcServer(const PpbTestingRpcServer&);
-  void operator=(const PpbTestingRpcServer);
-};  // class PpbTestingRpcServer
-
-class PpbUDPSocketPrivateRpcServer {
- public:
-  static void PPB_UDPSocket_Private_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance_id,
-      PP_Resource* resource);
-  static void PPB_UDPSocket_Private_IsUDPSocket(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource_id,
-      int32_t* is_udp_socket_private);
-  static void PPB_UDPSocket_Private_SetSocketFeature(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource udp_socket,
-      int32_t name,
-      nacl_abi_size_t value_bytes, char* value,
-      int32_t* pp_error);
-  static void PPB_UDPSocket_Private_Bind(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource udp_socket,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_UDPSocket_Private_GetBoundAddress(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource udp_socket,
-      nacl_abi_size_t* addr_bytes, char* addr,
-      int32_t* success);
-  static void PPB_UDPSocket_Private_RecvFrom(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource udp_socket,
-      int32_t num_bytes,
-      int32_t callback_id,
-      nacl_abi_size_t* buffer_bytes, char* buffer,
-      int32_t* pp_error_or_bytes);
-  static void PPB_UDPSocket_Private_GetRecvFromAddress(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource udp_socket,
-      nacl_abi_size_t* addr_bytes, char* addr,
-      int32_t* success);
-  static void PPB_UDPSocket_Private_SendTo(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource udp_socket,
-      nacl_abi_size_t buffer_bytes, char* buffer,
-      int32_t num_bytes,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t callback_id,
-      int32_t* pp_error_or_bytes);
-  static void PPB_UDPSocket_Private_Close(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource udp_socket);
-
- private:
-  PpbUDPSocketPrivateRpcServer();
-  PpbUDPSocketPrivateRpcServer(const PpbUDPSocketPrivateRpcServer&);
-  void operator=(const PpbUDPSocketPrivateRpcServer);
-};  // class PpbUDPSocketPrivateRpcServer
-
-class PpbURLLoaderRpcServer {
- public:
-  static void PPB_URLLoader_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource* resource);
-  static void PPB_URLLoader_IsURLLoader(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* is_url_loader);
-  static void PPB_URLLoader_Open(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource loader,
-      PP_Resource request,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_URLLoader_FollowRedirect(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource loader,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_URLLoader_GetUploadProgress(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource loader,
-      int64_t* bytes_sent,
-      int64_t* total_bytes_to_be_sent,
-      int32_t* success);
-  static void PPB_URLLoader_GetDownloadProgress(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource loader,
-      int64_t* bytes_received,
-      int64_t* total_bytes_to_be_received,
-      int32_t* success);
-  static void PPB_URLLoader_GetResponseInfo(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource loader,
-      PP_Resource* response);
-  static void PPB_URLLoader_ReadResponseBody(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource loader,
-      int32_t bytes_to_read,
-      int32_t callback_id,
-      nacl_abi_size_t* buffer_bytes, char* buffer,
-      int32_t* pp_error_or_bytes);
-  static void PPB_URLLoader_FinishStreamingToFile(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource loader,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_URLLoader_Close(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource loader);
-
- private:
-  PpbURLLoaderRpcServer();
-  PpbURLLoaderRpcServer(const PpbURLLoaderRpcServer&);
-  void operator=(const PpbURLLoaderRpcServer);
-};  // class PpbURLLoaderRpcServer
-
-class PpbURLRequestInfoRpcServer {
- public:
-  static void PPB_URLRequestInfo_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource* resource);
-  static void PPB_URLRequestInfo_IsURLRequestInfo(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* success);
-  static void PPB_URLRequestInfo_SetProperty(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource request,
-      int32_t property,
-      nacl_abi_size_t value_bytes, char* value,
-      int32_t* success);
-  static void PPB_URLRequestInfo_AppendDataToBody(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource request,
-      nacl_abi_size_t data_bytes, char* data,
-      int32_t* success);
-  static void PPB_URLRequestInfo_AppendFileToBody(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource request,
-      PP_Resource file_ref,
-      int64_t start_offset,
-      int64_t number_of_bytes,
-      double expected_last_modified_time,
-      int32_t* success);
-
- private:
-  PpbURLRequestInfoRpcServer();
-  PpbURLRequestInfoRpcServer(const PpbURLRequestInfoRpcServer&);
-  void operator=(const PpbURLRequestInfoRpcServer);
-};  // class PpbURLRequestInfoRpcServer
-
-class PpbURLResponseInfoRpcServer {
- public:
-  static void PPB_URLResponseInfo_IsURLResponseInfo(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource resource,
-      int32_t* success);
-  static void PPB_URLResponseInfo_GetProperty(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource response,
-      int32_t property,
-      nacl_abi_size_t* value_bytes, char* value);
-  static void PPB_URLResponseInfo_GetBodyAsFileRef(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource response,
-      PP_Resource* file_ref);
-
- private:
-  PpbURLResponseInfoRpcServer();
-  PpbURLResponseInfoRpcServer(const PpbURLResponseInfoRpcServer&);
-  void operator=(const PpbURLResponseInfoRpcServer);
-};  // class PpbURLResponseInfoRpcServer
-
-class PpbWebSocketRpcServer {
- public:
-  static void PPB_WebSocket_Create(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource* resource);
-  static void PPB_WebSocket_IsWebSocket(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource instance,
-      int32_t* is_websocket);
-  static void PPB_WebSocket_Connect(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource ws,
-      nacl_abi_size_t url_bytes, char* url,
-      nacl_abi_size_t protocols_bytes, char* protocols,
-      int32_t protocol_count,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_WebSocket_Close(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource ws,
-      int32_t code,
-      nacl_abi_size_t reason_bytes, char* reason,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static void PPB_WebSocket_ReceiveMessage(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource ws,
-      int32_t callback_id,
-      int32_t* pp_error,
-      nacl_abi_size_t* sync_read_buffer_bytes, char* sync_read_buffer);
-  static void PPB_WebSocket_SendMessage(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource ws,
-      nacl_abi_size_t message_bytes, char* message,
-      int32_t* pp_error);
-  static void PPB_WebSocket_GetBufferedAmount(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource ws,
-      int64_t* buffered_amount);
-  static void PPB_WebSocket_GetCloseCode(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource ws,
-      int32_t* close_code);
-  static void PPB_WebSocket_GetCloseReason(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource ws,
-      nacl_abi_size_t* reason_bytes, char* reason);
-  static void PPB_WebSocket_GetCloseWasClean(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource ws,
-      int32_t* was_clean);
-  static void PPB_WebSocket_GetExtensions(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource ws,
-      nacl_abi_size_t* extensions_bytes, char* extensions);
-  static void PPB_WebSocket_GetProtocol(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource ws,
-      nacl_abi_size_t* protocol_bytes, char* protocol);
-  static void PPB_WebSocket_GetReadyState(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource ws,
-      int32_t* ready_state);
-  static void PPB_WebSocket_GetURL(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource ws,
-      nacl_abi_size_t* url_bytes, char* url);
-
- private:
-  PpbWebSocketRpcServer();
-  PpbWebSocketRpcServer(const PpbWebSocketRpcServer&);
-  void operator=(const PpbWebSocketRpcServer);
-};  // class PpbWebSocketRpcServer
-
-class PpbZoomRpcServer {
- public:
-  static void PPB_Zoom_ZoomChanged(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      double factor);
-  static void PPB_Zoom_ZoomLimitsChanged(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      double minimum_factor,
-      double maximum_factor);
-
- private:
-  PpbZoomRpcServer();
-  PpbZoomRpcServer(const PpbZoomRpcServer&);
-  void operator=(const PpbZoomRpcServer);
-};  // class PpbZoomRpcServer
-
-class PpbRpcs {
- public:
-  static NaClSrpcHandlerDesc srpc_methods[];
-};  // class PpbRpcs
-
-
-#endif  // GEN_PPAPI_PROXY_PPB_RPC_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h b/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h
deleted file mode 100644
index 1781843..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h
+++ /dev/null
@@ -1,244 +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.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// Automatically generated code.  See srpcgen.py
-//
-// NaCl Simple Remote Procedure Call interface abstractions.
-
-#ifndef GEN_PPAPI_PROXY_PPP_RPC_H_
-#define GEN_PPAPI_PROXY_PPP_RPC_H_
-
-#ifndef __native_client__
-#include "native_client/src/include/portability.h"
-#endif  // __native_client__
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-
-class CompletionCallbackRpcClient {
- public:
-  static NaClSrpcError RunCompletionCallback(
-      NaClSrpcChannel* channel,
-      int32_t callback_id,
-      int32_t result,
-      nacl_abi_size_t read_buffer_bytes, char* read_buffer);
-
- private:
-  CompletionCallbackRpcClient();
-  CompletionCallbackRpcClient(const CompletionCallbackRpcClient&);
-  void operator=(const CompletionCallbackRpcClient);
-};  // class CompletionCallbackRpcClient
-
-class PppRpcClient {
- public:
-  static NaClSrpcError PPP_InitializeModule(
-      NaClSrpcChannel* channel,
-      PP_Module module,
-      NaClSrpcImcDescType upcall_channel_desc,
-      const char* service_description,
-      int32_t* success);
-  static NaClSrpcError PPP_ShutdownModule(
-      NaClSrpcChannel* channel);
-  static NaClSrpcError PPP_GetInterface(
-      NaClSrpcChannel* channel,
-      const char* interface_name,
-      int32_t* exports_interface_name);
-
- private:
-  PppRpcClient();
-  PppRpcClient(const PppRpcClient&);
-  void operator=(const PppRpcClient);
-};  // class PppRpcClient
-
-class PppAudioRpcClient {
- public:
-  static NaClSrpcError PPP_Audio_StreamCreated(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      NaClSrpcImcDescType out_shm,
-      int32_t out_shm_size,
-      NaClSrpcImcDescType out_socket);
-
- private:
-  PppAudioRpcClient();
-  PppAudioRpcClient(const PppAudioRpcClient&);
-  void operator=(const PppAudioRpcClient);
-};  // class PppAudioRpcClient
-
-class PppFindRpcClient {
- public:
-  static NaClSrpcError PPP_Find_StartFind(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      nacl_abi_size_t text_bytes, char* text,
-      int32_t case_sensitive,
-      int32_t* supports_find);
-  static NaClSrpcError PPP_Find_SelectFindResult(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t forward);
-  static NaClSrpcError PPP_Find_StopFind(
-      NaClSrpcChannel* channel,
-      PP_Instance instance);
-
- private:
-  PppFindRpcClient();
-  PppFindRpcClient(const PppFindRpcClient&);
-  void operator=(const PppFindRpcClient);
-};  // class PppFindRpcClient
-
-class PppInputEventRpcClient {
- public:
-  static NaClSrpcError PPP_InputEvent_HandleInputEvent(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource resource,
-      nacl_abi_size_t event_data_bytes, char* event_data,
-      nacl_abi_size_t character_text_bytes, char* character_text,
-      int32_t* handled);
-
- private:
-  PppInputEventRpcClient();
-  PppInputEventRpcClient(const PppInputEventRpcClient&);
-  void operator=(const PppInputEventRpcClient);
-};  // class PppInputEventRpcClient
-
-class PppInstanceRpcClient {
- public:
-  static NaClSrpcError PPP_Instance_DidCreate(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t argc,
-      nacl_abi_size_t argn_bytes, char* argn,
-      nacl_abi_size_t argv_bytes, char* argv,
-      int32_t* success);
-  static NaClSrpcError PPP_Instance_DidDestroy(
-      NaClSrpcChannel* channel,
-      PP_Instance instance);
-  static NaClSrpcError PPP_Instance_DidChangeView(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource resource,
-      nacl_abi_size_t view_data_bytes, char* view_data);
-  static NaClSrpcError PPP_Instance_DidChangeFocus(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      bool has_focus);
-  static NaClSrpcError PPP_Instance_HandleDocumentLoad(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource url_loader,
-      int32_t* success);
-
- private:
-  PppInstanceRpcClient();
-  PppInstanceRpcClient(const PppInstanceRpcClient&);
-  void operator=(const PppInstanceRpcClient);
-};  // class PppInstanceRpcClient
-
-class PppMessagingRpcClient {
- public:
-  static NaClSrpcError PPP_Messaging_HandleMessage(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      nacl_abi_size_t message_bytes, char* message);
-
- private:
-  PppMessagingRpcClient();
-  PppMessagingRpcClient(const PppMessagingRpcClient&);
-  void operator=(const PppMessagingRpcClient);
-};  // class PppMessagingRpcClient
-
-class PppMouseLockRpcClient {
- public:
-  static NaClSrpcError PPP_MouseLock_MouseLockLost(
-      NaClSrpcChannel* channel,
-      PP_Instance instance);
-
- private:
-  PppMouseLockRpcClient();
-  PppMouseLockRpcClient(const PppMouseLockRpcClient&);
-  void operator=(const PppMouseLockRpcClient);
-};  // class PppMouseLockRpcClient
-
-class PppNetworkMonitorPrivateRpcClient {
- public:
-  static NaClSrpcError PPP_NetworkMonitor_Private_NetworkListChanged(
-      NaClSrpcChannel* channel,
-      PP_Resource network_monitor,
-      PP_Resource network_list);
-
- private:
-  PppNetworkMonitorPrivateRpcClient();
-  PppNetworkMonitorPrivateRpcClient(const PppNetworkMonitorPrivateRpcClient&);
-  void operator=(const PppNetworkMonitorPrivateRpcClient);
-};  // class PppNetworkMonitorPrivateRpcClient
-
-class PppPrintingRpcClient {
- public:
-  static NaClSrpcError PPP_Printing_QuerySupportedFormats(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t* formats);
-  static NaClSrpcError PPP_Printing_Begin(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      nacl_abi_size_t print_settings_bytes, char* print_settings,
-      int32_t* pages_required);
-  static NaClSrpcError PPP_Printing_PrintPages(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      nacl_abi_size_t page_ranges_bytes, char* page_ranges,
-      int32_t page_range_count,
-      PP_Resource* image_data);
-  static NaClSrpcError PPP_Printing_End(
-      NaClSrpcChannel* channel,
-      PP_Instance instance);
-  static NaClSrpcError PPP_Printing_IsScalingDisabled(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t* result);
-
- private:
-  PppPrintingRpcClient();
-  PppPrintingRpcClient(const PppPrintingRpcClient&);
-  void operator=(const PppPrintingRpcClient);
-};  // class PppPrintingRpcClient
-
-class PppSelectionRpcClient {
- public:
-  static NaClSrpcError PPP_Selection_GetSelectedText(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t html,
-      nacl_abi_size_t* selected_text_bytes, char* selected_text);
-
- private:
-  PppSelectionRpcClient();
-  PppSelectionRpcClient(const PppSelectionRpcClient&);
-  void operator=(const PppSelectionRpcClient);
-};  // class PppSelectionRpcClient
-
-class PppZoomRpcClient {
- public:
-  static NaClSrpcError PPP_Zoom_Zoom(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      double factor,
-      int32_t text_only);
-
- private:
-  PppZoomRpcClient();
-  PppZoomRpcClient(const PppZoomRpcClient&);
-  void operator=(const PppZoomRpcClient);
-};  // class PppZoomRpcClient
-
-
-
-
-#endif  // GEN_PPAPI_PROXY_PPP_RPC_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/upcall.h b/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/upcall.h
deleted file mode 100644
index 8751e11..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/upcall.h
+++ /dev/null
@@ -1,44 +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.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// Automatically generated code.  See srpcgen.py
-//
-// NaCl Simple Remote Procedure Call interface abstractions.
-
-#ifndef GEN_PPAPI_PROXY_UPCALL_H_
-#define GEN_PPAPI_PROXY_UPCALL_H_
-
-#ifndef __native_client__
-#include "native_client/src/include/portability.h"
-#endif  // __native_client__
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-
-class PppUpcallRpcServer {
- public:
-  static void PPB_Core_CallOnMainThread(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      int32_t delay_in_milliseconds,
-      int32_t callback_id,
-      int32_t result);
-
- private:
-  PppUpcallRpcServer();
-  PppUpcallRpcServer(const PppUpcallRpcServer&);
-  void operator=(const PppUpcallRpcServer);
-};  // class PppUpcallRpcServer
-
-class PpbUpcalls {
- public:
-  static NaClSrpcHandlerDesc srpc_methods[];
-};  // class PpbUpcalls
-
-
-#endif  // GEN_PPAPI_PROXY_UPCALL_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h b/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h
deleted file mode 100644
index e4b6644..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h
+++ /dev/null
@@ -1,1256 +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.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// Automatically generated code.  See srpcgen.py
-//
-// NaCl Simple Remote Procedure Call interface abstractions.
-
-#ifndef GEN_PPAPI_PROXY_PPB_RPC_H_
-#define GEN_PPAPI_PROXY_PPB_RPC_H_
-
-#ifndef __native_client__
-#include "native_client/src/include/portability.h"
-#endif  // __native_client__
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-
-class PpbRpcClient {
- public:
-  static NaClSrpcError PPB_GetInterface(
-      NaClSrpcChannel* channel,
-      const char* interface_name,
-      int32_t* exports_interface_name);
-
- private:
-  PpbRpcClient();
-  PpbRpcClient(const PpbRpcClient&);
-  void operator=(const PpbRpcClient);
-};  // class PpbRpcClient
-
-class PpbAudioRpcClient {
- public:
-  static NaClSrpcError PPB_Audio_Create(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource config,
-      PP_Resource* out_resource);
-  static NaClSrpcError PPB_Audio_IsAudio(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* out_bool);
-  static NaClSrpcError PPB_Audio_GetCurrentConfig(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      PP_Resource* out_resource);
-  static NaClSrpcError PPB_Audio_StopPlayback(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* out_bool);
-  static NaClSrpcError PPB_Audio_StartPlayback(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* out_bool);
-
- private:
-  PpbAudioRpcClient();
-  PpbAudioRpcClient(const PpbAudioRpcClient&);
-  void operator=(const PpbAudioRpcClient);
-};  // class PpbAudioRpcClient
-
-class PpbAudioConfigRpcClient {
- public:
-  static NaClSrpcError PPB_AudioConfig_CreateStereo16Bit(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t sample_rate,
-      int32_t sample_frame_count,
-      PP_Resource* resource);
-  static NaClSrpcError PPB_AudioConfig_IsAudioConfig(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* out_bool);
-  static NaClSrpcError PPB_AudioConfig_RecommendSampleFrameCount_1_0(
-      NaClSrpcChannel* channel,
-      int32_t request_sample_rate,
-      int32_t request_sample_frame_count,
-      int32_t* out_sample_frame_count);
-  static NaClSrpcError PPB_AudioConfig_RecommendSampleFrameCount(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t request_sample_rate,
-      int32_t request_sample_frame_count,
-      int32_t* out_sample_frame_count);
-  static NaClSrpcError PPB_AudioConfig_GetSampleRate(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* sample_rate);
-  static NaClSrpcError PPB_AudioConfig_GetSampleFrameCount(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* sample_frame_count);
-  static NaClSrpcError PPB_AudioConfig_RecommendSampleRate(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t* sample_rate);
-
- private:
-  PpbAudioConfigRpcClient();
-  PpbAudioConfigRpcClient(const PpbAudioConfigRpcClient&);
-  void operator=(const PpbAudioConfigRpcClient);
-};  // class PpbAudioConfigRpcClient
-
-class PpbCoreRpcClient {
- public:
-  static NaClSrpcError PPB_Core_AddRefResource(
-      NaClSrpcChannel* channel,
-      PP_Resource resource);
-  static NaClSrpcError PPB_Core_ReleaseResource(
-      NaClSrpcChannel* channel,
-      PP_Resource resource);
-  static NaClSrpcError ReleaseResourceMultipleTimes(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t count);
-  static NaClSrpcError PPB_Core_GetTime(
-      NaClSrpcChannel* channel,
-      double* time);
-  static NaClSrpcError PPB_Core_GetTimeTicks(
-      NaClSrpcChannel* channel,
-      double* time_ticks);
-  static NaClSrpcError PPB_Core_CallOnMainThread(
-      NaClSrpcChannel* channel,
-      int32_t delay_in_milliseconds,
-      int32_t callback_id,
-      int32_t result);
-
- private:
-  PpbCoreRpcClient();
-  PpbCoreRpcClient(const PpbCoreRpcClient&);
-  void operator=(const PpbCoreRpcClient);
-};  // class PpbCoreRpcClient
-
-class PpbFileIORpcClient {
- public:
-  static NaClSrpcError PPB_FileIO_Create(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource* resource);
-  static NaClSrpcError PPB_FileIO_IsFileIO(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* success);
-  static NaClSrpcError PPB_FileIO_Open(
-      NaClSrpcChannel* channel,
-      PP_Resource file_io,
-      PP_Resource file_ref,
-      int32_t open_flags,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_FileIO_Query(
-      NaClSrpcChannel* channel,
-      PP_Resource file_io,
-      int32_t bytes_to_read,
-      int32_t callback_id,
-      nacl_abi_size_t* info_bytes, char* info,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_FileIO_Touch(
-      NaClSrpcChannel* channel,
-      PP_Resource file_io,
-      double last_access_time,
-      double last_modified_time,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_FileIO_Read(
-      NaClSrpcChannel* channel,
-      PP_Resource file_io,
-      int64_t offset,
-      int32_t bytes_to_read,
-      int32_t callback_id,
-      nacl_abi_size_t* buffer_bytes, char* buffer,
-      int32_t* pp_error_or_bytes);
-  static NaClSrpcError PPB_FileIO_Write(
-      NaClSrpcChannel* channel,
-      PP_Resource file_io,
-      int64_t offset,
-      nacl_abi_size_t buffer_bytes, char* buffer,
-      int32_t bytes_to_write,
-      int32_t callback_id,
-      int32_t* pp_error_or_bytes);
-  static NaClSrpcError PPB_FileIO_SetLength(
-      NaClSrpcChannel* channel,
-      PP_Resource file_io,
-      int64_t length,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_FileIO_Flush(
-      NaClSrpcChannel* channel,
-      PP_Resource file_io,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_FileIO_Close(
-      NaClSrpcChannel* channel,
-      PP_Resource file_io);
-
- private:
-  PpbFileIORpcClient();
-  PpbFileIORpcClient(const PpbFileIORpcClient&);
-  void operator=(const PpbFileIORpcClient);
-};  // class PpbFileIORpcClient
-
-class PpbFileRefRpcClient {
- public:
-  static NaClSrpcError PPB_FileRef_Create(
-      NaClSrpcChannel* channel,
-      PP_Resource file_system,
-      nacl_abi_size_t path_bytes, char* path,
-      PP_Resource* resource);
-  static NaClSrpcError PPB_FileRef_IsFileRef(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* success);
-  static NaClSrpcError PPB_FileRef_GetFileSystemType(
-      NaClSrpcChannel* channel,
-      PP_Resource file_ref,
-      int32_t* file_system_type);
-  static NaClSrpcError PPB_FileRef_GetName(
-      NaClSrpcChannel* channel,
-      PP_Resource file_ref,
-      nacl_abi_size_t* name_bytes, char* name);
-  static NaClSrpcError PPB_FileRef_GetPath(
-      NaClSrpcChannel* channel,
-      PP_Resource file_ref,
-      nacl_abi_size_t* path_bytes, char* path);
-  static NaClSrpcError PPB_FileRef_GetParent(
-      NaClSrpcChannel* channel,
-      PP_Resource file_ref,
-      PP_Resource* parent);
-  static NaClSrpcError PPB_FileRef_MakeDirectory(
-      NaClSrpcChannel* channel,
-      PP_Resource directory_ref,
-      int32_t make_ancestors,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_FileRef_Touch(
-      NaClSrpcChannel* channel,
-      PP_Resource file_ref,
-      double last_access_time,
-      double last_modified_time,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_FileRef_Delete(
-      NaClSrpcChannel* channel,
-      PP_Resource file_ref,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_FileRef_Rename(
-      NaClSrpcChannel* channel,
-      PP_Resource file_ref,
-      PP_Resource new_file_ref,
-      int32_t callback_id,
-      int32_t* pp_error);
-
- private:
-  PpbFileRefRpcClient();
-  PpbFileRefRpcClient(const PpbFileRefRpcClient&);
-  void operator=(const PpbFileRefRpcClient);
-};  // class PpbFileRefRpcClient
-
-class PpbFileSystemRpcClient {
- public:
-  static NaClSrpcError PPB_FileSystem_Create(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t file_system_type,
-      PP_Resource* resource);
-  static NaClSrpcError PPB_FileSystem_IsFileSystem(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* success);
-  static NaClSrpcError PPB_FileSystem_Open(
-      NaClSrpcChannel* channel,
-      PP_Resource file_system,
-      int64_t expected_size,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_FileSystem_GetType(
-      NaClSrpcChannel* channel,
-      PP_Resource file_system,
-      int32_t* type);
-
- private:
-  PpbFileSystemRpcClient();
-  PpbFileSystemRpcClient(const PpbFileSystemRpcClient&);
-  void operator=(const PpbFileSystemRpcClient);
-};  // class PpbFileSystemRpcClient
-
-class PpbFindRpcClient {
- public:
-  static NaClSrpcError PPB_Find_NumberOfFindResultsChanged(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t total,
-      int32_t final_result);
-  static NaClSrpcError PPB_Find_SelectedFindResultChanged(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t index);
-
- private:
-  PpbFindRpcClient();
-  PpbFindRpcClient(const PpbFindRpcClient&);
-  void operator=(const PpbFindRpcClient);
-};  // class PpbFindRpcClient
-
-class PpbFontRpcClient {
- public:
-  static NaClSrpcError PPB_Font_GetFontFamilies(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      nacl_abi_size_t* font_families_bytes, char* font_families);
-  static NaClSrpcError PPB_Font_Create(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      nacl_abi_size_t description_bytes, char* description,
-      nacl_abi_size_t face_bytes, char* face,
-      PP_Resource* font);
-  static NaClSrpcError PPB_Font_IsFont(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* is_font);
-  static NaClSrpcError PPB_Font_Describe(
-      NaClSrpcChannel* channel,
-      PP_Resource font,
-      nacl_abi_size_t* description_bytes, char* description,
-      nacl_abi_size_t* face_bytes, char* face,
-      nacl_abi_size_t* metrics_bytes, char* metrics,
-      int32_t* success);
-  static NaClSrpcError PPB_Font_DrawTextAt(
-      NaClSrpcChannel* channel,
-      PP_Resource font,
-      PP_Resource image_data,
-      nacl_abi_size_t text_run_bytes, char* text_run,
-      nacl_abi_size_t text_bytes, char* text,
-      nacl_abi_size_t position_bytes, char* position,
-      int32_t color,
-      nacl_abi_size_t clip_bytes, char* clip,
-      int32_t image_data_is_opaque,
-      int32_t* success);
-  static NaClSrpcError PPB_Font_MeasureText(
-      NaClSrpcChannel* channel,
-      PP_Resource font,
-      nacl_abi_size_t text_run_bytes, char* text_run,
-      nacl_abi_size_t text_bytes, char* text,
-      int32_t* width);
-  static NaClSrpcError PPB_Font_CharacterOffsetForPixel(
-      NaClSrpcChannel* channel,
-      PP_Resource font,
-      nacl_abi_size_t text_run_bytes, char* text_run,
-      nacl_abi_size_t text_bytes, char* text,
-      int32_t pixel_position,
-      int32_t* offset);
-  static NaClSrpcError PPB_Font_PixelOffsetForCharacter(
-      NaClSrpcChannel* channel,
-      PP_Resource font,
-      nacl_abi_size_t text_run_bytes, char* text_run,
-      nacl_abi_size_t text_bytes, char* text,
-      int32_t char_offset,
-      int32_t* offset);
-
- private:
-  PpbFontRpcClient();
-  PpbFontRpcClient(const PpbFontRpcClient&);
-  void operator=(const PpbFontRpcClient);
-};  // class PpbFontRpcClient
-
-class PpbFullscreenRpcClient {
- public:
-  static NaClSrpcError PPB_Fullscreen_SetFullscreen(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t fullscreen,
-      int32_t* success);
-  static NaClSrpcError PPB_Fullscreen_GetScreenSize(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      nacl_abi_size_t* size_bytes, char* size,
-      int32_t* success);
-
- private:
-  PpbFullscreenRpcClient();
-  PpbFullscreenRpcClient(const PpbFullscreenRpcClient&);
-  void operator=(const PpbFullscreenRpcClient);
-};  // class PpbFullscreenRpcClient
-
-class PpbGamepadRpcClient {
- public:
-  static NaClSrpcError PPB_Gamepad_Sample(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      nacl_abi_size_t* data_bytes, char* data);
-
- private:
-  PpbGamepadRpcClient();
-  PpbGamepadRpcClient(const PpbGamepadRpcClient&);
-  void operator=(const PpbGamepadRpcClient);
-};  // class PpbGamepadRpcClient
-
-class PpbGraphics2DRpcClient {
- public:
-  static NaClSrpcError PPB_Graphics2D_Create(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      nacl_abi_size_t size_bytes, char* size,
-      int32_t is_always_opaque,
-      PP_Resource* resource);
-  static NaClSrpcError PPB_Graphics2D_IsGraphics2D(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* success);
-  static NaClSrpcError PPB_Graphics2D_Describe(
-      NaClSrpcChannel* channel,
-      PP_Resource graphics_2d,
-      nacl_abi_size_t* size_bytes, char* size,
-      int32_t* is_always_opaque,
-      int32_t* success);
-  static NaClSrpcError PPB_Graphics2D_PaintImageData(
-      NaClSrpcChannel* channel,
-      PP_Resource graphics_2d,
-      PP_Resource image,
-      nacl_abi_size_t top_left_bytes, char* top_left,
-      nacl_abi_size_t src_rect_bytes, char* src_rect);
-  static NaClSrpcError PPB_Graphics2D_Scroll(
-      NaClSrpcChannel* channel,
-      PP_Resource graphics_2d,
-      nacl_abi_size_t clip_rect_bytes, char* clip_rect,
-      nacl_abi_size_t amount_bytes, char* amount);
-  static NaClSrpcError PPB_Graphics2D_ReplaceContents(
-      NaClSrpcChannel* channel,
-      PP_Resource graphics_2d,
-      PP_Resource image);
-  static NaClSrpcError PPB_Graphics2D_Flush(
-      NaClSrpcChannel* channel,
-      PP_Resource graphics_2d,
-      int32_t callback_id,
-      int32_t* pp_error);
-
- private:
-  PpbGraphics2DRpcClient();
-  PpbGraphics2DRpcClient(const PpbGraphics2DRpcClient&);
-  void operator=(const PpbGraphics2DRpcClient);
-};  // class PpbGraphics2DRpcClient
-
-class PpbGraphics3DRpcClient {
- public:
-  static NaClSrpcError PPB_Graphics3D_GetAttribMaxValue(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t attribute,
-      int32_t* value,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_Graphics3D_Create(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource share_context,
-      nacl_abi_size_t attrib_list_bytes, int32_t* attrib_list,
-      PP_Resource* resource_id);
-  static NaClSrpcError PPB_Graphics3D_GetAttribs(
-      NaClSrpcChannel* channel,
-      PP_Resource context,
-      nacl_abi_size_t input_attrib_list_bytes, int32_t* input_attrib_list,
-      nacl_abi_size_t* output_attrib_list_bytes, int32_t* output_attrib_list,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_Graphics3D_SetAttribs(
-      NaClSrpcChannel* channel,
-      PP_Resource context,
-      nacl_abi_size_t attrib_list_bytes, int32_t* attrib_list,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_Graphics3D_GetError(
-      NaClSrpcChannel* channel,
-      PP_Resource context,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_Graphics3D_SwapBuffers(
-      NaClSrpcChannel* channel,
-      PP_Resource context,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_Graphics3DTrusted_CreateRaw(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource share_context,
-      nacl_abi_size_t attrib_list_bytes, int32_t* attrib_list,
-      PP_Resource* resource_id);
-  static NaClSrpcError PPB_Graphics3DTrusted_InitCommandBuffer(
-      NaClSrpcChannel* channel,
-      PP_Resource resource_id,
-      int32_t* success);
-  static NaClSrpcError PPB_Graphics3DTrusted_SetGetBuffer(
-      NaClSrpcChannel* channel,
-      PP_Resource resource_id,
-      int32_t shm_id);
-  static NaClSrpcError PPB_Graphics3DTrusted_GetState(
-      NaClSrpcChannel* channel,
-      PP_Resource resource_id,
-      nacl_abi_size_t* state_bytes, char* state);
-  static NaClSrpcError PPB_Graphics3DTrusted_Flush(
-      NaClSrpcChannel* channel,
-      PP_Resource resource_id,
-      int32_t put_offset);
-  static NaClSrpcError PPB_Graphics3DTrusted_FlushSync(
-      NaClSrpcChannel* channel,
-      PP_Resource resource_id,
-      int32_t put_offset,
-      nacl_abi_size_t* state_bytes, char* state);
-  static NaClSrpcError PPB_Graphics3DTrusted_FlushSyncFast(
-      NaClSrpcChannel* channel,
-      PP_Resource resource_id,
-      int32_t put_offset,
-      int32_t last_known_offset,
-      nacl_abi_size_t* state_bytes, char* state);
-  static NaClSrpcError PPB_Graphics3DTrusted_CreateTransferBuffer(
-      NaClSrpcChannel* channel,
-      PP_Resource resource_id,
-      int32_t size,
-      int32_t request_id,
-      int32_t* id);
-  static NaClSrpcError PPB_Graphics3DTrusted_DestroyTransferBuffer(
-      NaClSrpcChannel* channel,
-      PP_Resource resource_id,
-      int32_t id);
-  static NaClSrpcError PPB_Graphics3DTrusted_GetTransferBuffer(
-      NaClSrpcChannel* channel,
-      PP_Resource resource_id,
-      int32_t id,
-      NaClSrpcImcDescType* shm_desc,
-      int32_t* shm_size);
-
- private:
-  PpbGraphics3DRpcClient();
-  PpbGraphics3DRpcClient(const PpbGraphics3DRpcClient&);
-  void operator=(const PpbGraphics3DRpcClient);
-};  // class PpbGraphics3DRpcClient
-
-class PpbHostResolverPrivateRpcClient {
- public:
-  static NaClSrpcError PPB_HostResolver_Private_Create(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource* resource);
-  static NaClSrpcError PPB_HostResolver_Private_IsHostResolver(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* is_host_resolver);
-  static NaClSrpcError PPB_HostResolver_Private_Resolve(
-      NaClSrpcChannel* channel,
-      PP_Resource host_resolver,
-      const char* host,
-      int32_t port,
-      nacl_abi_size_t hint_bytes, char* hint,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_HostResolver_Private_GetCanonicalName(
-      NaClSrpcChannel* channel,
-      PP_Resource host_resolver,
-      nacl_abi_size_t* canonical_name_bytes, char* canonical_name);
-  static NaClSrpcError PPB_HostResolver_Private_GetSize(
-      NaClSrpcChannel* channel,
-      PP_Resource host_resolver,
-      int32_t* size);
-  static NaClSrpcError PPB_HostResolver_Private_GetNetAddress(
-      NaClSrpcChannel* channel,
-      PP_Resource host_resolver,
-      int32_t index,
-      nacl_abi_size_t* addr_bytes, char* addr,
-      int32_t* success);
-
- private:
-  PpbHostResolverPrivateRpcClient();
-  PpbHostResolverPrivateRpcClient(const PpbHostResolverPrivateRpcClient&);
-  void operator=(const PpbHostResolverPrivateRpcClient);
-};  // class PpbHostResolverPrivateRpcClient
-
-class PpbImageDataRpcClient {
- public:
-  static NaClSrpcError PPB_ImageData_GetNativeImageDataFormat(
-      NaClSrpcChannel* channel,
-      int32_t* format);
-  static NaClSrpcError PPB_ImageData_IsImageDataFormatSupported(
-      NaClSrpcChannel* channel,
-      int32_t format,
-      int32_t* success);
-  static NaClSrpcError PPB_ImageData_Create(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t format,
-      nacl_abi_size_t size_bytes, char* size,
-      int32_t init_to_zero,
-      PP_Resource* resource);
-  static NaClSrpcError PPB_ImageData_IsImageData(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* success);
-  static NaClSrpcError PPB_ImageData_Describe(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      nacl_abi_size_t* desc_bytes, char* desc,
-      NaClSrpcImcDescType* shm,
-      int32_t* shm_size,
-      int32_t* success);
-
- private:
-  PpbImageDataRpcClient();
-  PpbImageDataRpcClient(const PpbImageDataRpcClient&);
-  void operator=(const PpbImageDataRpcClient);
-};  // class PpbImageDataRpcClient
-
-class PpbInputEventRpcClient {
- public:
-  static NaClSrpcError PPB_InputEvent_RequestInputEvents(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t event_classes,
-      int32_t filtered,
-      int32_t* success);
-  static NaClSrpcError PPB_InputEvent_ClearInputEventRequest(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t event_classes);
-  static NaClSrpcError PPB_InputEvent_CreateMouseInputEvent(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t type,
-      double time_stamp,
-      int32_t modifiers,
-      int32_t mouse_button,
-      int32_t mouse_position_x,
-      int32_t mouse_position_y,
-      int32_t click_count,
-      int32_t mouse_movement_x,
-      int32_t mouse_movement_y,
-      PP_Resource* resource_id);
-  static NaClSrpcError PPB_InputEvent_CreateWheelInputEvent(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      double time_stamp,
-      int32_t modifiers,
-      double wheel_delta_x,
-      double wheel_delta_y,
-      double wheel_ticks_x,
-      double wheel_ticks_y,
-      int32_t scroll_by_page,
-      PP_Resource* resource_id);
-  static NaClSrpcError PPB_InputEvent_CreateKeyboardInputEvent(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t type,
-      double time_stamp,
-      int32_t modifiers,
-      int32_t key_code,
-      nacl_abi_size_t character_text_bytes, char* character_text,
-      PP_Resource* resource_id);
-
- private:
-  PpbInputEventRpcClient();
-  PpbInputEventRpcClient(const PpbInputEventRpcClient&);
-  void operator=(const PpbInputEventRpcClient);
-};  // class PpbInputEventRpcClient
-
-class PpbInstanceRpcClient {
- public:
-  static NaClSrpcError PPB_Instance_BindGraphics(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource graphics_device,
-      int32_t* success);
-  static NaClSrpcError PPB_Instance_IsFullFrame(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t* is_full_frame);
-
- private:
-  PpbInstanceRpcClient();
-  PpbInstanceRpcClient(const PpbInstanceRpcClient&);
-  void operator=(const PpbInstanceRpcClient);
-};  // class PpbInstanceRpcClient
-
-class PpbMessagingRpcClient {
- public:
-  static NaClSrpcError PPB_Messaging_PostMessage(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      nacl_abi_size_t message_bytes, char* message);
-
- private:
-  PpbMessagingRpcClient();
-  PpbMessagingRpcClient(const PpbMessagingRpcClient&);
-  void operator=(const PpbMessagingRpcClient);
-};  // class PpbMessagingRpcClient
-
-class PpbMouseCursorRpcClient {
- public:
-  static NaClSrpcError PPB_MouseCursor_SetCursor(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t type,
-      PP_Resource custom_image,
-      nacl_abi_size_t hot_spot_bytes, char* hot_spot,
-      int32_t* success);
-
- private:
-  PpbMouseCursorRpcClient();
-  PpbMouseCursorRpcClient(const PpbMouseCursorRpcClient&);
-  void operator=(const PpbMouseCursorRpcClient);
-};  // class PpbMouseCursorRpcClient
-
-class PpbMouseLockRpcClient {
- public:
-  static NaClSrpcError PPB_MouseLock_LockMouse(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_MouseLock_UnlockMouse(
-      NaClSrpcChannel* channel,
-      PP_Instance instance);
-
- private:
-  PpbMouseLockRpcClient();
-  PpbMouseLockRpcClient(const PpbMouseLockRpcClient&);
-  void operator=(const PpbMouseLockRpcClient);
-};  // class PpbMouseLockRpcClient
-
-class PpbNetAddressPrivateRpcClient {
- public:
-  static NaClSrpcError PPB_NetAddress_Private_AreEqual(
-      NaClSrpcChannel* channel,
-      nacl_abi_size_t addr1_bytes, char* addr1,
-      nacl_abi_size_t addr2_bytes, char* addr2,
-      int32_t* equals);
-  static NaClSrpcError PPB_NetAddress_Private_AreHostsEqual(
-      NaClSrpcChannel* channel,
-      nacl_abi_size_t addr1_bytes, char* addr1,
-      nacl_abi_size_t addr2_bytes, char* addr2,
-      int32_t* equals);
-  static NaClSrpcError PPB_NetAddress_Private_Describe(
-      NaClSrpcChannel* channel,
-      int32_t module,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t include_port,
-      nacl_abi_size_t* description_bytes, char* description);
-  static NaClSrpcError PPB_NetAddress_Private_ReplacePort(
-      NaClSrpcChannel* channel,
-      nacl_abi_size_t src_addr_bytes, char* src_addr,
-      int32_t port,
-      nacl_abi_size_t* dst_addr_bytes, char* dst_addr,
-      int32_t* success);
-  static NaClSrpcError PPB_NetAddress_Private_GetAnyAddress(
-      NaClSrpcChannel* channel,
-      int32_t is_ipv6,
-      nacl_abi_size_t* addr_bytes, char* addr);
-  static NaClSrpcError PPB_NetAddress_Private_GetFamily(
-      NaClSrpcChannel* channel,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t* addr_family);
-  static NaClSrpcError PPB_NetAddress_Private_GetPort(
-      NaClSrpcChannel* channel,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t* port);
-  static NaClSrpcError PPB_NetAddress_Private_GetAddress(
-      NaClSrpcChannel* channel,
-      nacl_abi_size_t addr_bytes, char* addr,
-      nacl_abi_size_t* address_bytes, char* address,
-      int32_t* success);
-  static NaClSrpcError PPB_NetAddress_Private_GetScopeID(
-      NaClSrpcChannel* channel,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t* scope_id);
-  static NaClSrpcError PPB_NetAddress_Private_CreateFromIPv4Address(
-      NaClSrpcChannel* channel,
-      nacl_abi_size_t ip_bytes, char* ip,
-      int32_t port,
-      nacl_abi_size_t* addr_bytes, char* addr);
-  static NaClSrpcError PPB_NetAddress_Private_CreateFromIPv6Address(
-      NaClSrpcChannel* channel,
-      nacl_abi_size_t ip_bytes, char* ip,
-      int32_t scope_id,
-      int32_t port,
-      nacl_abi_size_t* addr_bytes, char* addr);
-
- private:
-  PpbNetAddressPrivateRpcClient();
-  PpbNetAddressPrivateRpcClient(const PpbNetAddressPrivateRpcClient&);
-  void operator=(const PpbNetAddressPrivateRpcClient);
-};  // class PpbNetAddressPrivateRpcClient
-
-class PpbNetworkListPrivateClient {
- public:
-  static NaClSrpcError PPB_NetworkList_Private_IsNetworkList(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* out_bool);
-  static NaClSrpcError PPB_NetworkList_Private_GetCount(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* count);
-  static NaClSrpcError PPB_NetworkList_Private_GetName(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t index,
-      nacl_abi_size_t* name_bytes, char* name);
-  static NaClSrpcError PPB_NetworkList_Private_GetType(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t index,
-      int32_t* type);
-  static NaClSrpcError PPB_NetworkList_Private_GetState(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t index,
-      int32_t* state);
-  static NaClSrpcError PPB_NetworkList_Private_GetIpAddresses(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t index,
-      nacl_abi_size_t* addr_bytes, char* addr,
-      int32_t* addresses_count);
-  static NaClSrpcError PPB_NetworkList_Private_GetDisplayName(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t index,
-      nacl_abi_size_t* display_name_bytes, char* display_name);
-  static NaClSrpcError PPB_NetworkList_Private_GetMTU(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t index,
-      int32_t* mtu);
-
- private:
-  PpbNetworkListPrivateClient();
-  PpbNetworkListPrivateClient(const PpbNetworkListPrivateClient&);
-  void operator=(const PpbNetworkListPrivateClient);
-};  // class PpbNetworkListPrivateClient
-
-class PpbNetworkMonitorPrivateClient {
- public:
-  static NaClSrpcError PPB_NetworkMonitor_Private_Create(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource* out_resource);
-  static NaClSrpcError PPB_NetworkMonitor_Private_IsNetworkMonitor(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* out_bool);
-
- private:
-  PpbNetworkMonitorPrivateClient();
-  PpbNetworkMonitorPrivateClient(const PpbNetworkMonitorPrivateClient&);
-  void operator=(const PpbNetworkMonitorPrivateClient);
-};  // class PpbNetworkMonitorPrivateClient
-
-class PpbTCPServerSocketPrivateRpcClient {
- public:
-  static NaClSrpcError PPB_TCPServerSocket_Private_Create(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource* resource);
-  static NaClSrpcError PPB_TCPServerSocket_Private_IsTCPServerSocket(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* is_tcp_server_socket);
-  static NaClSrpcError PPB_TCPServerSocket_Private_Listen(
-      NaClSrpcChannel* channel,
-      PP_Resource tcp_server_socket,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t backlog,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_TCPServerSocket_Private_Accept(
-      NaClSrpcChannel* channel,
-      PP_Resource tcp_server_socket,
-      int32_t callback_id,
-      PP_Resource* tcp_socket,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_TCPServerSocket_Private_StopListening(
-      NaClSrpcChannel* channel,
-      PP_Resource tcp_server_socket);
-
- private:
-  PpbTCPServerSocketPrivateRpcClient();
-  PpbTCPServerSocketPrivateRpcClient(const PpbTCPServerSocketPrivateRpcClient&);
-  void operator=(const PpbTCPServerSocketPrivateRpcClient);
-};  // class PpbTCPServerSocketPrivateRpcClient
-
-class PpbTCPSocketPrivateRpcClient {
- public:
-  static NaClSrpcError PPB_TCPSocket_Private_Create(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource* resource);
-  static NaClSrpcError PPB_TCPSocket_Private_IsTCPSocket(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* is_tcp_socket);
-  static NaClSrpcError PPB_TCPSocket_Private_Connect(
-      NaClSrpcChannel* channel,
-      PP_Resource tcp_socket,
-      const char* host,
-      int32_t port,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_TCPSocket_Private_ConnectWithNetAddress(
-      NaClSrpcChannel* channel,
-      PP_Resource tcp_socket,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_TCPSocket_Private_GetLocalAddress(
-      NaClSrpcChannel* channel,
-      PP_Resource tcp_socket,
-      nacl_abi_size_t* local_addr_bytes, char* local_addr,
-      int32_t* success);
-  static NaClSrpcError PPB_TCPSocket_Private_GetRemoteAddress(
-      NaClSrpcChannel* channel,
-      PP_Resource tcp_socket,
-      nacl_abi_size_t* remote_addr_bytes, char* remote_addr,
-      int32_t* success);
-  static NaClSrpcError PPB_TCPSocket_Private_SSLHandshake(
-      NaClSrpcChannel* channel,
-      PP_Resource tcp_socket,
-      const char* server_name,
-      int32_t server_port,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_TCPSocket_Private_Read(
-      NaClSrpcChannel* channel,
-      PP_Resource tcp_socket,
-      int32_t bytes_to_read,
-      int32_t callback_id,
-      nacl_abi_size_t* buffer_bytes, char* buffer,
-      int32_t* pp_error_or_bytes);
-  static NaClSrpcError PPB_TCPSocket_Private_Write(
-      NaClSrpcChannel* channel,
-      PP_Resource tcp_socket,
-      nacl_abi_size_t buffer_bytes, char* buffer,
-      int32_t bytes_to_write,
-      int32_t callback_id,
-      int32_t* pp_error_or_bytes);
-  static NaClSrpcError PPB_TCPSocket_Private_Disconnect(
-      NaClSrpcChannel* channel,
-      PP_Resource tcp_socket);
-
- private:
-  PpbTCPSocketPrivateRpcClient();
-  PpbTCPSocketPrivateRpcClient(const PpbTCPSocketPrivateRpcClient&);
-  void operator=(const PpbTCPSocketPrivateRpcClient);
-};  // class PpbTCPSocketPrivateRpcClient
-
-class PpbTestingRpcClient {
- public:
-  static NaClSrpcError PPB_Testing_ReadImageData(
-      NaClSrpcChannel* channel,
-      PP_Resource device_context_2d,
-      PP_Resource image,
-      nacl_abi_size_t top_left_bytes, char* top_left,
-      int32_t* success);
-  static NaClSrpcError PPB_Testing_RunMessageLoop(
-      NaClSrpcChannel* channel,
-      PP_Instance instance);
-  static NaClSrpcError PPB_Testing_QuitMessageLoop(
-      NaClSrpcChannel* channel,
-      PP_Instance instance);
-  static NaClSrpcError PPB_Testing_GetLiveObjectsForInstance(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      int32_t* live_object_count);
-  static NaClSrpcError PPB_Testing_SimulateInputEvent(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource input_event);
-  static NaClSrpcError PPB_Testing_GetDocumentURL(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      nacl_abi_size_t* components_bytes, char* components,
-      nacl_abi_size_t* url_bytes, char* url);
-
- private:
-  PpbTestingRpcClient();
-  PpbTestingRpcClient(const PpbTestingRpcClient&);
-  void operator=(const PpbTestingRpcClient);
-};  // class PpbTestingRpcClient
-
-class PpbUDPSocketPrivateRpcClient {
- public:
-  static NaClSrpcError PPB_UDPSocket_Private_Create(
-      NaClSrpcChannel* channel,
-      PP_Instance instance_id,
-      PP_Resource* resource);
-  static NaClSrpcError PPB_UDPSocket_Private_IsUDPSocket(
-      NaClSrpcChannel* channel,
-      PP_Resource resource_id,
-      int32_t* is_udp_socket_private);
-  static NaClSrpcError PPB_UDPSocket_Private_SetSocketFeature(
-      NaClSrpcChannel* channel,
-      PP_Resource udp_socket,
-      int32_t name,
-      nacl_abi_size_t value_bytes, char* value,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_UDPSocket_Private_Bind(
-      NaClSrpcChannel* channel,
-      PP_Resource udp_socket,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_UDPSocket_Private_GetBoundAddress(
-      NaClSrpcChannel* channel,
-      PP_Resource udp_socket,
-      nacl_abi_size_t* addr_bytes, char* addr,
-      int32_t* success);
-  static NaClSrpcError PPB_UDPSocket_Private_RecvFrom(
-      NaClSrpcChannel* channel,
-      PP_Resource udp_socket,
-      int32_t num_bytes,
-      int32_t callback_id,
-      nacl_abi_size_t* buffer_bytes, char* buffer,
-      int32_t* pp_error_or_bytes);
-  static NaClSrpcError PPB_UDPSocket_Private_GetRecvFromAddress(
-      NaClSrpcChannel* channel,
-      PP_Resource udp_socket,
-      nacl_abi_size_t* addr_bytes, char* addr,
-      int32_t* success);
-  static NaClSrpcError PPB_UDPSocket_Private_SendTo(
-      NaClSrpcChannel* channel,
-      PP_Resource udp_socket,
-      nacl_abi_size_t buffer_bytes, char* buffer,
-      int32_t num_bytes,
-      nacl_abi_size_t addr_bytes, char* addr,
-      int32_t callback_id,
-      int32_t* pp_error_or_bytes);
-  static NaClSrpcError PPB_UDPSocket_Private_Close(
-      NaClSrpcChannel* channel,
-      PP_Resource udp_socket);
-
- private:
-  PpbUDPSocketPrivateRpcClient();
-  PpbUDPSocketPrivateRpcClient(const PpbUDPSocketPrivateRpcClient&);
-  void operator=(const PpbUDPSocketPrivateRpcClient);
-};  // class PpbUDPSocketPrivateRpcClient
-
-class PpbURLLoaderRpcClient {
- public:
-  static NaClSrpcError PPB_URLLoader_Create(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource* resource);
-  static NaClSrpcError PPB_URLLoader_IsURLLoader(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* is_url_loader);
-  static NaClSrpcError PPB_URLLoader_Open(
-      NaClSrpcChannel* channel,
-      PP_Resource loader,
-      PP_Resource request,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_URLLoader_FollowRedirect(
-      NaClSrpcChannel* channel,
-      PP_Resource loader,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_URLLoader_GetUploadProgress(
-      NaClSrpcChannel* channel,
-      PP_Resource loader,
-      int64_t* bytes_sent,
-      int64_t* total_bytes_to_be_sent,
-      int32_t* success);
-  static NaClSrpcError PPB_URLLoader_GetDownloadProgress(
-      NaClSrpcChannel* channel,
-      PP_Resource loader,
-      int64_t* bytes_received,
-      int64_t* total_bytes_to_be_received,
-      int32_t* success);
-  static NaClSrpcError PPB_URLLoader_GetResponseInfo(
-      NaClSrpcChannel* channel,
-      PP_Resource loader,
-      PP_Resource* response);
-  static NaClSrpcError PPB_URLLoader_ReadResponseBody(
-      NaClSrpcChannel* channel,
-      PP_Resource loader,
-      int32_t bytes_to_read,
-      int32_t callback_id,
-      nacl_abi_size_t* buffer_bytes, char* buffer,
-      int32_t* pp_error_or_bytes);
-  static NaClSrpcError PPB_URLLoader_FinishStreamingToFile(
-      NaClSrpcChannel* channel,
-      PP_Resource loader,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_URLLoader_Close(
-      NaClSrpcChannel* channel,
-      PP_Resource loader);
-
- private:
-  PpbURLLoaderRpcClient();
-  PpbURLLoaderRpcClient(const PpbURLLoaderRpcClient&);
-  void operator=(const PpbURLLoaderRpcClient);
-};  // class PpbURLLoaderRpcClient
-
-class PpbURLRequestInfoRpcClient {
- public:
-  static NaClSrpcError PPB_URLRequestInfo_Create(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource* resource);
-  static NaClSrpcError PPB_URLRequestInfo_IsURLRequestInfo(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* success);
-  static NaClSrpcError PPB_URLRequestInfo_SetProperty(
-      NaClSrpcChannel* channel,
-      PP_Resource request,
-      int32_t property,
-      nacl_abi_size_t value_bytes, char* value,
-      int32_t* success);
-  static NaClSrpcError PPB_URLRequestInfo_AppendDataToBody(
-      NaClSrpcChannel* channel,
-      PP_Resource request,
-      nacl_abi_size_t data_bytes, char* data,
-      int32_t* success);
-  static NaClSrpcError PPB_URLRequestInfo_AppendFileToBody(
-      NaClSrpcChannel* channel,
-      PP_Resource request,
-      PP_Resource file_ref,
-      int64_t start_offset,
-      int64_t number_of_bytes,
-      double expected_last_modified_time,
-      int32_t* success);
-
- private:
-  PpbURLRequestInfoRpcClient();
-  PpbURLRequestInfoRpcClient(const PpbURLRequestInfoRpcClient&);
-  void operator=(const PpbURLRequestInfoRpcClient);
-};  // class PpbURLRequestInfoRpcClient
-
-class PpbURLResponseInfoRpcClient {
- public:
-  static NaClSrpcError PPB_URLResponseInfo_IsURLResponseInfo(
-      NaClSrpcChannel* channel,
-      PP_Resource resource,
-      int32_t* success);
-  static NaClSrpcError PPB_URLResponseInfo_GetProperty(
-      NaClSrpcChannel* channel,
-      PP_Resource response,
-      int32_t property,
-      nacl_abi_size_t* value_bytes, char* value);
-  static NaClSrpcError PPB_URLResponseInfo_GetBodyAsFileRef(
-      NaClSrpcChannel* channel,
-      PP_Resource response,
-      PP_Resource* file_ref);
-
- private:
-  PpbURLResponseInfoRpcClient();
-  PpbURLResponseInfoRpcClient(const PpbURLResponseInfoRpcClient&);
-  void operator=(const PpbURLResponseInfoRpcClient);
-};  // class PpbURLResponseInfoRpcClient
-
-class PpbWebSocketRpcClient {
- public:
-  static NaClSrpcError PPB_WebSocket_Create(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      PP_Resource* resource);
-  static NaClSrpcError PPB_WebSocket_IsWebSocket(
-      NaClSrpcChannel* channel,
-      PP_Resource instance,
-      int32_t* is_websocket);
-  static NaClSrpcError PPB_WebSocket_Connect(
-      NaClSrpcChannel* channel,
-      PP_Resource ws,
-      nacl_abi_size_t url_bytes, char* url,
-      nacl_abi_size_t protocols_bytes, char* protocols,
-      int32_t protocol_count,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_WebSocket_Close(
-      NaClSrpcChannel* channel,
-      PP_Resource ws,
-      int32_t code,
-      nacl_abi_size_t reason_bytes, char* reason,
-      int32_t callback_id,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_WebSocket_ReceiveMessage(
-      NaClSrpcChannel* channel,
-      PP_Resource ws,
-      int32_t callback_id,
-      int32_t* pp_error,
-      nacl_abi_size_t* sync_read_buffer_bytes, char* sync_read_buffer);
-  static NaClSrpcError PPB_WebSocket_SendMessage(
-      NaClSrpcChannel* channel,
-      PP_Resource ws,
-      nacl_abi_size_t message_bytes, char* message,
-      int32_t* pp_error);
-  static NaClSrpcError PPB_WebSocket_GetBufferedAmount(
-      NaClSrpcChannel* channel,
-      PP_Resource ws,
-      int64_t* buffered_amount);
-  static NaClSrpcError PPB_WebSocket_GetCloseCode(
-      NaClSrpcChannel* channel,
-      PP_Resource ws,
-      int32_t* close_code);
-  static NaClSrpcError PPB_WebSocket_GetCloseReason(
-      NaClSrpcChannel* channel,
-      PP_Resource ws,
-      nacl_abi_size_t* reason_bytes, char* reason);
-  static NaClSrpcError PPB_WebSocket_GetCloseWasClean(
-      NaClSrpcChannel* channel,
-      PP_Resource ws,
-      int32_t* was_clean);
-  static NaClSrpcError PPB_WebSocket_GetExtensions(
-      NaClSrpcChannel* channel,
-      PP_Resource ws,
-      nacl_abi_size_t* extensions_bytes, char* extensions);
-  static NaClSrpcError PPB_WebSocket_GetProtocol(
-      NaClSrpcChannel* channel,
-      PP_Resource ws,
-      nacl_abi_size_t* protocol_bytes, char* protocol);
-  static NaClSrpcError PPB_WebSocket_GetReadyState(
-      NaClSrpcChannel* channel,
-      PP_Resource ws,
-      int32_t* ready_state);
-  static NaClSrpcError PPB_WebSocket_GetURL(
-      NaClSrpcChannel* channel,
-      PP_Resource ws,
-      nacl_abi_size_t* url_bytes, char* url);
-
- private:
-  PpbWebSocketRpcClient();
-  PpbWebSocketRpcClient(const PpbWebSocketRpcClient&);
-  void operator=(const PpbWebSocketRpcClient);
-};  // class PpbWebSocketRpcClient
-
-class PpbZoomRpcClient {
- public:
-  static NaClSrpcError PPB_Zoom_ZoomChanged(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      double factor);
-  static NaClSrpcError PPB_Zoom_ZoomLimitsChanged(
-      NaClSrpcChannel* channel,
-      PP_Instance instance,
-      double minimum_factor,
-      double maximum_factor);
-
- private:
-  PpbZoomRpcClient();
-  PpbZoomRpcClient(const PpbZoomRpcClient&);
-  void operator=(const PpbZoomRpcClient);
-};  // class PpbZoomRpcClient
-
-
-
-
-#endif  // GEN_PPAPI_PROXY_PPB_RPC_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h b/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h
deleted file mode 100644
index 6be502b..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h
+++ /dev/null
@@ -1,271 +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.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// Automatically generated code.  See srpcgen.py
-//
-// NaCl Simple Remote Procedure Call interface abstractions.
-
-#ifndef GEN_PPAPI_PROXY_PPP_RPC_H_
-#define GEN_PPAPI_PROXY_PPP_RPC_H_
-
-#ifndef __native_client__
-#include "native_client/src/include/portability.h"
-#endif  // __native_client__
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-
-class CompletionCallbackRpcServer {
- public:
-  static void RunCompletionCallback(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      int32_t callback_id,
-      int32_t result,
-      nacl_abi_size_t read_buffer_bytes, char* read_buffer);
-
- private:
-  CompletionCallbackRpcServer();
-  CompletionCallbackRpcServer(const CompletionCallbackRpcServer&);
-  void operator=(const CompletionCallbackRpcServer);
-};  // class CompletionCallbackRpcServer
-
-class PppRpcServer {
- public:
-  static void PPP_InitializeModule(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Module module,
-      NaClSrpcImcDescType upcall_channel_desc,
-      const char* service_description,
-      int32_t* success);
-  static void PPP_ShutdownModule(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done);
-  static void PPP_GetInterface(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      const char* interface_name,
-      int32_t* exports_interface_name);
-
- private:
-  PppRpcServer();
-  PppRpcServer(const PppRpcServer&);
-  void operator=(const PppRpcServer);
-};  // class PppRpcServer
-
-class PppAudioRpcServer {
- public:
-  static void PPP_Audio_StreamCreated(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      NaClSrpcImcDescType out_shm,
-      int32_t out_shm_size,
-      NaClSrpcImcDescType out_socket);
-
- private:
-  PppAudioRpcServer();
-  PppAudioRpcServer(const PppAudioRpcServer&);
-  void operator=(const PppAudioRpcServer);
-};  // class PppAudioRpcServer
-
-class PppFindRpcServer {
- public:
-  static void PPP_Find_StartFind(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      nacl_abi_size_t text_bytes, char* text,
-      int32_t case_sensitive,
-      int32_t* supports_find);
-  static void PPP_Find_SelectFindResult(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t forward);
-  static void PPP_Find_StopFind(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance);
-
- private:
-  PppFindRpcServer();
-  PppFindRpcServer(const PppFindRpcServer&);
-  void operator=(const PppFindRpcServer);
-};  // class PppFindRpcServer
-
-class PppInputEventRpcServer {
- public:
-  static void PPP_InputEvent_HandleInputEvent(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource resource,
-      nacl_abi_size_t event_data_bytes, char* event_data,
-      nacl_abi_size_t character_text_bytes, char* character_text,
-      int32_t* handled);
-
- private:
-  PppInputEventRpcServer();
-  PppInputEventRpcServer(const PppInputEventRpcServer&);
-  void operator=(const PppInputEventRpcServer);
-};  // class PppInputEventRpcServer
-
-class PppInstanceRpcServer {
- public:
-  static void PPP_Instance_DidCreate(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t argc,
-      nacl_abi_size_t argn_bytes, char* argn,
-      nacl_abi_size_t argv_bytes, char* argv,
-      int32_t* success);
-  static void PPP_Instance_DidDestroy(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance);
-  static void PPP_Instance_DidChangeView(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource resource,
-      nacl_abi_size_t view_data_bytes, char* view_data);
-  static void PPP_Instance_DidChangeFocus(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      bool has_focus);
-  static void PPP_Instance_HandleDocumentLoad(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      PP_Resource url_loader,
-      int32_t* success);
-
- private:
-  PppInstanceRpcServer();
-  PppInstanceRpcServer(const PppInstanceRpcServer&);
-  void operator=(const PppInstanceRpcServer);
-};  // class PppInstanceRpcServer
-
-class PppMessagingRpcServer {
- public:
-  static void PPP_Messaging_HandleMessage(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      nacl_abi_size_t message_bytes, char* message);
-
- private:
-  PppMessagingRpcServer();
-  PppMessagingRpcServer(const PppMessagingRpcServer&);
-  void operator=(const PppMessagingRpcServer);
-};  // class PppMessagingRpcServer
-
-class PppMouseLockRpcServer {
- public:
-  static void PPP_MouseLock_MouseLockLost(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance);
-
- private:
-  PppMouseLockRpcServer();
-  PppMouseLockRpcServer(const PppMouseLockRpcServer&);
-  void operator=(const PppMouseLockRpcServer);
-};  // class PppMouseLockRpcServer
-
-class PppNetworkMonitorPrivateRpcServer {
- public:
-  static void PPP_NetworkMonitor_Private_NetworkListChanged(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Resource network_monitor,
-      PP_Resource network_list);
-
- private:
-  PppNetworkMonitorPrivateRpcServer();
-  PppNetworkMonitorPrivateRpcServer(const PppNetworkMonitorPrivateRpcServer&);
-  void operator=(const PppNetworkMonitorPrivateRpcServer);
-};  // class PppNetworkMonitorPrivateRpcServer
-
-class PppPrintingRpcServer {
- public:
-  static void PPP_Printing_QuerySupportedFormats(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t* formats);
-  static void PPP_Printing_Begin(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      nacl_abi_size_t print_settings_bytes, char* print_settings,
-      int32_t* pages_required);
-  static void PPP_Printing_PrintPages(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      nacl_abi_size_t page_ranges_bytes, char* page_ranges,
-      int32_t page_range_count,
-      PP_Resource* image_data);
-  static void PPP_Printing_End(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance);
-  static void PPP_Printing_IsScalingDisabled(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t* result);
-
- private:
-  PppPrintingRpcServer();
-  PppPrintingRpcServer(const PppPrintingRpcServer&);
-  void operator=(const PppPrintingRpcServer);
-};  // class PppPrintingRpcServer
-
-class PppSelectionRpcServer {
- public:
-  static void PPP_Selection_GetSelectedText(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      int32_t html,
-      nacl_abi_size_t* selected_text_bytes, char* selected_text);
-
- private:
-  PppSelectionRpcServer();
-  PppSelectionRpcServer(const PppSelectionRpcServer&);
-  void operator=(const PppSelectionRpcServer);
-};  // class PppSelectionRpcServer
-
-class PppZoomRpcServer {
- public:
-  static void PPP_Zoom_Zoom(
-      NaClSrpcRpc* rpc,
-      NaClSrpcClosure* done,
-      PP_Instance instance,
-      double factor,
-      int32_t text_only);
-
- private:
-  PppZoomRpcServer();
-  PppZoomRpcServer(const PppZoomRpcServer&);
-  void operator=(const PppZoomRpcServer);
-};  // class PppZoomRpcServer
-
-class PppRpcs {
- public:
-  static NaClSrpcHandlerDesc srpc_methods[];
-};  // class PppRpcs
-
-
-#endif  // GEN_PPAPI_PROXY_PPP_RPC_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/upcall.h b/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/upcall.h
deleted file mode 100644
index ba7d11c..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/upcall.h
+++ /dev/null
@@ -1,40 +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.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// Automatically generated code.  See srpcgen.py
-//
-// NaCl Simple Remote Procedure Call interface abstractions.
-
-#ifndef GEN_PPAPI_PROXY_UPCALL_H_
-#define GEN_PPAPI_PROXY_UPCALL_H_
-
-#ifndef __native_client__
-#include "native_client/src/include/portability.h"
-#endif  // __native_client__
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-
-class PppUpcallRpcClient {
- public:
-  static NaClSrpcError PPB_Core_CallOnMainThread(
-      NaClSrpcChannel* channel,
-      int32_t delay_in_milliseconds,
-      int32_t callback_id,
-      int32_t result);
-
- private:
-  PppUpcallRpcClient();
-  PppUpcallRpcClient(const PppUpcallRpcClient&);
-  void operator=(const PppUpcallRpcClient);
-};  // class PppUpcallRpcClient
-
-
-
-
-#endif  // GEN_PPAPI_PROXY_UPCALL_H_
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/upcall.srpc b/ppapi/native_client/src/shared/ppapi_proxy/upcall.srpc
deleted file mode 100644
index f6afbae..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/upcall.srpc
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (c) 2010 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# RPC methods handled by the upcall channel instead of the main channel.
-{
- 'name': 'PppUpcallRpc',
- 'rpcs': [
-          # Implements work scheduling on the main thread after a delay.
-          {'name': 'PPB_Core_CallOnMainThread',
-           'inputs': [['delay_in_milliseconds', 'int32_t'],
-                      ['callback_id', 'int32_t'],  # PP_CompletionCallback
-                      ['result', 'int32_t'],  # int32_t
-                     ],
-           'outputs': []
-          },
-         ]
-}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/upcall_client.cc b/ppapi/native_client/src/shared/ppapi_proxy/upcall_client.cc
deleted file mode 100644
index 08dddc2..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/upcall_client.cc
+++ /dev/null
@@ -1,40 +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.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// Automatically generated code.  See srpcgen.py
-//
-// NaCl Simple Remote Procedure Call interface abstractions.
-
-#include "untrusted/srpcgen/upcall.h"
-#ifdef __native_client__
-#ifndef UNREFERENCED_PARAMETER
-#define UNREFERENCED_PARAMETER(P) do { (void) P; } while (0)
-#endif  // UNREFERENCED_PARAMETER
-#else
-#include "native_client/src/include/portability.h"
-#endif  // __native_client__
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-
-NaClSrpcError PppUpcallRpcClient::PPB_Core_CallOnMainThread(
-    NaClSrpcChannel* channel,
-    int32_t delay_in_milliseconds,
-    int32_t callback_id,
-    int32_t result)  {
-  NaClSrpcError retval;
-  retval = NaClSrpcInvokeBySignature(
-      channel,
-      "PPB_Core_CallOnMainThread:iii:",
-      delay_in_milliseconds,
-      callback_id,
-      result
-  );
-  return retval;
-}
-
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/upcall_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/upcall_server.cc
deleted file mode 100644
index d82bbb0..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/upcall_server.cc
+++ /dev/null
@@ -1,48 +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.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// Automatically generated code.  See srpcgen.py
-//
-// NaCl Simple Remote Procedure Call interface abstractions.
-
-#include "trusted/srpcgen/upcall.h"
-#ifdef __native_client__
-#ifndef UNREFERENCED_PARAMETER
-#define UNREFERENCED_PARAMETER(P) do { (void) P; } while (0)
-#endif  // UNREFERENCED_PARAMETER
-#else
-#include "native_client/src/include/portability.h"
-#endif  // __native_client__
-#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-
-namespace {
-
-static void PPB_Core_CallOnMainThreadDispatcher(
-    NaClSrpcRpc* rpc,
-    NaClSrpcArg** inputs,
-    NaClSrpcArg** outputs,
-    NaClSrpcClosure* done
-) {
-  UNREFERENCED_PARAMETER(outputs);
-  PppUpcallRpcServer::PPB_Core_CallOnMainThread(
-      rpc,
-      done,
-      inputs[0]->u.ival,
-      inputs[1]->u.ival,
-      inputs[2]->u.ival
-  );
-}
-
-}  // namespace
-
-NaClSrpcHandlerDesc PpbUpcalls::srpc_methods[] = {
-  { "PPB_Core_CallOnMainThread:iii:", PPB_Core_CallOnMainThreadDispatcher },
-  { NULL, NULL }
-};
-
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/utility.cc b/ppapi/native_client/src/shared/ppapi_proxy/utility.cc
deleted file mode 100644
index ac3e2d7..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/utility.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2011 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "native_client/src/include/nacl_assert.h"
-
-namespace ppapi_proxy {
-
-const int foo = 5;
-
-void DebugPrintf(const char* format, ...) {
-  static bool printf_enabled = (getenv("NACL_PPAPI_PROXY_DEBUG") != NULL);
-  if (printf_enabled) {
-    va_list argptr;
-    va_start(argptr, format);
-#ifdef __native_client__
-    fprintf(stdout, "PPAPI_PROXY_PLUGIN : ");
-#else
-    fprintf(stdout, "PPAPI_PROXY_BROWSER: ");
-#endif
-    vfprintf(stdout, format, argptr);
-    va_end(argptr);
-    fflush(stdout);
-  }
-}
-
-bool StringIsUtf8(const char* data, uint32_t len) {
-  for (uint32_t i = 0; i < len; i++) {
-    if ((data[i] & 0x80) == 0) {
-      // Single-byte symbol.
-      continue;
-    } else if ((data[i] & 0xc0) == 0x80) {
-      // Invalid first byte.
-      DebugPrintf("Invalid first byte %02x\n", data[i]);
-      return false;
-    }
-    // This is a multi-byte symbol.
-    DebugPrintf("Multi-byte %02x\n", data[i]);
-    // Discard the uppermost bit.  The remaining high-order bits are the
-    // unary count of continuation bytes (up to 5 of them).
-    char first = data[i] << 1;
-    uint32_t continuation_bytes = 0;
-    const uint32_t kMaxContinuationBytes = 5;
-    while (first & 0x80) {
-      if (++i >= len) {
-        DebugPrintf("String ended before enough continuation bytes"
-                    "were found.\n");
-        return false;
-      } else if (++continuation_bytes > kMaxContinuationBytes) {
-        DebugPrintf("Too many continuation bytes were requested.\n");
-        return false;
-      } else if ((data[i] & 0xc0) != 0x80) {
-        DebugPrintf("Invalid continuation byte.\n");
-        return false;
-      }
-      first <<= 1;
-    }
-  }
-  return true;
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/utility.h b/ppapi/native_client/src/shared/ppapi_proxy/utility.h
deleted file mode 100644
index a171073..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/utility.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2011 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_UTILITY_H_
-#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_UTILITY_H_
-
-#include "native_client/src/include/nacl_assert.h"
-#include "native_client/src/shared/platform/nacl_check.h"
-
-namespace ppapi_proxy {
-
-void DebugPrintf(const char* format, ...);
-
-// Check to see if |data| points to a valid UTF8 string.  Checks at most |len|
-// characters. See http://tools.ietf.org/html/rfc3629 for details.
-bool StringIsUtf8(const char* data, uint32_t len);
-
-}  // namespace ppapi_proxy
-
-#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_UTILITY_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/view_data.cc b/ppapi/native_client/src/shared/ppapi_proxy/view_data.cc
deleted file mode 100644
index 60174f5..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/view_data.cc
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ppapi/native_client/src/shared/ppapi_proxy/view_data.h"
-
-namespace ppapi_proxy {
-
-ViewData::ViewData()
-    : viewport_rect(PP_MakeRectFromXYWH(0, 0, 0, 0)),
-      is_fullscreen(PP_FALSE),
-      is_page_visible(PP_FALSE),
-      clip_rect(PP_MakeRectFromXYWH(0, 0, 0, 0)) {
-}
-
-}  // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/view_data.h b/ppapi/native_client/src/shared/ppapi_proxy/view_data.h
deleted file mode 100644
index 29d8985..0000000
--- a/ppapi/native_client/src/shared/ppapi_proxy/view_data.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PPAPI_NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_VIEW_DATA_H_
-#define PPAPI_NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_VIEW_DATA_H_
-
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_rect.h"
-
-namespace ppapi_proxy {
-
-struct ViewData {
-  ViewData();
-
-  PP_Rect viewport_rect;
-  PP_Bool is_fullscreen;
-  PP_Bool is_page_visible;
-  PP_Rect clip_rect;
-};
-
-}  // namespace ppapi_proxy
-
-#endif  // PPAPI_NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_VIEW_DATA_H_
diff --git a/ppapi/native_client/src/trusted/plugin/file_downloader.cc b/ppapi/native_client/src/trusted/plugin/file_downloader.cc
index fd9d38f..4eae623 100644
--- a/ppapi/native_client/src/trusted/plugin/file_downloader.cc
+++ b/ppapi/native_client/src/trusted/plugin/file_downloader.cc
@@ -46,13 +46,14 @@
     const pp::CompletionCallback& callback,
     StreamCallbackSource* stream_callback_source) {
   data_stream_callback_source_ = stream_callback_source;
-  return Open(url, DOWNLOAD_STREAM, callback, NULL);
+  return Open(url, DOWNLOAD_STREAM, callback, true, NULL);
 }
 
 bool FileDownloader::Open(
     const nacl::string& url,
     DownloadMode mode,
     const pp::CompletionCallback& callback,
+    bool record_progress,
     PP_URLLoaderTrusted_StatusCallback progress_callback) {
   PLUGIN_PRINTF(("FileDownloader::Open (url=%s)\n", url.c_str()));
   if (callback.pp_completion_callback().func == NULL ||
@@ -62,6 +63,7 @@
 
   CHECK(instance_ != NULL);
   open_time_ = NaClGetTimeOfDayMicroseconds();
+  status_code_ = -1;
   url_to_open_ = url;
   url_ = url;
   file_open_notify_callback_ = callback;
@@ -69,6 +71,14 @@
   buffer_.clear();
   pp::URLRequestInfo url_request(instance_);
 
+  // Allow CORS.
+  // Note that "SetAllowCrossOriginRequests" (currently) has the side effect of
+  // preventing credentials from being sent on same-origin requests.  We
+  // therefore avoid setting this flag unless we know for sure it is a
+  // cross-origin request, resulting in behavior similar to XMLHttpRequest.
+  if (!instance_->DocumentCanRequest(url))
+    url_request.SetAllowCrossOriginRequests(true);
+
   do {
     // Reset the url loader and file reader.
     // Note that we have the only reference to the underlying objects, so
@@ -76,12 +86,7 @@
     url_loader_ = pp::URLLoader(instance_);
     url_scheme_ = instance_->GetUrlScheme(url);
     bool grant_universal_access = false;
-    if (url_scheme_ == SCHEME_CHROME_EXTENSION) {
-      // Use CORS to access URLs in the chrome extension scheme. If the files
-      // are truly restricted, then they should not be listed as a
-      // web_accessible_resource in the extension manifest.
-      url_request.SetAllowCrossOriginRequests(true);
-    } else if (url_scheme_ == SCHEME_DATA) {
+    if (url_scheme_ == SCHEME_DATA) {
       // TODO(elijahtaylor) Remove this when data URIs can be read without
       // universal access.
       // https://bugs.webkit.org/show_bug.cgi?id=17352
@@ -97,6 +102,8 @@
       }
     }
 
+    url_request.SetRecordDownloadProgress(record_progress);
+
     if (url_loader_trusted_interface_ != NULL) {
       if (grant_universal_access) {
         // TODO(sehr,jvoung): See if we can remove this -- currently
@@ -105,7 +112,6 @@
             url_loader_.pp_resource());
       }
       if (progress_callback != NULL) {
-        url_request.SetRecordDownloadProgress(true);
         url_loader_trusted_interface_->RegisterStatusCallback(
             url_loader_.pp_resource(), progress_callback);
       }
@@ -199,22 +205,22 @@
     return false;
   }
   bool status_ok = false;
-  int32_t status_code = url_response.GetStatusCode();
+  status_code_ = url_response.GetStatusCode();
   switch (url_scheme_) {
     case SCHEME_CHROME_EXTENSION:
       PLUGIN_PRINTF(("FileDownloader::InitialResponseIsValid (chrome-extension "
-                     "response status_code=%"NACL_PRId32")\n", status_code));
-      status_ok = (status_code == kExtensionUrlRequestStatusOk);
+                     "response status_code=%"NACL_PRId32")\n", status_code_));
+      status_ok = (status_code_ == kExtensionUrlRequestStatusOk);
       break;
     case SCHEME_DATA:
       PLUGIN_PRINTF(("FileDownloader::InitialResponseIsValid (data URI "
-                     "response status_code=%"NACL_PRId32")\n", status_code));
-      status_ok = (status_code == kDataUriRequestStatusOk);
+                     "response status_code=%"NACL_PRId32")\n", status_code_));
+      status_ok = (status_code_ == kDataUriRequestStatusOk);
       break;
     case SCHEME_OTHER:
       PLUGIN_PRINTF(("FileDownloader::InitialResponseIsValid (HTTP response "
-                     "status_code=%"NACL_PRId32")\n", status_code));
-      status_ok = (status_code == NACL_HTTP_STATUS_OK);
+                     "status_code=%"NACL_PRId32")\n", status_code_));
+      status_ok = (status_code_ == NACL_HTTP_STATUS_OK);
       break;
   }
 
@@ -348,6 +354,13 @@
   }
 }
 
+bool FileDownloader::GetDownloadProgress(
+    int64_t* bytes_received,
+    int64_t* total_bytes_to_be_received) const {
+  return url_loader_.GetDownloadProgress(bytes_received,
+                                         total_bytes_to_be_received);
+}
+
 void FileDownloader::FileOpenNotify(int32_t pp_error) {
   PLUGIN_PRINTF(("FileDownloader::FileOpenNotify (pp_error=%"NACL_PRId32")\n",
                  pp_error));
diff --git a/ppapi/native_client/src/trusted/plugin/file_downloader.h b/ppapi/native_client/src/trusted/plugin/file_downloader.h
index a91104f..3f1e2b6 100644
--- a/ppapi/native_client/src/trusted/plugin/file_downloader.h
+++ b/ppapi/native_client/src/trusted/plugin/file_downloader.h
@@ -62,11 +62,15 @@
   // Returns true when callback is scheduled to be called on success or failure.
   // Returns false if callback is NULL, Initialize() has not been called or if
   // the PPB_FileIO_Trusted interface is not available.
-  // If |progress_callback| is not NULL, it will be invoked for every progress
-  // update received by the loader.
+  // If |record_progress| is true, then download progress will be recorded,
+  // and can be polled through GetDownloadProgress().
+  // If |progress_callback| is not NULL and |record_progress| is true,
+  // then the callback will be invoked for every progress update received
+  // by the loader.
   bool Open(const nacl::string& url,
             DownloadMode mode,
             const pp::CompletionCallback& callback,
+            bool record_progress,
             PP_URLLoaderTrusted_StatusCallback progress_callback);
 
   // Same as Open, but used for streaming the file data directly to the
@@ -99,6 +103,19 @@
   // Returns the PP_Resource of the active URL loader, or kInvalidResource.
   PP_Resource url_loader() const { return url_loader_.pp_resource(); }
 
+  // GetDownloadProgress() returns the current download progress, which is
+  // meaningful after Open() has been called. Progress only refers to the
+  // response body and does not include the headers.
+  //
+  // This data is only available if the |record_progress| true in the
+  // Open() call.  If progress is being recorded, then |bytes_received|
+  // will be set to the number of bytes received thus far,
+  // and |total_bytes_to_be_received| will be set to the total number
+  // of bytes to be received.  The total bytes to be received may be unknown,
+  // in which case |total_bytes_to_be_received| will be set to -1.
+  bool GetDownloadProgress(int64_t* bytes_received,
+                           int64_t* total_bytes_to_be_received) const;
+
   // Returns the buffer used for DOWNLOAD_TO_BUFFER mode.
   const std::deque<char>& buffer() const { return buffer_; }
 
@@ -106,6 +123,8 @@
   bool streaming_to_buffer() const;
   bool streaming_to_user() const;
 
+  int status_code() const { return status_code_; }
+
  private:
   NACL_DISALLOW_COPY_AND_ASSIGN(FileDownloader);
   // This class loads and opens the file in three steps for DOWNLOAD_TO_FILE:
@@ -137,6 +156,7 @@
   pp::URLLoader url_loader_;
   pp::CompletionCallbackFactory<FileDownloader> callback_factory_;
   int64_t open_time_;
+  int32_t status_code_;
   DownloadMode mode_;
   static const uint32_t kTempBufferSize = 2048;
   std::vector<char> temp_buffer_;
diff --git a/ppapi/native_client/src/trusted/plugin/json_manifest.cc b/ppapi/native_client/src/trusted/plugin/json_manifest.cc
index 49d18b9..730562f 100644
--- a/ppapi/native_client/src/trusted/plugin/json_manifest.cc
+++ b/ppapi/native_client/src/trusted/plugin/json_manifest.cc
@@ -16,6 +16,7 @@
 #include "native_client/src/include/portability.h"
 #include "native_client/src/shared/platform/nacl_check.h"
 #include "native_client/src/trusted/plugin/plugin_error.h"
+#include "native_client/src/trusted/plugin/pnacl_options.h"
 #include "native_client/src/trusted/plugin/utility.h"
 #include "ppapi/cpp/dev/url_util_dev.h"
 #include "ppapi/cpp/var.h"
@@ -39,8 +40,10 @@
 const char* const kPnaclTranslateKey = "pnacl-translate";
 const char* const kUrlKey =            "url";
 
-// Cache support keys
+// Pnacl keys
 const char* const kCacheIdentityKey = "sha256";
+const char* const kOptLevelKey = "-O";
+const char* const kPnaclExperimentalFlags = "experimental_flags";
 
 // Sample manifest file:
 // {
@@ -51,7 +54,8 @@
 //     "portable": {
 //       "pnacl-translate": {
 //         "url": "myprogram.pexe",
-//         "sha256": "..."
+//         "sha256": "...",
+//         "-O": 0
 //       }
 //     }
 //   },
@@ -201,18 +205,19 @@
 // ISAs are allowed, but ignored and warnings are produced. It is also validated
 // that it must have an entry to match the ISA specified in |sandbox_isa| or
 // have a fallback 'portable' entry if there is no match. Returns true if
-// |dictionary| is an ISA to URL map.  Sets |error_string| to something
+// |dictionary| is an ISA to URL map.  Sets |error_info| to something
 // descriptive if it fails.
 bool IsValidISADictionary(const Json::Value& dictionary,
                           const nacl::string& parent_key,
                           const nacl::string& sandbox_isa,
-                          nacl::string* error_string) {
-  if (error_string == NULL)
-    return false;
+                          ErrorInfo* error_info) {
+  if (error_info == NULL) return false;
 
   // An ISA to URL dictionary has to be an object.
   if (!dictionary.isObject()) {
-    *error_string = parent_key + " property is not an ISA to URL dictionary";
+    error_info->SetReport(ERROR_MANIFEST_SCHEMA_VALIDATE,
+                          nacl::string("manifest: ") + parent_key +
+                          " property is not an ISA to URL dictionary");
     return false;
   }
   // The keys to the dictionary have to be valid ISA names.
@@ -236,10 +241,13 @@
     // it could be "arch/portable" : { "pnacl-translate": URLSpec }
     // for executables that need to be translated.
     Json::Value property_value = dictionary[property_name];
+    nacl::string error_string;
     if (!IsValidUrlSpec(property_value, property_name, parent_key,
-                        error_string) &&
+                        &error_string) &&
         !IsValidPnaclTranslateSpec(property_value, property_name,
-                                   parent_key, error_string)) {
+                                   parent_key, &error_string)) {
+      error_info->SetReport(ERROR_MANIFEST_SCHEMA_VALIDATE,
+                            nacl::string("manifiest: ") + error_string);
       return false;
     }
   }
@@ -250,20 +258,33 @@
   bool has_portable = dictionary.isMember(kPortableKey);
 
   if (!has_isa && !has_portable) {
-    *error_string = parent_key +
-        " no version given for current arch and no portable version found.";
+    error_info->SetReport(
+        ERROR_MANIFEST_PROGRAM_MISSING_ARCH,
+        nacl::string("manifest: no version of ") + parent_key +
+        " given for current arch and no portable version found.");
     return false;
   }
 
   return true;
 }
 
-void GrabUrlAndCacheIdentity(const Json::Value& url_spec,
-                             nacl::string* url,
-                             nacl::string* cache_identity) {
+void GrabUrlAndPnaclOptions(const Json::Value& url_spec,
+                            nacl::string* url,
+                            PnaclOptions* pnacl_options) {
   *url = url_spec[kUrlKey].asString();
   if (url_spec.isMember(kCacheIdentityKey)) {
-    *cache_identity = url_spec[kCacheIdentityKey].asString();
+    pnacl_options->set_bitcode_hash(url_spec[kCacheIdentityKey].asString());
+  }
+  if (url_spec.isMember(kOptLevelKey)) {
+    uint32_t opt_raw = url_spec[kOptLevelKey].asUInt();
+    // Clamp the opt value to fit into an int8_t.
+    if (opt_raw > 3)
+      opt_raw = 3;
+    pnacl_options->set_opt_level(static_cast<int8_t>(opt_raw));
+  }
+  if (url_spec.isMember(kPnaclExperimentalFlags)) {
+    pnacl_options->set_experimental_flags(
+        url_spec[kPnaclExperimentalFlags].asString());
   }
 }
 
@@ -272,19 +293,15 @@
                              const nacl::string& sandbox_isa,
                              bool prefer_portable,
                              nacl::string* url,
-                             nacl::string* cache_identity,
-                             nacl::string* error_string,
-                             bool* pnacl_translate) {
-  if (url == NULL || cache_identity == NULL ||
-      error_string == NULL || pnacl_translate == NULL)
+                             PnaclOptions* pnacl_options,
+                             ErrorInfo* error_info) {
+  if (url == NULL || pnacl_options == NULL || error_info == NULL)
     return false;
 
-  if (!IsValidISADictionary(dictionary, parent_key, sandbox_isa, error_string))
+  if (!IsValidISADictionary(dictionary, parent_key, sandbox_isa, error_info))
     return false;
 
   *url = "";
-  *cache_identity = "";
-  *pnacl_translate = false;
 
   // The call to IsValidISADictionary() above guarantees that either
   // sandbox_isa or kPortableKey is present in the dictionary.
@@ -300,11 +317,11 @@
   // Check if this requires a pnacl-translate, otherwise just grab the URL.
   // We may have pnacl-translate for isa-specific bitcode for CPU tuning.
   if (isa_spec.isMember(kPnaclTranslateKey)) {
-    GrabUrlAndCacheIdentity(isa_spec[kPnaclTranslateKey], url, cache_identity);
-    *pnacl_translate = true;
+    GrabUrlAndPnaclOptions(isa_spec[kPnaclTranslateKey], url, pnacl_options);
+    pnacl_options->set_translate(true);
   } else {
-    GrabUrlAndCacheIdentity(isa_spec, url, cache_identity);
-    *pnacl_translate = false;
+    *url = isa_spec[kUrlKey].asString();
+    pnacl_options->set_translate(false);
   }
 
   return true;
@@ -316,9 +333,8 @@
                const Manifest* manifest,
                bool prefer_portable,
                nacl::string* full_url,
-               nacl::string* cache_identity,
-               ErrorInfo* error_info,
-               bool* pnacl_translate) {
+               PnaclOptions* pnacl_options,
+               ErrorInfo* error_info) {
   CHECK(full_url != NULL && error_info != NULL);
   if (!dictionary.isMember(key)) {
     error_info->SetReport(ERROR_MANIFEST_RESOLVE_URL,
@@ -326,14 +342,9 @@
     return false;
   }
   const Json::Value& isa_dict = dictionary[key];
-  nacl::string error_string;
   nacl::string relative_url;
   if (!GetURLFromISADictionary(isa_dict, key, sandbox_isa, prefer_portable,
-                               &relative_url, cache_identity,
-                               &error_string, pnacl_translate)) {
-    error_info->SetReport(ERROR_MANIFEST_RESOLVE_URL,
-                          key + nacl::string(" manifest resolution error: ") +
-                          error_string);
+                               &relative_url, pnacl_options, error_info)) {
     return false;
   }
   return manifest->ResolveURL(relative_url, full_url, error_info);
@@ -384,8 +395,6 @@
     }
   }
 
-  nacl::string error_string;
-
   // A manifest file must have a program section.
   if (!dictionary_.isMember(kProgramKey)) {
     error_info->SetReport(
@@ -398,10 +407,7 @@
   if (!IsValidISADictionary(dictionary_[kProgramKey],
                             kProgramKey,
                             sandbox_isa_,
-                            &error_string)) {
-    error_info->SetReport(
-        ERROR_MANIFEST_SCHEMA_VALIDATE,
-        nacl::string("manifest: ") + error_string);
+                            error_info)) {
     return false;
   }
 
@@ -410,10 +416,7 @@
     if (!IsValidISADictionary(dictionary_[kInterpreterKey],
                               kInterpreterKey,
                               sandbox_isa_,
-                              &error_string)) {
-      error_info->SetReport(
-          ERROR_MANIFEST_SCHEMA_VALIDATE,
-          nacl::string("manifest: ") + error_string);
+                              error_info)) {
       return false;
     }
   }
@@ -432,10 +435,7 @@
       if (!IsValidISADictionary(files[file_name],
                                 file_name,
                                 sandbox_isa_,
-                                &error_string)) {
-        error_info->SetReport(
-            ERROR_MANIFEST_SCHEMA_VALIDATE,
-            nacl::string("manifest: file ") + error_string);
+                                error_info)) {
         return false;
       }
     }
@@ -465,11 +465,9 @@
 }
 
 bool JsonManifest::GetProgramURL(nacl::string* full_url,
-                                 nacl::string* cache_identity,
-                                 ErrorInfo* error_info,
-                                 bool* pnacl_translate) const {
-  if (full_url == NULL || cache_identity == NULL ||
-      error_info == NULL || pnacl_translate == NULL)
+                                 PnaclOptions* pnacl_options,
+                                 ErrorInfo* error_info) const {
+  if (full_url == NULL || pnacl_options == NULL || error_info == NULL)
     return false;
 
   Json::Value program = dictionary_[kProgramKey];
@@ -482,12 +480,8 @@
                                sandbox_isa_,
                                prefer_portable_,
                                &nexe_url,
-                               cache_identity,
-                               &error_string,
-                               pnacl_translate)) {
-    error_info->SetReport(ERROR_MANIFEST_GET_NEXE_URL,
-                          nacl::string("program:") + sandbox_isa_ +
-                          error_string);
+                               pnacl_options,
+                               error_info)) {
     return false;
   }
 
@@ -510,19 +504,17 @@
 
 bool JsonManifest::ResolveKey(const nacl::string& key,
                               nacl::string* full_url,
-                              nacl::string* cache_identity,
-                              ErrorInfo* error_info,
-                              bool* pnacl_translate) const {
+                              PnaclOptions* pnacl_options,
+                              ErrorInfo* error_info) const {
   NaClLog(3, "JsonManifest::ResolveKey(%s)\n", key.c_str());
   // key must be one of kProgramKey or kFileKey '/' file-section-key
 
-  if (full_url == NULL || cache_identity == NULL ||
-      error_info == NULL || pnacl_translate == NULL)
+  if (full_url == NULL || pnacl_options == NULL || error_info == NULL)
     return false;
 
   if (key == kProgramKey) {
     return GetKeyUrl(dictionary_, key, sandbox_isa_, this, prefer_portable_,
-                     full_url, cache_identity, error_info, pnacl_translate);
+                     full_url, pnacl_options, error_info);
   }
   nacl::string::const_iterator p = find(key.begin(), key.end(), '/');
   if (p == key.end()) {
@@ -557,7 +549,7 @@
     return false;
   }
   return GetKeyUrl(files, rest, sandbox_isa_, this, prefer_portable_,
-                   full_url, cache_identity, error_info, pnacl_translate);
+                   full_url, pnacl_options, error_info);
 }
 
 }  // namespace plugin
diff --git a/ppapi/native_client/src/trusted/plugin/json_manifest.h b/ppapi/native_client/src/trusted/plugin/json_manifest.h
index df04c88..e2e4fbc 100644
--- a/ppapi/native_client/src/trusted/plugin/json_manifest.h
+++ b/ppapi/native_client/src/trusted/plugin/json_manifest.h
@@ -25,6 +25,7 @@
 namespace plugin {
 
 class ErrorInfo;
+class PnaclOptions;
 
 class JsonManifest : public Manifest {
  public:
@@ -44,12 +45,10 @@
   bool Init(const nacl::string& json, ErrorInfo* error_info);
 
   // Gets the full program URL for the current sandbox ISA from the
-  // manifest file. Sets |pnacl_translate| to |true| if the program is
-  // portable bitcode that must be translated.
+  // manifest file.
   virtual bool GetProgramURL(nacl::string* full_url,
-                             nacl::string* cache_identity,
-                             ErrorInfo* error_info,
-                             bool* pnacl_translate) const;
+                             PnaclOptions* pnacl_options,
+                             ErrorInfo* error_info) const;
 
   // Resolves a URL relative to the manifest base URL
   virtual bool ResolveURL(const nacl::string& relative_url,
@@ -64,14 +63,12 @@
 
   // Resolves a key from the "files" section to a fully resolved URL,
   // i.e., relative URL values are fully expanded relative to the
-  // manifest's URL (via ResolveURL).  |pnacl_translate| tells the caller
-  // whether the resolution requires a pnacl translation step.
+  // manifest's URL (via ResolveURL).
   // If there was an error, details are reported via error_info.
   virtual bool ResolveKey(const nacl::string& key,
                           nacl::string* full_url,
-                          nacl::string* cache_identity,
-                          ErrorInfo* error_info,
-                          bool* pnacl_translate) const;
+                          PnaclOptions* pnacl_options,
+                          ErrorInfo* error_info) const;
 
  private:
   NACL_DISALLOW_COPY_AND_ASSIGN(JsonManifest);
diff --git a/ppapi/native_client/src/trusted/plugin/manifest.h b/ppapi/native_client/src/trusted/plugin/manifest.h
index bce0a19..b828aea 100644
--- a/ppapi/native_client/src/trusted/plugin/manifest.h
+++ b/ppapi/native_client/src/trusted/plugin/manifest.h
@@ -24,6 +24,7 @@
 namespace plugin {
 
 class ErrorInfo;
+class PnaclOptions;
 
 class Manifest {
  public:
@@ -38,12 +39,11 @@
   // a resource in the extension origin.
 
   // Gets the full program URL for the current sandbox ISA from the
-  // manifest file. Sets |pnacl_translate| to |true| if the program is
-  // requires pnacl translation.
+  // manifest file.  Fills in |pnacl_options| if the program requires
+  // PNaCl translation.
   virtual bool GetProgramURL(nacl::string* full_url,
-                             nacl::string* cache_identity,
-                             ErrorInfo* error_info,
-                             bool* pnacl_translate) const = 0;
+                             PnaclOptions* pnacl_options,
+                             ErrorInfo* error_info) const = 0;
 
   // Resolves a URL relative to the manifest base URL
   virtual bool ResolveURL(const nacl::string& relative_url,
@@ -58,14 +58,14 @@
 
   // Resolves a key from the "files" section to a fully resolved URL,
   // i.e., relative URL values are fully expanded relative to the
-  // manifest's URL (via ResolveURL).  |pnacl_translate| tells
-  // the caller whether the resolution requires a pnacl translation step.
+  // manifest's URL (via ResolveURL).  Fills in |pnacl_options| if
+  // the resolved key requires a pnacl translation step to obtain
+  // the final requested resource.
   // If there was an error, details are reported via error_info.
   virtual bool ResolveKey(const nacl::string& key,
                           nacl::string* full_url,
-                          nacl::string* cache_identity,
-                          ErrorInfo* error_info,
-                          bool* pnacl_translate) const = 0;
+                          PnaclOptions* pnacl_options,
+                          ErrorInfo* error_info) const = 0;
 
  protected:
   NACL_DISALLOW_COPY_AND_ASSIGN(Manifest);
diff --git a/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h b/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
index 25f914d..f915edd 100644
--- a/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
+++ b/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
@@ -12,15 +12,16 @@
 #include <map>
 #include <string>
 
-#include "native_client/src/shared/imc/nacl_imc.h"
+#include "native_client/src/shared/imc/nacl_imc_c.h"
 #include "ppapi/c/pp_instance.h"
+#include "ppapi/c/private/ppb_nacl_private.h"
 
-
-typedef bool (*LaunchNaClProcessFunc)(PP_Instance instance,
-                                      const char* url,
-                                      bool enable_ppapi_dev,
-                                      int socket_count,
-                                      nacl::Handle* result_sockets);
+typedef PP_NaClResult (*LaunchNaClProcessFunc)(PP_Instance instance,
+                                               const char* alleged_url,
+                                               PP_Bool uses_irt,
+                                               PP_Bool uses_ppapi,
+                                               PP_Bool enable_ppapi_dev,
+                                               NaClHandle* result_socket);
 
 
 extern LaunchNaClProcessFunc launch_nacl_process;
diff --git a/ppapi/native_client/src/trusted/plugin/nacl_subprocess.cc b/ppapi/native_client/src/trusted/plugin/nacl_subprocess.cc
index 8f769f8..4b4c066 100644
--- a/ppapi/native_client/src/trusted/plugin/nacl_subprocess.cc
+++ b/ppapi/native_client/src/trusted/plugin/nacl_subprocess.cc
@@ -40,10 +40,6 @@
   return NULL != srpc_client_.get();
 }
 
-bool NaClSubprocess::StartJSObjectProxy(Plugin* plugin, ErrorInfo* error_info) {
-  return srpc_client_->StartJSObjectProxy(plugin, error_info);
-}
-
 bool NaClSubprocess::InvokeSrpcMethod(const nacl::string& method_name,
                                       const nacl::string& input_signature,
                                       SrpcParams* params,
diff --git a/ppapi/native_client/src/trusted/plugin/nacl_subprocess.h b/ppapi/native_client/src/trusted/plugin/nacl_subprocess.h
index 9b7faff..22676d1 100644
--- a/ppapi/native_client/src/trusted/plugin/nacl_subprocess.h
+++ b/ppapi/native_client/src/trusted/plugin/nacl_subprocess.h
@@ -56,7 +56,6 @@
 
   // Start up interfaces.
   bool StartSrpcServices();
-  bool StartJSObjectProxy(Plugin* plugin, ErrorInfo* error_info);
 
   // Invoke an Srpc Method.  |out_params| must be allocated and cleaned up
   // outside of this function, but it will be initialized by this function, and
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc
index bac7300..e1f3ad9 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -30,7 +30,6 @@
 #include "native_client/src/include/portability_io.h"
 #include "native_client/src/include/portability_string.h"
 #include "native_client/src/shared/platform/nacl_check.h"
-#include "native_client/src/shared/ppapi_proxy/browser_ppp.h"
 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h"
 #include "native_client/src/trusted/plugin/json_manifest.h"
@@ -43,12 +42,12 @@
 #include "native_client/src/trusted/plugin/utility.h"
 #include "native_client/src/trusted/service_runtime/nacl_error_code.h"
 
-#include "ppapi/c/dev/ppb_console_dev.h"
 #include "ppapi/c/dev/ppp_find_dev.h"
 #include "ppapi/c/dev/ppp_printing_dev.h"
 #include "ppapi/c/dev/ppp_selection_dev.h"
 #include "ppapi/c/dev/ppp_zoom_dev.h"
 #include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_console.h"
 #include "ppapi/c/ppb_var.h"
 #include "ppapi/c/ppp_input_event.h"
 #include "ppapi/c/ppp_instance.h"
@@ -67,8 +66,6 @@
 #include "ppapi/cpp/mouse_lock.h"
 #include "ppapi/cpp/rect.h"
 
-using ppapi_proxy::BrowserPpp;
-
 namespace plugin {
 
 namespace {
@@ -226,206 +223,44 @@
   HistogramEnumerate("NaCl.Client.OSArch", os_arch, kNaClOSArchMax, -1);
 }
 
-void HistogramEnumerateLoadStatus(PluginErrorCode error_code) {
+void HistogramEnumerateLoadStatus(PluginErrorCode error_code,
+                                  bool is_installed) {
   HistogramEnumerate("NaCl.LoadStatus.Plugin", error_code, ERROR_MAX,
                      ERROR_UNKNOWN);
+
+  // Gather data to see if being installed changes load outcomes.
+  const char* name = is_installed ? "NaCl.LoadStatus.Plugin.InstalledApp" :
+      "NaCl.LoadStatus.Plugin.NotInstalledApp";
+  HistogramEnumerate(name, error_code, ERROR_MAX,
+                     ERROR_UNKNOWN);
 }
 
-void HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code) {
+void HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code,
+                                        bool is_installed) {
   HistogramEnumerate("NaCl.LoadStatus.SelLdr", error_code, NACL_ERROR_CODE_MAX,
                      LOAD_STATUS_UNKNOWN);
+
+  // Gather data to see if being installed changes load outcomes.
+  const char* name = is_installed ? "NaCl.LoadStatus.SelLdr.InstalledApp" :
+      "NaCl.LoadStatus.SelLdr.NotInstalledApp";
+  HistogramEnumerate(name, error_code, NACL_ERROR_CODE_MAX,
+                     LOAD_STATUS_UNKNOWN);
 }
 
 void HistogramEnumerateManifestIsDataURI(bool is_data_uri) {
   HistogramEnumerate("NaCl.Manifest.IsDataURI", is_data_uri, 2, -1);
 }
 
-// Derive a class from pp::Find_Dev to forward PPP_Find_Dev calls to
-// the plugin.
-class FindAdapter : public pp::Find_Dev {
- public:
-  explicit FindAdapter(Plugin* plugin)
-    : pp::Find_Dev(plugin),
-      plugin_(plugin) {
-    BrowserPpp* proxy = plugin_->ppapi_proxy();
-    CHECK(proxy != NULL);
-    ppp_find_ = static_cast<const PPP_Find_Dev*>(
-        proxy->GetPluginInterface(PPP_FIND_DEV_INTERFACE));
-  }
-
-  bool StartFind(const std::string& text, bool case_sensitive) {
-    if (ppp_find_ != NULL) {
-      PP_Bool pp_success =
-          ppp_find_->StartFind(plugin_->pp_instance(),
-                               text.c_str(),
-                               PP_FromBool(case_sensitive));
-      return pp_success == PP_TRUE;
-    }
-    return false;
-  }
-
-  void SelectFindResult(bool forward) {
-    if (ppp_find_ != NULL) {
-      ppp_find_->SelectFindResult(plugin_->pp_instance(),
-                                  PP_FromBool(forward));
-    }
-  }
-
-  void StopFind() {
-    if (ppp_find_ != NULL)
-      ppp_find_->StopFind(plugin_->pp_instance());
-  }
-
- private:
-  Plugin* plugin_;
-  const PPP_Find_Dev* ppp_find_;
-
-  NACL_DISALLOW_COPY_AND_ASSIGN(FindAdapter);
-};
-
-
-// Derive a class from pp::MouseLock to forward PPP_MouseLock calls to
-// the plugin.
-class MouseLockAdapter : public pp::MouseLock {
- public:
-  explicit MouseLockAdapter(Plugin* plugin)
-    : pp::MouseLock(plugin),
-      plugin_(plugin) {
-    BrowserPpp* proxy = plugin_->ppapi_proxy();
-    CHECK(proxy != NULL);
-    ppp_mouse_lock_ = static_cast<const PPP_MouseLock*>(
-        proxy->GetPluginInterface(PPP_MOUSELOCK_INTERFACE));
-  }
-
-  void MouseLockLost() {
-    if (ppp_mouse_lock_ != NULL)
-      ppp_mouse_lock_->MouseLockLost(plugin_->pp_instance());
-  }
-
- private:
-  Plugin* plugin_;
-  const PPP_MouseLock* ppp_mouse_lock_;
-
-  NACL_DISALLOW_COPY_AND_ASSIGN(MouseLockAdapter);
-};
-
-
-// Derive a class from pp::Printing_Dev to forward PPP_Printing_Dev calls to
-// the plugin.
-class PrintingAdapter : public pp::Printing_Dev {
- public:
-  explicit PrintingAdapter(Plugin* plugin)
-    : pp::Printing_Dev(plugin),
-      plugin_(plugin) {
-    BrowserPpp* proxy = plugin_->ppapi_proxy();
-    CHECK(proxy != NULL);
-    ppp_printing_ = static_cast<const PPP_Printing_Dev*>(
-        proxy->GetPluginInterface(PPP_PRINTING_DEV_INTERFACE));
-  }
-
-  uint32_t QuerySupportedPrintOutputFormats() {
-    if (ppp_printing_ != NULL) {
-      return ppp_printing_->QuerySupportedFormats(plugin_->pp_instance());
-    }
-    return 0;
-  }
-
-  int32_t PrintBegin(const PP_PrintSettings_Dev& print_settings) {
-    if (ppp_printing_ != NULL) {
-      return ppp_printing_->Begin(plugin_->pp_instance(), &print_settings);
-    }
-    return 0;
-  }
-
-  pp::Resource PrintPages(const PP_PrintPageNumberRange_Dev* page_ranges,
-                          uint32_t page_range_count) {
-    if (ppp_printing_ != NULL) {
-      PP_Resource image_data = ppp_printing_->PrintPages(plugin_->pp_instance(),
-                                                         page_ranges,
-                                                         page_range_count);
-      return pp::ImageData(pp::PASS_REF, image_data);
-    }
-    return pp::Resource();
-  }
-
-  void PrintEnd() {
-    if (ppp_printing_ != NULL)
-      ppp_printing_->End(plugin_->pp_instance());
-  }
-
-  bool IsPrintScalingDisabled() {
-    if (ppp_printing_ != NULL) {
-      PP_Bool result = ppp_printing_->IsScalingDisabled(plugin_->pp_instance());
-      return result == PP_TRUE;
-    }
-    return false;
-  }
-
- private:
-  Plugin* plugin_;
-  const PPP_Printing_Dev* ppp_printing_;
-
-  NACL_DISALLOW_COPY_AND_ASSIGN(PrintingAdapter);
-};
-
-
-// Derive a class from pp::Selection_Dev to forward PPP_Selection_Dev calls to
-// the plugin.
-class SelectionAdapter : public pp::Selection_Dev {
- public:
-  explicit SelectionAdapter(Plugin* plugin)
-    : pp::Selection_Dev(plugin),
-      plugin_(plugin) {
-    BrowserPpp* proxy = plugin_->ppapi_proxy();
-    CHECK(proxy != NULL);
-    ppp_selection_ = static_cast<const PPP_Selection_Dev*>(
-        proxy->GetPluginInterface(PPP_SELECTION_DEV_INTERFACE));
-  }
-
-  pp::Var GetSelectedText(bool html) {
-    if (ppp_selection_ != NULL) {
-      PP_Var var = ppp_selection_->GetSelectedText(plugin_->pp_instance(),
-                                                   PP_FromBool(html));
-      return pp::Var(pp::PASS_REF, var);
-    }
-    return pp::Var();
-  }
-
- private:
-  Plugin* plugin_;
-  const PPP_Selection_Dev* ppp_selection_;
-
-  NACL_DISALLOW_COPY_AND_ASSIGN(SelectionAdapter);
-};
-
-
-// Derive a class from pp::Zoom_Dev to forward PPP_Zoom_Dev calls to
-// the plugin.
-class ZoomAdapter : public pp::Zoom_Dev {
- public:
-  explicit ZoomAdapter(Plugin* plugin)
-    : pp::Zoom_Dev(plugin),
-      plugin_(plugin) {
-    BrowserPpp* proxy = plugin_->ppapi_proxy();
-    CHECK(proxy != NULL);
-    ppp_zoom_ = static_cast<const PPP_Zoom_Dev*>(
-        proxy->GetPluginInterface(PPP_ZOOM_DEV_INTERFACE));
-  }
-
-  void Zoom(double factor, bool text_only) {
-    if (ppp_zoom_ != NULL) {
-      ppp_zoom_->Zoom(plugin_->pp_instance(),
-                      factor,
-                      PP_FromBool(text_only));
-    }
-  }
-
- private:
-  Plugin* plugin_;
-  const PPP_Zoom_Dev* ppp_zoom_;
-
-  NACL_DISALLOW_COPY_AND_ASSIGN(ZoomAdapter);
-};
+void HistogramHTTPStatusCode(const std::string& name, int status) {
+  // Log the status codes in rough buckets - 1XX, 2XX, etc.
+  int sample = status / 100;
+  // HTTP status codes only go up to 5XX, using "6" to indicate an internal
+  // error.
+  // Note: installed files may have "0" for a status code.
+  if (status < 0 || status >= 600)
+    sample = 6;
+  HistogramEnumerate(name, sample, 7, 6);
+}
 
 }  // namespace
 
@@ -544,6 +379,8 @@
                                   NaClSubprocess* subprocess,
                                   const Manifest* manifest,
                                   bool should_report_uma,
+                                  bool uses_irt,
+                                  bool uses_ppapi,
                                   ErrorInfo* error_info,
                                   pp::CompletionCallback init_done_cb,
                                   pp::CompletionCallback crash_cb) {
@@ -563,6 +400,8 @@
       new_service_runtime->Start(wrapper,
                                  error_info,
                                  manifest_base_url(),
+                                 uses_irt,
+                                 uses_ppapi,
                                  enable_dev_interfaces_,
                                  crash_cb);
   PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime_started=%d)\n",
@@ -583,7 +422,10 @@
   // outlive the Plugin object, they will not be memory safe.
   ShutDownSubprocesses();
   if (!LoadNaClModuleCommon(wrapper, &main_subprocess_, manifest_.get(),
-                            true, error_info, init_done_cb, crash_cb)) {
+                            true /* should_report_uma */,
+                            true /* uses_irt */,
+                            true /* uses_ppapi */,
+                            error_info, init_done_cb, crash_cb)) {
     return false;
   }
   PLUGIN_PRINTF(("Plugin::LoadNaClModule (%s)\n",
@@ -593,14 +435,18 @@
 
 bool Plugin::LoadNaClModuleContinuationIntern(ErrorInfo* error_info) {
   if (!main_subprocess_.StartSrpcServices()) {
-    error_info->SetReport(ERROR_SRPC_CONNECTION_FAIL,
-                          "SRPC connection failure for " +
-                          main_subprocess_.description());
+    // The NaCl process probably crashed. On Linux, a crash causes this error,
+    // while on other platforms, the error is detected below, when we attempt to
+    // start the proxy. Report a module initialization error here, to make it
+    // less confusing for developers.
+    NaClLog(LOG_ERROR, "LoadNaClModuleContinuationIntern: "
+            "StartSrpcServices failed\n");
+    error_info->SetReport(ERROR_START_PROXY_MODULE,
+                          "could not initialize module.");
     return false;
   }
-  // Try to start the Chrome IPC-based proxy first.
-  int32_t ipc_result = nacl_interface_->StartPpapiProxy(pp_instance());
-  if (ipc_result == PP_OK) {
+  PP_NaClResult ipc_result = nacl_interface_->StartPpapiProxy(pp_instance());
+  if (ipc_result == PP_NACL_OK) {
     // Log the amound of time that has passed between the trusted plugin being
     // initialized and the untrusted plugin being initialized.  This is
     // (roughly) the cost of using NaCl, in terms of startup time.
@@ -608,18 +454,16 @@
         "NaCl.Perf.StartupTime.NaClOverhead",
         static_cast<float>(NaClGetTimeOfDayMicroseconds() - init_time_)
             / NACL_MICROS_PER_MILLI);
-  } else if (ipc_result == PP_ERROR_NOTSUPPORTED) {
-    // PP_ERROR_NOTSUPPORTED signals that the IPC proxy isn't available and that
-    // we should try to start the SRPC proxy instead.
-    if (!main_subprocess_.StartJSObjectProxy(this, error_info)) {
-      return false;
-    }
-  } else {
-    // The IPC proxy failed to start. Log the error.
-    // TODO(bbudge) Find a way to report other startup errors.
+  } else if (ipc_result == PP_NACL_ERROR_MODULE) {
+    NaClLog(LOG_ERROR, "LoadNaClModuleContinuationIntern: "
+            "Got PP_NACL_ERROR_MODULE\n");
     error_info->SetReport(ERROR_START_PROXY_MODULE,
                           "could not initialize module.");
     return false;
+  } else if (ipc_result == PP_NACL_ERROR_INSTANCE) {
+    error_info->SetReport(ERROR_START_PROXY_INSTANCE,
+                          "could not create instance.");
+    return false;
   }
   PLUGIN_PRINTF(("Plugin::LoadNaClModule (%s)\n",
                  main_subprocess_.detailed_description().c_str()));
@@ -639,8 +483,15 @@
 
   // Do not report UMA stats for translator-related nexes.
   // TODO(sehr): define new UMA stats for translator related nexe events.
+  // NOTE: The PNaCl translator nexes are not built to use the IRT.  This is
+  // done to save on address space and swap space.  The PNaCl translator
+  // nexes also do not use PPAPI.  That allows the nexes to be launched
+  // off of the main thread and not block the UI.
   if (!LoadNaClModuleCommon(wrapper, nacl_subprocess.get(), manifest,
-                            false, error_info,
+                            false /* should_report_uma */,
+                            false /* uses_irt */,
+                            false /* uses_ppapi */,
+                            error_info,
                             pp::BlockUntilComplete(),
                             pp::BlockUntilComplete())) {
     return NULL;
@@ -838,8 +689,8 @@
       nexe_error_reported_(false),
       wrapper_factory_(NULL),
       last_error_string_(""),
-      ppapi_proxy_(NULL),
       enable_dev_interfaces_(false),
+      is_installed_(false),
       init_time_(0),
       ready_time_(0),
       nexe_size_(0),
@@ -862,9 +713,8 @@
                  static_cast<void*>(scriptable_plugin())));
   // Destroy the coordinator while the rest of the data is still there
   pnacl_coordinator_.reset(NULL);
-  // If the proxy has been shutdown before now, it's likely the plugin suffered
-  // an error while loading.
-  if (ppapi_proxy_ != NULL) {
+
+  if (!nexe_error_reported()) {
     HistogramTimeLarge(
         "NaCl.ModuleUptime.Normal",
         (shutdown_start - ready_time_) / NACL_MICROS_PER_MILLI);
@@ -872,7 +722,6 @@
 
   url_downloaders_.erase(url_downloaders_.begin(), url_downloaders_.end());
 
-  ShutdownProxy();
   ScriptablePlugin* scriptable_plugin_ = scriptable_plugin();
   ScriptablePlugin::Unref(&scriptable_plugin_);
 
@@ -915,75 +764,14 @@
                  static_cast<void*>(this)));
 }
 
-
-void Plugin::DidChangeView(const pp::View& view) {
-  PLUGIN_PRINTF(("Plugin::DidChangeView (this=%p)\n",
-                 static_cast<void*>(this)));
-
-  if (!BrowserPpp::is_valid(ppapi_proxy_)) {
-    // Store this event and replay it when the proxy becomes available.
-    view_to_replay_ = view;
-  } else {
-    ppapi_proxy_->ppp_instance_interface()->DidChangeView(
-        pp_instance(), view.pp_resource());
-  }
-}
-
-
-void Plugin::DidChangeFocus(bool has_focus) {
-  PLUGIN_PRINTF(("Plugin::DidChangeFocus (this=%p)\n",
-                 static_cast<void*>(this)));
-  if (BrowserPpp::is_valid(ppapi_proxy_)) {
-    ppapi_proxy_->ppp_instance_interface()->DidChangeFocus(
-        pp_instance(), PP_FromBool(has_focus));
-  }
-}
-
-
-bool Plugin::HandleInputEvent(const pp::InputEvent& event) {
-  PLUGIN_PRINTF(("Plugin::HandleInputEvent (this=%p)\n",
-                 static_cast<void*>(this)));
-  if (!BrowserPpp::is_valid(ppapi_proxy_) ||
-      ppapi_proxy_->ppp_input_event_interface() == NULL) {
-    return false;  // event is not handled here.
-  } else {
-    bool handled = PP_ToBool(
-        ppapi_proxy_->ppp_input_event_interface()->HandleInputEvent(
-            pp_instance(), event.pp_resource()));
-    PLUGIN_PRINTF(("Plugin::HandleInputEvent (handled=%d)\n", handled));
-    return handled;
-  }
-}
-
-
 bool Plugin::HandleDocumentLoad(const pp::URLLoader& url_loader) {
   PLUGIN_PRINTF(("Plugin::HandleDocumentLoad (this=%p)\n",
                  static_cast<void*>(this)));
-  if (!BrowserPpp::is_valid(ppapi_proxy_)) {
-    // Store this event and replay it when the proxy becomes available.
-    document_load_to_replay_ = url_loader;
-    // Return true so that the browser keeps servicing this loader so we can
-    // perform requests on it later.
-    return true;
-  } else {
-    return PP_ToBool(
-        ppapi_proxy_->ppp_instance_interface()->HandleDocumentLoad(
-            pp_instance(), url_loader.pp_resource()));
-  }
+  // We don't know if the plugin will handle the document load, but return
+  // true in order to give it a chance to respond once the proxy is started.
+  return true;
 }
 
-
-void Plugin::HandleMessage(const pp::Var& message) {
-  PLUGIN_PRINTF(("Plugin::HandleMessage (this=%p)\n",
-                 static_cast<void*>(this)));
-  if (BrowserPpp::is_valid(ppapi_proxy_) &&
-      ppapi_proxy_->ppp_messaging_interface() != NULL) {
-    ppapi_proxy_->ppp_messaging_interface()->HandleMessage(
-        pp_instance(), message.pp_var());
-  }
-}
-
-
 pp::Var Plugin::GetInstanceObject() {
   PLUGIN_PRINTF(("Plugin::GetInstanceObject (this=%p)\n",
                  static_cast<void*>(this)));
@@ -1018,10 +806,19 @@
   int32_t file_desc = nexe_downloader_.GetPOSIXFileDescriptor();
   PLUGIN_PRINTF(("Plugin::NexeFileDidOpen (file_desc=%"NACL_PRId32")\n",
                  file_desc));
+  HistogramHTTPStatusCode(
+      is_installed_ ?
+          "NaCl.HttpStatusCodeClass.Nexe.InstalledApp" :
+          "NaCl.HttpStatusCodeClass.Nexe.NotInstalledApp",
+      nexe_downloader_.status_code());
   ErrorInfo error_info;
   if (pp_error != PP_OK || file_desc == NACL_NO_FILE_DESC) {
     if (pp_error == PP_ERROR_ABORTED) {
       ReportLoadAbort();
+    } else if (pp_error == PP_ERROR_NOACCESS) {
+      error_info.SetReport(ERROR_NEXE_NOACCESS_URL,
+                           "access to nexe url was denied.");
+      ReportLoadError(error_info);
     } else {
       error_info.SetReport(ERROR_NEXE_LOAD_URL, "could not load nexe url.");
       ReportLoadError(error_info);
@@ -1111,7 +908,7 @@
   size_t ix_start = 0;
   size_t ix_end;
 
-  PLUGIN_PRINTF(("Plugin::CopyCrashLogToJsConsole: got %d bytes\n",
+  PLUGIN_PRINTF(("Plugin::CopyCrashLogToJsConsole: got %"NACL_PRIuS" bytes\n",
                  fatal_msg.size()));
   while (nacl::string::npos != (ix_end = fatal_msg.find('\n', ix_start))) {
     LogLineToConsole(this, fatal_msg.substr(ix_start, ix_end - ix_start));
@@ -1153,7 +950,7 @@
       ErrorInfo error_info;
       // The error is not quite right.  In particular, the crash
       // reported by this path could be due to NaCl application
-      // crashes that occur after the pepper proxy has started.
+      // crashes that occur after the PPAPI proxy has started.
       error_info.SetReport(ERROR_START_PROXY_CRASH,
                            "Nexe crashed during startup");
       ReportLoadError(error_info);
@@ -1177,8 +974,8 @@
     PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate error in Pnacl\n"));
     return;
   }
+
   // Inform JavaScript that we successfully translated the bitcode to a nexe.
-  EnqueueProgressEvent(kProgressEventProgress);
   nacl::scoped_ptr<nacl::DescWrapper>
       wrapper(pnacl_coordinator_.get()->ReleaseTranslatedFD());
   ErrorInfo error_info;
@@ -1199,111 +996,17 @@
   NaClLog(4, "Entered BitcodeDidTranslateContinuation\n");
   UNREFERENCED_PARAMETER(pp_error);
   if (was_successful) {
-    ReportLoadSuccess(LENGTH_IS_NOT_COMPUTABLE,
-                      kUnknownBytes,
-                      kUnknownBytes);
+    int64_t loaded;
+    int64_t total;
+    pnacl_coordinator_->GetCurrentProgress(&loaded, &total);
+    ReportLoadSuccess(LENGTH_IS_COMPUTABLE, loaded, total);
   } else {
     ReportLoadError(error_info);
   }
 }
 
-bool Plugin::StartProxiedExecution(NaClSrpcChannel* srpc_channel,
-                                   ErrorInfo* error_info) {
-  PLUGIN_PRINTF(("Plugin::StartProxiedExecution (srpc_channel=%p)\n",
-                 static_cast<void*>(srpc_channel)));
-
-  // Log the amound of time that has passed between the trusted plugin being
-  // initialized and the untrusted plugin being initialized.  This is (roughly)
-  // the cost of using NaCl, in terms of startup time.
-  HistogramStartupTimeMedium(
-      "NaCl.Perf.StartupTime.NaClOverhead",
-      static_cast<float>(NaClGetTimeOfDayMicroseconds() - init_time_)
-          / NACL_MICROS_PER_MILLI);
-
-  // Check that the .nexe exports the PPAPI intialization method.
-  NaClSrpcService* client_service = srpc_channel->client;
-  if (NaClSrpcServiceMethodIndex(client_service,
-                                 "PPP_InitializeModule:ihs:i") ==
-      kNaClSrpcInvalidMethodIndex) {
-    error_info->SetReport(
-        ERROR_START_PROXY_CHECK_PPP,
-        "could not find PPP_InitializeModule() - toolchain version mismatch?");
-    PLUGIN_PRINTF(("Plugin::StartProxiedExecution (%s)\n",
-                   error_info->message().c_str()));
-    return false;
-  }
-  nacl::scoped_ptr<BrowserPpp> ppapi_proxy(new BrowserPpp(srpc_channel, this));
-  PLUGIN_PRINTF(("Plugin::StartProxiedExecution (ppapi_proxy=%p)\n",
-                 static_cast<void*>(ppapi_proxy.get())));
-  if (ppapi_proxy.get() == NULL) {
-    error_info->SetReport(ERROR_START_PROXY_ALLOC,
-                          "could not allocate proxy memory.");
-    return false;
-  }
-  pp::Module* module = pp::Module::Get();
-  PLUGIN_PRINTF(("Plugin::StartProxiedExecution (module=%p)\n",
-                 static_cast<void*>(module)));
-  CHECK(module != NULL);  // We could not have gotten past init stage otherwise.
-  int32_t pp_error =
-      ppapi_proxy->InitializeModule(module->pp_module(),
-                                    module->get_browser_interface());
-  PLUGIN_PRINTF(("Plugin::StartProxiedExecution (pp_error=%"
-                 NACL_PRId32")\n", pp_error));
-  if (pp_error != PP_OK) {
-    error_info->SetReport(ERROR_START_PROXY_MODULE,
-                          "could not initialize module.");
-    return false;
-  }
-  const PPP_Instance* instance_interface =
-      ppapi_proxy->ppp_instance_interface();
-  PLUGIN_PRINTF(("Plugin::StartProxiedExecution (ppp_instance=%p)\n",
-                 static_cast<const void*>(instance_interface)));
-  CHECK(instance_interface != NULL);  // Verified on module initialization.
-  PP_Bool did_create = instance_interface->DidCreate(
-      pp_instance(),
-      argc(),
-      const_cast<const char**>(argn()),
-      const_cast<const char**>(argv()));
-  PLUGIN_PRINTF(("Plugin::StartProxiedExecution (did_create=%d)\n",
-                 did_create));
-  if (did_create == PP_FALSE) {
-    error_info->SetReport(ERROR_START_PROXY_INSTANCE,
-                          "could not create instance.");
-    return false;
-  }
-
-  ppapi_proxy_ = ppapi_proxy.release();
-
-  // Create PPP* interface adapters to forward calls to .nexe.
-  find_adapter_.reset(new FindAdapter(this));
-  mouse_lock_adapter_.reset(new MouseLockAdapter(this));
-  printing_adapter_.reset(new PrintingAdapter(this));
-  selection_adapter_.reset(new SelectionAdapter(this));
-  zoom_adapter_.reset(new ZoomAdapter(this));
-
-  // Replay missed events.
-  if (!view_to_replay_.is_null()) {
-    DidChangeView(view_to_replay_);
-    view_to_replay_ = pp::View();
-  }
-  if (!document_load_to_replay_.is_null()) {
-    HandleDocumentLoad(document_load_to_replay_);
-    document_load_to_replay_ = pp::URLLoader();
-  }
-  bool is_valid_proxy = BrowserPpp::is_valid(ppapi_proxy_);
-  PLUGIN_PRINTF(("Plugin::StartProxiedExecution (is_valid_proxy=%d)\n",
-                 is_valid_proxy));
-  if (!is_valid_proxy) {
-    error_info->SetReport(ERROR_START_PROXY_CRASH,
-                          "instance crashed after creation.");
-  }
-  return is_valid_proxy;
-}
-
 void Plugin::ReportDeadNexe() {
   PLUGIN_PRINTF(("Plugin::ReportDeadNexe\n"));
-  if (ppapi_proxy_ != NULL)
-    ppapi_proxy_->ReportDeadNexe();
 
   if (nacl_ready_state() == DONE && !nexe_error_reported()) {  // After loadEnd.
     int64_t crash_time = NaClGetTimeOfDayMicroseconds();
@@ -1319,30 +1022,15 @@
 
     EnqueueProgressEvent(kProgressEventCrash);
     set_nexe_error_reported(true);
-    CHECK(ppapi_proxy_ == NULL || !ppapi_proxy_->is_valid());
-    ShutdownProxy();
   }
   // else ReportLoadError() and ReportAbortError() will be used by loading code
-  // to provide error handling and proxy shutdown.
+  // to provide error handling.
   //
   // NOTE: not all crashes during load will make it here.
   // Those in BrowserPpp::InitializeModule and creation of PPP interfaces
   // will just get reported back as PP_ERROR_FAILED.
 }
 
-void Plugin::ShutdownProxy() {
-  PLUGIN_PRINTF(("Plugin::ShutdownProxy (ppapi_proxy=%p)\n",
-                static_cast<void*>(ppapi_proxy_)));
-  // We do not call remote PPP_Instance::DidDestroy because the untrusted
-  // side can no longer take full advantage of mostly asynchronous Pepper
-  // per-Instance interfaces at this point.
-  if (ppapi_proxy_ != NULL) {
-    ppapi_proxy_->ShutdownModule();
-    delete ppapi_proxy_;
-    ppapi_proxy_ = NULL;
-  }
-}
-
 void Plugin::NaClManifestBufferReady(int32_t pp_error) {
   PLUGIN_PRINTF(("Plugin::NaClManifestBufferReady (pp_error=%"
                  NACL_PRId32")\n", pp_error));
@@ -1385,6 +1073,11 @@
                  NACL_PRId32")\n", pp_error));
   HistogramTimeSmall("NaCl.Perf.StartupTime.ManifestDownload",
                      nexe_downloader_.TimeSinceOpenMilliseconds());
+  HistogramHTTPStatusCode(
+      is_installed_ ?
+          "NaCl.HttpStatusCodeClass.Manifest.InstalledApp" :
+          "NaCl.HttpStatusCodeClass.Manifest.NotInstalledApp",
+      nexe_downloader_.status_code());
   ErrorInfo error_info;
   // The manifest file was successfully opened.  Set the src property on the
   // plugin now, so that the full url is available to error handlers.
@@ -1395,6 +1088,10 @@
   if (pp_error != PP_OK || file_desc == NACL_NO_FILE_DESC) {
     if (pp_error == PP_ERROR_ABORTED) {
       ReportLoadAbort();
+    } else if (pp_error == PP_ERROR_NOACCESS) {
+      error_info.SetReport(ERROR_MANIFEST_NOACCESS_URL,
+                           "access to manifest url was denied.");
+      ReportLoadError(error_info);
     } else {
       error_info.SetReport(ERROR_MANIFEST_LOAD_URL,
                            "could not load manifest url.");
@@ -1477,29 +1174,34 @@
   HistogramSizeKB("NaCl.Perf.Size.Manifest",
                   static_cast<int32_t>(manifest_json.length() / 1024));
   nacl::string program_url;
-  nacl::string cache_identity;
-  bool is_portable;
+  PnaclOptions pnacl_options;
   ErrorInfo error_info;
   if (!SetManifestObject(manifest_json, &error_info)) {
     ReportLoadError(error_info);
     return;
   }
 
-  if (manifest_->GetProgramURL(&program_url, &cache_identity,
-                               &error_info, &is_portable)) {
+  if (manifest_->GetProgramURL(&program_url, &pnacl_options, &error_info)) {
+    is_installed_ = GetUrlScheme(program_url) == SCHEME_CHROME_EXTENSION;
     set_nacl_ready_state(LOADING);
     // Inform JavaScript that we found a nexe URL to load.
     EnqueueProgressEvent(kProgressEventProgress);
-    if (is_portable) {
-      pp::CompletionCallback translate_callback =
-          callback_factory_.NewCallback(&Plugin::BitcodeDidTranslate);
-      // Will always call the callback on success or failure.
-      pnacl_coordinator_.reset(
-          PnaclCoordinator::BitcodeToNative(this,
-                                            program_url,
-                                            cache_identity,
-                                            translate_callback));
-      return;
+    if (pnacl_options.translate()) {
+      if (this->nacl_interface()->IsPnaclEnabled()) {
+        pp::CompletionCallback translate_callback =
+            callback_factory_.NewCallback(&Plugin::BitcodeDidTranslate);
+        // Will always call the callback on success or failure.
+        pnacl_coordinator_.reset(
+            PnaclCoordinator::BitcodeToNative(this,
+                                              program_url,
+                                              pnacl_options,
+                                              translate_callback));
+        return;
+      } else {
+        error_info.SetReport(ERROR_PNACL_NOT_ENABLED,
+                             "PNaCl has not been enabled (e.g., by setting "
+                             "the --enable-pnacl flag).");
+      }
     } else {
       pp::CompletionCallback open_callback =
           callback_factory_.NewCallback(&Plugin::NexeFileDidOpen);
@@ -1508,6 +1210,7 @@
           nexe_downloader_.Open(program_url,
                                 DOWNLOAD_TO_FILE,
                                 open_callback,
+                                true,
                                 &UpdateDownloadProgress));
       return;
     }
@@ -1535,6 +1238,8 @@
   }
   PLUGIN_PRINTF(("Plugin::RequestNaClManifest (resolved url='%s')\n",
                  nmf_resolved_url.AsString().c_str()));
+  is_installed_ = GetUrlScheme(nmf_resolved_url.AsString()) ==
+      SCHEME_CHROME_EXTENSION;
   set_manifest_base_url(nmf_resolved_url.AsString());
   set_manifest_url(url);
   // Inform JavaScript that a load is starting.
@@ -1549,6 +1254,7 @@
     CHECK(nexe_downloader_.Open(nmf_resolved_url.AsString(),
                                 DOWNLOAD_TO_BUFFER,
                                 open_callback,
+                                false,
                                 NULL));
   } else {
     pp::CompletionCallback open_callback =
@@ -1557,6 +1263,7 @@
     CHECK(nexe_downloader_.Open(nmf_resolved_url.AsString(),
                                 DOWNLOAD_TO_FILE,
                                 open_callback,
+                                false,
                                 NULL));
   }
 }
@@ -1637,6 +1344,7 @@
   return downloader->Open(url,
                           DOWNLOAD_TO_FILE,
                           open_callback,
+                          true,
                           &UpdateDownloadProgress);
 }
 
@@ -1654,7 +1362,7 @@
       kProgressEventLoadEnd, url, length_computable, loaded_bytes, total_bytes);
 
   // UMA
-  HistogramEnumerateLoadStatus(ERROR_LOAD_SUCCESS);
+  HistogramEnumerateLoadStatus(ERROR_LOAD_SUCCESS, is_installed_);
 }
 
 
@@ -1662,6 +1370,15 @@
 void Plugin::ReportLoadError(const ErrorInfo& error_info) {
   PLUGIN_PRINTF(("Plugin::ReportLoadError (error='%s')\n",
                  error_info.message().c_str()));
+  // For errors the user (and not just the developer) should know about,
+  // report them to the renderer so the browser can display a message.
+  if (error_info.error_code() == ERROR_MANIFEST_PROGRAM_MISSING_ARCH) {
+    // A special case: the manifest may otherwise be valid but is missing
+    // a program/file compatible with the user's sandbox.
+    nacl_interface()->ReportNaClError(pp_instance(),
+                                      PP_NACL_MANIFEST_MISSING_ARCH);
+  }
+
   // Set the readyState attribute to indicate we need to start over.
   set_nacl_ready_state(DONE);
   set_nexe_error_reported(true);
@@ -1670,13 +1387,12 @@
       error_info.message();
   set_last_error_string(message);
   AddToConsole(message);
-  ShutdownProxy();
   // Inform JavaScript that loading encountered an error and is complete.
   EnqueueProgressEvent(kProgressEventError);
   EnqueueProgressEvent(kProgressEventLoadEnd);
 
   // UMA
-  HistogramEnumerateLoadStatus(error_info.error_code());
+  HistogramEnumerateLoadStatus(error_info.error_code(), is_installed_);
 }
 
 
@@ -1689,13 +1405,12 @@
   nacl::string error_string("NaCl module load failed: user aborted");
   set_last_error_string(error_string);
   AddToConsole(error_string);
-  ShutdownProxy();
   // Inform JavaScript that loading was aborted and is complete.
   EnqueueProgressEvent(kProgressEventAbort);
   EnqueueProgressEvent(kProgressEventLoadEnd);
 
   // UMA
-  HistogramEnumerateLoadStatus(ERROR_LOAD_ABORTED);
+  HistogramEnumerateLoadStatus(ERROR_LOAD_ABORTED, is_installed_);
 }
 
 void Plugin::UpdateDownloadProgress(
@@ -1789,7 +1504,8 @@
 }
 
 void Plugin::ReportSelLdrLoadStatus(int status) {
-  HistogramEnumerateSelLdrLoadStatus(static_cast<NaClErrorCode>(status));
+  HistogramEnumerateSelLdrLoadStatus(static_cast<NaClErrorCode>(status),
+                                     is_installed_);
 }
 
 void Plugin::DispatchProgressEvent(int32_t result) {
@@ -1890,6 +1606,11 @@
   return SCHEME_OTHER;
 }
 
+bool Plugin::DocumentCanRequest(const std::string& url) {
+  CHECK(url_util_ != NULL);
+  return url_util_->DocumentCanRequest(this, pp::Var(url));
+}
+
 void Plugin::AddToConsole(const nacl::string& text) {
   pp::Module* module = pp::Module::Get();
   const PPB_Var* var_interface =
@@ -1901,9 +1622,9 @@
                                  static_cast<uint32_t>(prefix_string.size()));
   PP_Var str = var_interface->VarFromUtf8(text.c_str(),
                                           static_cast<uint32_t>(text.size()));
-  const PPB_Console_Dev* console_interface =
-      static_cast<const PPB_Console_Dev*>(
-          module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE));
+  const PPB_Console* console_interface =
+      static_cast<const PPB_Console*>(
+          module->GetBrowserInterface(PPB_CONSOLE_INTERFACE));
   console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str);
   var_interface->Release(prefix);
   var_interface->Release(str);
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.gyp b/ppapi/native_client/src/trusted/plugin/plugin.gyp
index 432c4b5..2fb4018 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.gyp
+++ b/ppapi/native_client/src/trusted/plugin/plugin.gyp
@@ -74,7 +74,6 @@
         '<(DEPTH)/native_client/src/trusted/simple_service/simple_service.gyp:simple_service',
         '<(DEPTH)/native_client/src/trusted/reverse_service/reverse_service.gyp:reverse_service',
         '<(DEPTH)/native_client/src/trusted/weak_ref/weak_ref.gyp:weak_ref',
-        '<(DEPTH)/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy.gyp:nacl_ppapi_browser',
         '<(DEPTH)/ppapi/ppapi.gyp:ppapi_cpp',
         '<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp',
       ],
@@ -91,6 +90,8 @@
           },
         }],
       ],
+      # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
+      'msvs_disabled_warnings': [4267, ],
     },
   ],
 }
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.gypi b/ppapi/native_client/src/trusted/plugin/plugin.gypi
index bd908a9..4532f2f 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.gypi
+++ b/ppapi/native_client/src/trusted/plugin/plugin.gypi
@@ -13,6 +13,7 @@
       'nacl_subprocess.cc',
       'plugin.cc',
       'pnacl_coordinator.cc',
+      'pnacl_options.cc',
       'pnacl_resources.cc',
       'pnacl_translate_thread.cc',
       'scriptable_plugin.cc',
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h
index be0d241..b3b66a4 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.h
+++ b/ppapi/native_client/src/trusted/plugin/plugin.h
@@ -74,25 +74,13 @@
   // Gets called by the browser right after New().
   virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]);
 
-  // Handles view changes from the browser.
-  virtual void DidChangeView(const pp::View& view);
-
-  // Handles gaining or losing focus.
-  virtual void DidChangeFocus(bool has_focus);
-
-  // Handles input events delivered from the browser to this plugin element.
-  virtual bool HandleInputEvent(const pp::InputEvent& event);
-
-  // Handles gaining or losing focus.
+  // Handles document load, when the plugin is a MIME type handler.
   virtual bool HandleDocumentLoad(const pp::URLLoader& url_loader);
 
   // Returns a scriptable reference to this plugin element.
   // Called by JavaScript document.getElementById(plugin_id).
   virtual pp::Var GetInstanceObject();
 
-  // Handles postMessage from browser
-  virtual void HandleMessage(const pp::Var& message);
-
   // ----- Plugin interface support.
 
   // Load support.
@@ -103,12 +91,7 @@
   // done.  The module will become ready later, asynchronously.  Other
   // event handlers should block until the module is ready before
   // trying to communicate with it, i.e., until nacl_ready_state is
-  // DONE.  Note, however, we already have another mechanism that
-  // prevents event delivery: StartJSObjectProxy plumbs through
-  // NaClSubprocess to SrpcClient which upcalls
-  // Plugin::StartProxiedExecution, which sets ppapi_proxy_.  And NULL
-  // == ppapi_proxy_ prevents events from being delivered, even if
-  // nacl_ready_state is DONE.
+  // DONE.
   //
   // NB: currently we do not time out, so if the untrusted code
   // does not signal that it is ready, then we will deadlock the main
@@ -244,18 +227,6 @@
   // Requests a NaCl manifest download from a |url| relative to the page origin.
   void RequestNaClManifest(const nacl::string& url);
 
-  // Start up proxied execution of the browser API.
-  //
-  // NB: this is currently invoked from the main thread.  If we ever
-  // move it off the main thread (eliminate the possibility of a
-  // malicious nexe that isn't linked against / doesn't use our
-  // ppapi_proxy code that blocks the main thread on the RPCs used
-  // here), then we will need to take care to ensure that the error
-  // and crash reporting state machine (see NexeDidCrash comment)
-  // continues to work.
-  bool StartProxiedExecution(NaClSrpcChannel* srpc_channel,
-                             ErrorInfo* error_info);
-
   // Support for property getting.
   typedef void (Plugin::* PropertyGetter)(NaClSrpcArg* prop_value);
   void AddPropertyGet(const nacl::string& prop_name, PropertyGetter getter);
@@ -271,9 +242,6 @@
   // sizes return 0.
   static const uint64_t kUnknownBytes = 0;
 
-  // Getter for PPAPI proxy interface.
-  ppapi_proxy::BrowserPpp* ppapi_proxy() const { return ppapi_proxy_; }
-
   // Called back by CallOnMainThread.  Dispatches the first enqueued progress
   // event.
   void DispatchProgressEvent(int32_t result);
@@ -291,6 +259,11 @@
   // interface which this class has as a member.
   UrlSchemeType GetUrlScheme(const std::string& url);
 
+  // A helper function that indicates if |url| can be requested by the document
+  // under the same-origin policy. Strictly speaking, it may be possible for the
+  // document to request the URL using CORS even if this function returns false.
+  bool DocumentCanRequest(const std::string& url);
+
   // Get the text description of the last error reported by the plugin.
   const nacl::string& last_error_string() const { return last_error_string_; }
   void set_last_error_string(const nacl::string& error) {
@@ -350,6 +323,8 @@
                             NaClSubprocess* subprocess,
                             const Manifest* manifest,
                             bool should_report_uma,
+                            bool uses_irt,
+                            bool uses_ppapi,
                             ErrorInfo* error_info,
                             pp::CompletionCallback init_done_cb,
                             pp::CompletionCallback crash_cb);
@@ -418,9 +393,6 @@
                                  FileDownloader*& url_downloader,
                                  PP_CompletionCallback pp_callback);
 
-  // Shuts down the proxy for PPAPI nexes.
-  void ShutdownProxy();  // Nexe shutdown + proxy deletion.
-
   // Copy the main service runtime's most recent NaClLog output to the
   // JavaScript console.  Valid to use only after a crash, e.g., via a
   // detail level LOG_FATAL NaClLog entry.  If the crash was not due
@@ -466,15 +438,20 @@
   // produced by this plugin.
   nacl::string last_error_string_;
 
-  // A pointer to the browser end of a proxy pattern connecting the
-  // NaCl plugin to the PPAPI .nexe's PPP interface
-  // (InitializeModule, Shutdown, and GetInterface).
-  // TODO(sehr): this should be a scoped_ptr for shutdown.
-  ppapi_proxy::BrowserPpp* ppapi_proxy_;
-
   // PPAPI Dev interfaces are disabled by default.
   bool enable_dev_interfaces_;
 
+  // A flag indicating if the NaCl executable is being loaded from an installed
+  // application.  This flag is used to bucket UMA statistics more precisely to
+  // help determine whether nexe loading problems are caused by networking
+  // issues.  (Installed applications will be loaded from disk.)
+  // Unfortunately, the definition of what it means to be part of an installed
+  // application is a little murky - for example an installed application can
+  // register a mime handler that loads NaCl executables into an arbitrary web
+  // page.  As such, the flag actually means "our best guess, based on the URLs
+  // for NaCl resources that we have seen so far".
+  bool is_installed_;
+
   // If we get a DidChangeView event before the nexe is loaded, we store it and
   // replay it to nexe after it's loaded. We need to replay when this View
   // resource is non-is_null().
@@ -496,14 +473,6 @@
   // Pending progress events.
   std::queue<ProgressEvent*> progress_events_;
 
-  // Adapter class constructors require a reference to 'this', so we can't
-  // contain them directly.
-  nacl::scoped_ptr<pp::Find_Dev> find_adapter_;
-  nacl::scoped_ptr<pp::MouseLock> mouse_lock_adapter_;
-  nacl::scoped_ptr<pp::Printing_Dev> printing_adapter_;
-  nacl::scoped_ptr<pp::Selection_Dev> selection_adapter_;
-  nacl::scoped_ptr<pp::Zoom_Dev> zoom_adapter_;
-
   // Used for NexeFileDidOpenContinuation
   int64_t load_start_;
 
diff --git a/ppapi/native_client/src/trusted/plugin/plugin_error.h b/ppapi/native_client/src/trusted/plugin/plugin_error.h
index f811ba5..90c0284 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin_error.h
+++ b/ppapi/native_client/src/trusted/plugin/plugin_error.h
@@ -63,6 +63,41 @@
   ERROR_SEL_LDR_COMMUNICATION_WRAPPER = 35,
   ERROR_SEL_LDR_COMMUNICATION_REV_SERVICE = 36,
   ERROR_START_PROXY_CRASH = 37,
+  ERROR_MANIFEST_PROGRAM_MISSING_ARCH = 38,
+  ERROR_PNACL_CACHE_OPEN_INPROGRESS = 39,
+  ERROR_PNACL_CACHE_OPEN_NOACCESS = 40,
+  ERROR_PNACL_CACHE_OPEN_NOQUOTA = 41,
+  ERROR_PNACL_CACHE_OPEN_NOSPACE = 42,
+  ERROR_PNACL_CACHE_OPEN_OTHER = 43,
+  ERROR_PNACL_CACHE_DIRECTORY_CREATE = 44,
+  ERROR_PNACL_CACHE_FILEOPEN_NOACCESS = 45,
+  ERROR_PNACL_CACHE_FILEOPEN_NOQUOTA = 46,
+  ERROR_PNACL_CACHE_FILEOPEN_NOSPACE = 47,
+  ERROR_PNACL_CACHE_FILEOPEN_NOTAFILE = 48,
+  ERROR_PNACL_CACHE_FILEOPEN_OTHER = 49,
+  ERROR_PNACL_CACHE_FETCH_NOACCESS = 50,
+  ERROR_PNACL_CACHE_FETCH_NOTFOUND = 51,
+  ERROR_PNACL_CACHE_FETCH_OTHER = 52,
+  ERROR_PNACL_CACHE_FINALIZE_COPY_NOQUOTA = 53,
+  ERROR_PNACL_CACHE_FINALIZE_COPY_NOSPACE = 54,
+  ERROR_PNACL_CACHE_FINALIZE_COPY_OTHER = 55,
+  ERROR_PNACL_CACHE_FINALIZE_RENAME_NOACCESS = 56,
+  ERROR_PNACL_CACHE_FINALIZE_RENAME_OTHER = 57,
+  ERROR_PNACL_RESOURCE_FETCH = 58,
+  ERROR_PNACL_PEXE_FETCH_ABORTED = 59,
+  ERROR_PNACL_PEXE_FETCH_NOACCESS = 60,
+  ERROR_PNACL_PEXE_FETCH_OTHER = 61,
+  ERROR_PNACL_THREAD_CREATE = 62,
+  ERROR_PNACL_LLC_SETUP = 63,
+  ERROR_PNACL_LD_SETUP = 64,
+  ERROR_PNACL_LLC_INTERNAL = 65,
+  ERROR_PNACL_LD_INTERNAL = 66,
+  ERROR_PNACL_CREATE_TEMP = 67,
+  // Remove this next code when pnacl is no longer behind a flag (when we
+  // remove the --enable-pnacl flag).
+  ERROR_PNACL_NOT_ENABLED = 68,
+  ERROR_MANIFEST_NOACCESS_URL = 69,
+  ERROR_NEXE_NOACCESS_URL = 70,
   // If you add a code, read the enum comment above on how to update histograms.
   ERROR_MAX
 };
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
index b26c7f2..bcf6362 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
@@ -17,10 +17,12 @@
 #include "native_client/src/trusted/plugin/pnacl_translate_thread.h"
 #include "native_client/src/trusted/plugin/service_runtime.h"
 #include "native_client/src/trusted/plugin/temporary_file.h"
+#include "native_client/src/trusted/service_runtime/include/sys/stat.h"
 
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/c/ppb_file_io.h"
+#include "ppapi/c/private/ppb_uma_private.h"
 #include "ppapi/cpp/file_io.h"
 
 namespace {
@@ -46,14 +48,12 @@
   virtual ~PnaclManifest() { }
 
   virtual bool GetProgramURL(nacl::string* full_url,
-                             nacl::string* cache_identity,
-                             ErrorInfo* error_info,
-                             bool* pnacl_translate) const {
+                             PnaclOptions* pnacl_options,
+                             ErrorInfo* error_info) const {
     // Does not contain program urls.
     UNREFERENCED_PARAMETER(full_url);
-    UNREFERENCED_PARAMETER(cache_identity);
+    UNREFERENCED_PARAMETER(pnacl_options);
     UNREFERENCED_PARAMETER(error_info);
-    UNREFERENCED_PARAMETER(pnacl_translate);
     PLUGIN_PRINTF(("PnaclManifest does not contain a program\n"));
     error_info->SetReport(ERROR_MANIFEST_GET_NEXE_URL,
                           "pnacl manifest does not contain a program.");
@@ -79,13 +79,10 @@
 
   virtual bool ResolveKey(const nacl::string& key,
                           nacl::string* full_url,
-                          nacl::string* cache_identity,
-                          ErrorInfo* error_info,
-                          bool* pnacl_translate) const {
+                          PnaclOptions* pnacl_options,
+                          ErrorInfo* error_info) const {
     // All of the extension files are native (do not require pnacl translate).
-    *pnacl_translate = false;
-    // Do not cache these entries.
-    *cache_identity = "";
+    pnacl_options->set_translate(false);
     // We can only resolve keys in the files/ namespace.
     const nacl::string kFilesPrefix = "files/";
     size_t files_prefix_pos = key.find(kFilesPrefix);
@@ -123,15 +120,14 @@
   virtual ~PnaclLDManifest() { }
 
   virtual bool GetProgramURL(nacl::string* full_url,
-                             nacl::string* cache_identity,
-                             ErrorInfo* error_info,
-                             bool* pnacl_translate) const {
-    if (nexe_manifest_->GetProgramURL(full_url, cache_identity,
-                                      error_info, pnacl_translate)) {
+                             PnaclOptions* pnacl_options,
+                             ErrorInfo* error_info) const {
+    if (nexe_manifest_->GetProgramURL(full_url, pnacl_options, error_info)) {
       return true;
     }
-    return extension_manifest_->GetProgramURL(full_url, cache_identity,
-                                              error_info, pnacl_translate);
+    return extension_manifest_->GetProgramURL(full_url,
+                                              pnacl_options,
+                                              error_info);
   }
 
   virtual bool ResolveURL(const nacl::string& relative_url,
@@ -152,15 +148,14 @@
 
   virtual bool ResolveKey(const nacl::string& key,
                           nacl::string* full_url,
-                          nacl::string* cache_identity,
-                          ErrorInfo* error_info,
-                          bool* pnacl_translate) const {
-    if (nexe_manifest_->ResolveKey(key, full_url, cache_identity,
-                                   error_info, pnacl_translate)) {
+                          PnaclOptions* pnacl_options,
+                          ErrorInfo* error_info) const {
+    if (nexe_manifest_->ResolveKey(key, full_url, pnacl_options, error_info)) {
       return true;
     }
-    return extension_manifest_->ResolveKey(key, full_url, cache_identity,
-                                           error_info, pnacl_translate);
+    return extension_manifest_->ResolveKey(key, full_url,
+                                           pnacl_options,
+                                           error_info);
   }
 
  private:
@@ -171,6 +166,114 @@
 };
 
 //////////////////////////////////////////////////////////////////////
+//  UMA stat helpers.
+//////////////////////////////////////////////////////////////////////
+
+namespace {
+
+// Assume translation time metrics *can be* large.
+// Up to 12 minutes.
+const int64_t kTimeLargeMin = 10;          // in ms
+const int64_t kTimeLargeMax = 720000;      // in ms
+const uint32_t kTimeLargeBuckets = 100;
+
+const int32_t kSizeKBMin = 1;
+const int32_t kSizeKBMax = 512*1024;       // very large .pexe / .nexe.
+const uint32_t kSizeKBBuckets = 100;
+
+const int32_t kRatioMin = 10;
+const int32_t kRatioMax = 10*100;          // max of 10x difference.
+const uint32_t kRatioBuckets = 100;
+
+const int32_t kKBPSMin = 1;
+const int32_t kKBPSMax = 30*1000;          // max of 30 MB / sec.
+const uint32_t kKBPSBuckets = 100;
+
+const PPB_UMA_Private* uma_interface = NULL;
+
+const PPB_UMA_Private* GetUMAInterface() {
+  if (uma_interface != NULL) {
+    return uma_interface;
+  }
+  pp::Module *module = pp::Module::Get();
+  DCHECK(module);
+  uma_interface = static_cast<const PPB_UMA_Private*>(
+      module->GetBrowserInterface(PPB_UMA_PRIVATE_INTERFACE));
+  return uma_interface;
+}
+
+void HistogramTime(const std::string& name, int64_t ms) {
+  if (ms < 0) return;
+
+  const PPB_UMA_Private* ptr = GetUMAInterface();
+  if (ptr == NULL) return;
+
+  ptr->HistogramCustomTimes(pp::Var(name).pp_var(),
+                            ms,
+                            kTimeLargeMin, kTimeLargeMax,
+                            kTimeLargeBuckets);
+}
+
+void HistogramSizeKB(const std::string& name, int32_t kb) {
+  if (kb < 0) return;
+
+  const PPB_UMA_Private* ptr = GetUMAInterface();
+  if (ptr == NULL) return;
+
+  ptr->HistogramCustomCounts(pp::Var(name).pp_var(),
+                             kb,
+                             kSizeKBMin, kSizeKBMax,
+                             kSizeKBBuckets);
+}
+
+void HistogramRatio(const std::string& name, int64_t a, int64_t b) {
+  if (a < 0 || b <= 0) return;
+
+  const PPB_UMA_Private* ptr = GetUMAInterface();
+  if (ptr == NULL) return;
+
+  ptr->HistogramCustomCounts(pp::Var(name).pp_var(),
+                             100 * a / b,
+                             kRatioMin, kRatioMax,
+                             kRatioBuckets);
+}
+
+void HistogramKBPerSec(const std::string& name, double kb, double s) {
+  if (kb < 0.0 || s <= 0.0) return;
+
+  const PPB_UMA_Private* ptr = GetUMAInterface();
+  if (ptr == NULL) return;
+
+  ptr->HistogramCustomCounts(pp::Var(name).pp_var(),
+                             static_cast<int64_t>(kb / s),
+                             kKBPSMin, kKBPSMax,
+                             kKBPSBuckets);
+}
+
+void HistogramEnumerateTranslationCache(bool hit) {
+  const PPB_UMA_Private* ptr = GetUMAInterface();
+  if (ptr == NULL) return;
+  ptr->HistogramEnumeration(pp::Var("NaCl.Perf.PNaClCache.IsHit").pp_var(),
+                            hit, 2);
+}
+
+// Opt level is expected to be 0 to 3.  Treating 4 as unknown.
+const int8_t kOptUnknown = 4;
+
+void HistogramOptLevel(int8_t opt_level) {
+  const PPB_UMA_Private* ptr = GetUMAInterface();
+  if (ptr == NULL) return;
+  if (opt_level < 0 || opt_level > 3) {
+    opt_level = kOptUnknown;
+  }
+  ptr->HistogramEnumeration(pp::Var("NaCl.Options.PNaCl.OptLevel").pp_var(),
+                            opt_level, kOptUnknown+1);
+}
+
+}  // namespace
+
+
+//////////////////////////////////////////////////////////////////////
 //  The coordinator class.
 //////////////////////////////////////////////////////////////////////
 
@@ -182,17 +285,19 @@
 PnaclCoordinator* PnaclCoordinator::BitcodeToNative(
     Plugin* plugin,
     const nacl::string& pexe_url,
-    const nacl::string& cache_identity,
+    const PnaclOptions& pnacl_options,
     const pp::CompletionCallback& translate_notify_callback) {
   PLUGIN_PRINTF(("PnaclCoordinator::BitcodeToNative (plugin=%p, pexe=%s)\n",
                  static_cast<void*>(plugin), pexe_url.c_str()));
   PnaclCoordinator* coordinator =
       new PnaclCoordinator(plugin, pexe_url,
-                           cache_identity, translate_notify_callback);
+                           pnacl_options,
+                           translate_notify_callback);
+  coordinator->pnacl_init_time_ = NaClGetTimeOfDayMicroseconds();
   coordinator->off_the_record_ =
       plugin->nacl_interface()->IsOffTheRecord();
   PLUGIN_PRINTF(("PnaclCoordinator::BitcodeToNative (manifest=%p, "
-                 "off_the_record=%b)\n",
+                 "off_the_record=%d)\n",
                  reinterpret_cast<const void*>(coordinator->manifest_.get()),
                  coordinator->off_the_record_));
 
@@ -227,7 +332,9 @@
     if (pp_error == PP_ERROR_ABORTED) {
       plugin_->ReportLoadAbort();
     } else {
-      ReportPpapiError(pp_error, component + " load failed.");
+      ReportPpapiError(ERROR_PNACL_RESOURCE_FETCH,
+                       pp_error,
+                       component + " load failed.");
     }
     return NACL_NO_FILE_DESC;
   }
@@ -237,7 +344,7 @@
 PnaclCoordinator::PnaclCoordinator(
     Plugin* plugin,
     const nacl::string& pexe_url,
-    const nacl::string& cache_identity,
+    const PnaclOptions& pnacl_options,
     const pp::CompletionCallback& translate_notify_callback)
   : translate_finish_error_(PP_OK),
     plugin_(plugin),
@@ -247,9 +354,13 @@
         plugin->url_util(),
         plugin::PnaclUrls::UsePnaclExtension(plugin))),
     pexe_url_(pexe_url),
-    cache_identity_(cache_identity),
+    pnacl_options_(pnacl_options),
     error_already_reported_(false),
-    off_the_record_(false) {
+    off_the_record_(false),
+    pnacl_init_time_(0),
+    pexe_size_(0),
+    pexe_bytes_compiled_(0),
+    expected_pexe_size_(-1) {
   PLUGIN_PRINTF(("PnaclCoordinator::PnaclCoordinator (this=%p, plugin=%p)\n",
                  static_cast<void*>(this), static_cast<void*>(plugin)));
   callback_factory_.Initialize(this);
@@ -270,23 +381,26 @@
   }
 }
 
-void PnaclCoordinator::ReportNonPpapiError(const nacl::string& message) {
-  error_info_.SetReport(ERROR_UNKNOWN,
+void PnaclCoordinator::ReportNonPpapiError(enum PluginErrorCode err_code,
+                                           const nacl::string& message) {
+  error_info_.SetReport(err_code,
                         nacl::string("PnaclCoordinator: ") + message);
-  ReportPpapiError(PP_ERROR_FAILED);
+  ExitWithError();
 }
 
-void PnaclCoordinator::ReportPpapiError(int32_t pp_error,
+void PnaclCoordinator::ReportPpapiError(enum PluginErrorCode err_code,
+                                        int32_t pp_error,
                                         const nacl::string& message) {
-  error_info_.SetReport(ERROR_UNKNOWN,
-                        nacl::string("PnaclCoordinator: ") + message);
-  ReportPpapiError(pp_error);
+  nacl::stringstream ss;
+  ss << "PnaclCoordinator: " << message << " (pp_error=" << pp_error << ").";
+  error_info_.SetReport(err_code, ss.str());
+  ExitWithError();
 }
 
-void PnaclCoordinator::ReportPpapiError(int32_t pp_error) {
-  PLUGIN_PRINTF(("PnaclCoordinator::ReportPpappiError (pp_error=%"
-                 NACL_PRId32", error_code=%d, message='%s')\n",
-                 pp_error, error_info_.error_code(),
+void PnaclCoordinator::ExitWithError() {
+  PLUGIN_PRINTF(("PnaclCoordinator::ExitWithError (error_code=%d, "
+                 "message='%s')\n",
+                 error_info_.error_code(),
                  error_info_.message().c_str()));
   plugin_->ReportLoadError(error_info_);
   // Free all the intermediate callbacks we ever created.
@@ -298,9 +412,9 @@
   callback_factory_.CancelAll();
   if (!error_already_reported_) {
     error_already_reported_ = true;
-    translate_notify_callback_.Run(pp_error);
+    translate_notify_callback_.Run(PP_ERROR_FAILED);
   } else {
-    PLUGIN_PRINTF(("PnaclCoordinator::ReportPpapiError an earlier error was "
+    PLUGIN_PRINTF(("PnaclCoordinator::ExitWithError an earlier error was "
                    "already reported -- Skipping.\n"));
   }
 }
@@ -311,23 +425,53 @@
                  NACL_PRId32")\n", pp_error));
   // Bail out if there was an earlier error (e.g., pexe load failure).
   if (translate_finish_error_ != PP_OK) {
-    ReportPpapiError(translate_finish_error_);
+    ExitWithError();
     return;
   }
   // Bail out if there is an error from the translation thread.
   if (pp_error != PP_OK) {
-    ReportPpapiError(pp_error);
+    ExitWithError();
     return;
   }
 
+  // If there are no errors, report stats from this thread (the main thread).
+  HistogramOptLevel(pnacl_options_.opt_level());
+  const plugin::PnaclTimeStats& time_stats = translate_thread_->GetTimeStats();
+  HistogramTime("NaCl.Perf.PNaClLoadTime.LoadCompiler",
+                time_stats.pnacl_llc_load_time / NACL_MICROS_PER_MILLI);
+  HistogramTime("NaCl.Perf.PNaClLoadTime.CompileTime",
+                time_stats.pnacl_compile_time / NACL_MICROS_PER_MILLI);
+  HistogramKBPerSec("NaCl.Perf.PNaClLoadTime.CompileKBPerSec",
+                    pexe_size_ / 1024.0,
+                    time_stats.pnacl_compile_time / 1000000.0);
+  HistogramTime("NaCl.Perf.PNaClLoadTime.LoadLinker",
+                time_stats.pnacl_ld_load_time / NACL_MICROS_PER_MILLI);
+  HistogramTime("NaCl.Perf.PNaClLoadTime.LinkTime",
+                time_stats.pnacl_link_time / NACL_MICROS_PER_MILLI);
+  HistogramSizeKB("NaCl.Perf.Size.Pexe",
+                  static_cast<int64_t>(pexe_size_ / 1024));
+
+  struct nacl_abi_stat stbuf;
+  struct NaClDesc* desc = temp_nexe_file_->read_wrapper()->desc();
+  int stat_ret;
+  if (0 != (stat_ret = (*((struct NaClDescVtbl const *) desc->base.vtbl)->
+                        Fstat)(desc, &stbuf))) {
+    PLUGIN_PRINTF(("PnaclCoordinator::TranslateFinished can't stat nexe.\n"));
+  } else {
+    size_t nexe_size = stbuf.nacl_abi_st_size;
+    HistogramSizeKB("NaCl.Perf.Size.PNaClTranslatedNexe",
+                    static_cast<int64_t>(nexe_size / 1024));
+    HistogramRatio("NaCl.Perf.Size.PexeNexeSizePct", pexe_size_, nexe_size);
+  }
+
   // The nexe is written to the temp_nexe_file_.  We must Reset() the file
   // pointer to be able to read it again from the beginning.
   temp_nexe_file_->Reset();
 
-  if (cache_identity_ != "" && cached_nexe_file_ != NULL) {
+  if (pnacl_options_.HasCacheKey() && cached_nexe_file_ != NULL) {
     // We are using a cache, but had a cache miss, which is why we did the
     // translation.  Reset cached_nexe_file_ to have a random name,
-    // for scratch purposes, before renaming to the final cache_identity_.
+    // for scratch purposes, before renaming to the final cache_identity.
     cached_nexe_file_.reset(new LocalTempFile(plugin_, file_system_.get(),
                                               nacl::string(kPnaclTempDir)));
     pp::CompletionCallback cb = callback_factory_.NewCallback(
@@ -343,7 +487,40 @@
 
 void PnaclCoordinator::CachedNexeOpenedForWrite(int32_t pp_error) {
   if (pp_error != PP_OK) {
-    ReportPpapiError(pp_error, "Failed to open cache file for write.");
+    if (pp_error == PP_ERROR_NOACCESS) {
+      ReportPpapiError(
+          ERROR_PNACL_CACHE_FILEOPEN_NOACCESS,
+          pp_error,
+          "PNaCl translation cache failed to open file for write "
+          "(no access).");
+      return;
+    }
+    if (pp_error == PP_ERROR_NOQUOTA) {
+      ReportPpapiError(
+          ERROR_PNACL_CACHE_FILEOPEN_NOQUOTA,
+          pp_error,
+          "PNaCl translation cache failed to open file for write "
+          "(no quota).");
+      return;
+    }
+    if (pp_error == PP_ERROR_NOSPACE) {
+      ReportPpapiError(
+          ERROR_PNACL_CACHE_FILEOPEN_NOSPACE,
+          pp_error,
+          "PNaCl translation cache failed to open file for write "
+          "(no space).");
+      return;
+    }
+    if (pp_error == PP_ERROR_NOTAFILE) {
+      ReportPpapiError(ERROR_PNACL_CACHE_FILEOPEN_NOTAFILE,
+                       pp_error,
+                       "PNaCl translation cache failed to open file for write."
+                       "  File already exists as a directory.");
+      return;
+    }
+    ReportPpapiError(ERROR_PNACL_CACHE_FILEOPEN_OTHER,
+                     pp_error,
+                     "PNaCl translation cache failed to open file for write.");
     return;
   }
 
@@ -434,28 +611,85 @@
 
 void PnaclCoordinator::NexeWasCopiedToCache(int32_t pp_error) {
   if (pp_error != PP_OK) {
-    // TODO(jvoung): This should probably try to delete the cache file
-    // before returning...
-    ReportPpapiError(pp_error, "Failed to copy nexe to cache.");
+    // Try to delete the partially written not-yet-committed cache file before
+    // returning. We pass the current pp_error along so that it can be reported
+    // before returning.
+    pp::CompletionCallback cb = callback_factory_.NewCallback(
+        &PnaclCoordinator::CorruptCacheFileWasDeleted, pp_error);
+    cached_nexe_file_->Delete(cb);
     return;
   }
   // Rename the cached_nexe_file_ file to the cache id, to finalize.
   pp::CompletionCallback cb =
       callback_factory_.NewCallback(&PnaclCoordinator::NexeFileWasRenamed);
-  cached_nexe_file_->Rename(cache_identity_, cb);
+  cached_nexe_file_->Rename(pnacl_options_.GetCacheKey(), cb);
+}
+
+void PnaclCoordinator::CorruptCacheFileWasDeleted(int32_t delete_pp_error,
+                                                  int32_t orig_pp_error) {
+  if (delete_pp_error != PP_OK) {
+    // The cache file was certainly already opened by the time we tried
+    // to write to it, so it should certainly be deletable.
+    PLUGIN_PRINTF(("PnaclCoordinator::CorruptCacheFileWasDeleted "
+                   "delete failed with pp_error=%"NACL_PRId32"\n",
+                   delete_pp_error));
+    // fall through and report the original error.
+  }
+  // Report the original error that caused us to consider the
+  // cache file corrupted.
+  if (orig_pp_error == PP_ERROR_NOQUOTA) {
+    ReportPpapiError(ERROR_PNACL_CACHE_FINALIZE_COPY_NOQUOTA,
+                     orig_pp_error,
+                     "Failed to copy translated nexe to cache (no quota).");
+    return;
+  }
+  if (orig_pp_error == PP_ERROR_NOSPACE) {
+    ReportPpapiError(ERROR_PNACL_CACHE_FINALIZE_COPY_NOSPACE,
+                     orig_pp_error,
+                     "Failed to copy translated nexe to cache (no space).");
+      return;
+  }
+  ReportPpapiError(ERROR_PNACL_CACHE_FINALIZE_COPY_OTHER,
+                   orig_pp_error,
+                   "Failed to copy translated nexe to cache.");
+  return;
 }
 
 void PnaclCoordinator::NexeFileWasRenamed(int32_t pp_error) {
   PLUGIN_PRINTF(("PnaclCoordinator::NexeFileWasRenamed (pp_error=%"
                  NACL_PRId32")\n", pp_error));
-  // NOTE: if the file already existed, it looks like the rename will
-  // happily succeed. However, we should add a test for this.
   if (pp_error != PP_OK) {
-    ReportPpapiError(pp_error, "Failed to place cached bitcode translation.");
-    return;
+    if (pp_error == PP_ERROR_NOACCESS) {
+      ReportPpapiError(ERROR_PNACL_CACHE_FINALIZE_RENAME_NOACCESS,
+                       pp_error,
+                       "Failed to finalize cached translation (no access).");
+      return;
+    } else if (pp_error != PP_ERROR_FILEEXISTS) {
+      ReportPpapiError(ERROR_PNACL_CACHE_FINALIZE_RENAME_OTHER,
+                       pp_error,
+                       "Failed to finalize cached translation.");
+      return;
+    } else { // pp_error == PP_ERROR_FILEEXISTS.
+      // NOTE: if the file already existed, it looks like the rename will
+      // happily succeed.  However, we should add a test for this.
+      // Could be a hash collision, or it could also be two tabs racing to
+      // translate the same pexe. We may want UMA stats to know if this happens.
+      // For now, assume that it is a race and try to continue.
+      // If there is truly a corrupted file, then sel_ldr should prevent the
+      // file from loading due to the file size not matching the ELF header.
+      PLUGIN_PRINTF(("PnaclCoordinator::NexeFileWasRenamed file existed\n"));
+    }
   }
 
   cached_nexe_file_->FinishRename();
+
+  int64_t total_time = NaClGetTimeOfDayMicroseconds() - pnacl_init_time_;
+  HistogramTime("NaCl.Perf.PNaClLoadTime.TotalUncachedTime",
+                total_time / NACL_MICROS_PER_MILLI);
+  HistogramKBPerSec("NaCl.Perf.PNaClLoadTime.TotalUncachedKBPerSec",
+                    pexe_size_ / 1024.0,
+                    total_time / 1000000.0);
+
   // Open the cache file for reading.
   pp::CompletionCallback cb =
       callback_factory_.NewCallback(&PnaclCoordinator::NexeReadDidOpen);
@@ -466,7 +700,21 @@
   PLUGIN_PRINTF(("PnaclCoordinator::NexeReadDidOpen (pp_error=%"
                  NACL_PRId32")\n", pp_error));
   if (pp_error != PP_OK) {
-    ReportPpapiError(pp_error, "Failed to open translated nexe.");
+    if (pp_error == PP_ERROR_FILENOTFOUND) {
+      ReportPpapiError(ERROR_PNACL_CACHE_FETCH_NOTFOUND,
+                       pp_error,
+                       "Failed to open translated nexe (not found).");
+      return;
+    }
+    if (pp_error == PP_ERROR_NOACCESS) {
+      ReportPpapiError(ERROR_PNACL_CACHE_FETCH_NOACCESS,
+                       pp_error,
+                       "Failed to open translated nexe (no access).");
+      return;
+    }
+    ReportPpapiError(ERROR_PNACL_CACHE_FETCH_OTHER,
+                     pp_error,
+                     "Failed to open translated nexe.");
     return;
   }
 
@@ -476,7 +724,6 @@
   } else {
     translated_fd_.reset(temp_nexe_file_->release_read_wrapper());
   }
-  plugin_->EnqueueProgressEvent(Plugin::kProgressEventProgress);
   translate_notify_callback_.Run(pp_error);
 }
 
@@ -484,7 +731,8 @@
   PLUGIN_PRINTF(("PnaclCoordinator::ResourcesDidLoad (pp_error=%"
                  NACL_PRId32")\n", pp_error));
   if (pp_error != PP_OK) {
-    ReportPpapiError(pp_error, "resources failed to load.");
+    // Finer-grained error code should have already been reported by
+    // the PnaclResources class.
     return;
   }
 
@@ -492,8 +740,24 @@
     // Open the local temporary FS to see if we get a hit in the cache.
     pp::CompletionCallback cb =
         callback_factory_.NewCallback(&PnaclCoordinator::FileSystemDidOpen);
-    if (!file_system_->Open(0, cb)) {
-      ReportNonPpapiError("failed to open file system.");
+    int32_t open_error = file_system_->Open(0, cb);
+    if (open_error != PP_OK_COMPLETIONPENDING) {
+      // At this point, no async request has kicked off to check for
+      // permissions, space, etc., so the only error that can be detected
+      // now is that an open() is already in progress (or a really terrible
+      // error).
+      if (pp_error == PP_ERROR_INPROGRESS) {
+        ReportPpapiError(
+            ERROR_PNACL_CACHE_OPEN_INPROGRESS,
+            pp_error,
+            "File system for PNaCl translation cache failed to open "
+            "(in progress).");
+        return;
+      }
+      ReportPpapiError(
+          ERROR_PNACL_CACHE_OPEN_OTHER,
+          pp_error,
+          "File system for PNaCl translation cache failed to open.");
     }
   } else {
     // We don't have a cache, so do the non-cached codepath.
@@ -505,8 +769,33 @@
   PLUGIN_PRINTF(("PnaclCoordinator::FileSystemDidOpen (pp_error=%"
                  NACL_PRId32")\n", pp_error));
   if (pp_error != PP_OK) {
-    ReportPpapiError(pp_error, "file system didn't open.");
-    return;
+    if (pp_error == PP_ERROR_NOACCESS) {
+      ReportPpapiError(
+          ERROR_PNACL_CACHE_OPEN_NOACCESS,
+          pp_error,
+          "File system for PNaCl translation cache failed to open "
+          "(no access).");
+      return;
+    }
+    if (pp_error == PP_ERROR_NOQUOTA) {
+      ReportPpapiError(
+          ERROR_PNACL_CACHE_OPEN_NOQUOTA,
+          pp_error,
+          "File system for PNaCl translation cache failed to open "
+          "(no quota).");
+      return;
+    }
+    if (pp_error == PP_ERROR_NOSPACE) {
+      ReportPpapiError(
+          ERROR_PNACL_CACHE_OPEN_NOSPACE,
+          pp_error,
+          "File system for PNaCl translation cache failed to open "
+          "(no space).");
+      return;
+    }
+    ReportPpapiError(ERROR_PNACL_CACHE_OPEN_OTHER,
+                     pp_error,
+                     "File system for PNaCl translation cache failed to open.");
   }
   dir_ref_.reset(new pp::FileRef(*file_system_, kPnaclTempDir));
   // Attempt to create the directory.
@@ -520,13 +809,25 @@
                  NACL_PRId32")\n", pp_error));
   if (pp_error != PP_ERROR_FILEEXISTS && pp_error != PP_OK) {
     // Directory did not exist and could not be created.
-    ReportPpapiError(pp_error, "directory creation/check failed.");
+    if (pp_error == PP_ERROR_NOACCESS) {
+      ReportPpapiError(
+          ERROR_PNACL_CACHE_DIRECTORY_CREATE,
+          pp_error,
+          "PNaCl translation cache directory creation/check failed "
+          "(no access).");
+      return;
+    }
+    ReportPpapiError(
+        ERROR_PNACL_CACHE_DIRECTORY_CREATE,
+        pp_error,
+        "PNaCl translation cache directory creation/check failed.");
     return;
   }
-  if (cache_identity_ != "") {
-    cached_nexe_file_.reset(new LocalTempFile(plugin_, file_system_.get(),
-                                              nacl::string(kPnaclTempDir),
-                                              cache_identity_));
+  if (pnacl_options_.HasCacheKey()) {
+    cached_nexe_file_.reset(new LocalTempFile(
+        plugin_, file_system_.get(),
+        nacl::string(kPnaclTempDir),
+        pnacl_options_.GetCacheKey()));
     pp::CompletionCallback cb =
         callback_factory_.NewCallback(&PnaclCoordinator::CachedFileDidOpen);
     cached_nexe_file_->OpenRead(cb);
@@ -540,16 +841,21 @@
   PLUGIN_PRINTF(("PnaclCoordinator::CachedFileDidOpen (pp_error=%"
                  NACL_PRId32")\n", pp_error));
   if (pp_error == PP_OK) {
+    HistogramEnumerateTranslationCache(true);
     NexeReadDidOpen(PP_OK);
     return;
   }
+  // Otherwise, the cache file is missing, or the cache simply
+  // cannot be created (e.g., incognito mode), so we must translate.
+  HistogramEnumerateTranslationCache(false);
 
   // Create the translation thread object immediately. This ensures that any
   // pieces of the file that get downloaded before the compilation thread
   // is accepting SRPCs won't get dropped.
   translate_thread_.reset(new PnaclTranslateThread());
   if (translate_thread_ == NULL) {
-    ReportNonPpapiError("could not allocate translation thread.");
+    ReportNonPpapiError(ERROR_PNACL_THREAD_CREATE,
+                        "could not allocate translation thread.");
     return;
   }
   // We also want to open the object file now so the
@@ -565,9 +871,9 @@
       callback_factory_.NewCallback(
           &PnaclCoordinator::BitcodeStreamDidFinish);
 
-  // TODO(dschuff): need to use url_util_->ResolveRelativeToURL?
   if (!streaming_downloader_->OpenStream(pexe_url_, cb, this)) {
-    ReportNonPpapiError(nacl::string("failed to open stream ") + pexe_url_);
+    ReportNonPpapiError(ERROR_PNACL_PEXE_FETCH_OTHER,
+                        nacl::string("failed to open stream ") + pexe_url_);
   }
 }
 
@@ -579,9 +885,23 @@
     // thread returns, because it may be accessing the coordinator's
     // objects or writing to the files.
     translate_finish_error_ = pp_error;
-    error_info_.SetReport(ERROR_UNKNOWN,
-                          nacl::string("PnaclCoordinator: pexe load failed."));
+    if (pp_error == PP_ERROR_ABORTED) {
+      error_info_.SetReport(ERROR_PNACL_PEXE_FETCH_ABORTED,
+                            "PnaclCoordinator: pexe load failed (aborted).");
+    }
+    if (pp_error == PP_ERROR_NOACCESS) {
+      error_info_.SetReport(ERROR_PNACL_PEXE_FETCH_NOACCESS,
+                            "PnaclCoordinator: pexe load failed (no access).");
+    } else {
+      nacl::stringstream ss;
+      ss << "PnaclCoordinator: pexe load failed (pp_error=" << pp_error << ").";
+      error_info_.SetReport(ERROR_PNACL_PEXE_FETCH_OTHER, ss.str());
+    }
     translate_thread_->AbortSubprocesses();
+  } else {
+    // Compare download completion pct (100% now), to compile completion pct.
+    HistogramRatio("NaCl.Perf.PNaClLoadTime.PctCompiledWhenFullyDownloaded",
+                   pexe_bytes_compiled_, pexe_size_);
   }
 }
 
@@ -591,6 +911,10 @@
                  NACL_PRId32", data=%p)\n", pp_error, data ? &(*data)[0] : 0));
   DCHECK(translate_thread_.get());
   translate_thread_->PutBytes(data, pp_error);
+  // If pp_error > 0, then it represents the number of bytes received.
+  if (data && pp_error > 0) {
+    pexe_size_ += pp_error;
+  }
 }
 
 StreamCallback PnaclCoordinator::GetCallback() {
@@ -598,11 +922,44 @@
       &PnaclCoordinator::BitcodeStreamGotData);
 }
 
+void PnaclCoordinator::BitcodeGotCompiled(int32_t pp_error,
+                                          int64_t bytes_compiled) {
+  // If we don't know the expected total yet, ask.
+  pexe_bytes_compiled_ += bytes_compiled;
+  if (expected_pexe_size_ == -1) {
+    int64_t amount_downloaded;  // dummy variable.
+    streaming_downloader_->GetDownloadProgress(&amount_downloaded,
+                                               &expected_pexe_size_);
+  }
+  bool length_computable = (expected_pexe_size_ != -1);
+  plugin_->EnqueueProgressEvent(plugin::Plugin::kProgressEventProgress,
+                                pexe_url_,
+                                (length_computable ?
+                                 plugin::Plugin::LENGTH_IS_COMPUTABLE :
+                                 plugin::Plugin::LENGTH_IS_NOT_COMPUTABLE),
+                                pexe_bytes_compiled_,
+                                expected_pexe_size_);
+}
+
+pp::CompletionCallback PnaclCoordinator::GetCompileProgressCallback(
+    int64_t bytes_compiled) {
+  return callback_factory_.NewCallback(&PnaclCoordinator::BitcodeGotCompiled,
+                                       bytes_compiled);
+}
+
+void PnaclCoordinator::GetCurrentProgress(int64_t* bytes_loaded,
+                                          int64_t* bytes_total) {
+  *bytes_loaded = pexe_bytes_compiled_;
+  *bytes_total = expected_pexe_size_;
+}
+
 void PnaclCoordinator::ObjectFileDidOpen(int32_t pp_error) {
   PLUGIN_PRINTF(("PnaclCoordinator::ObjectFileDidOpen (pp_error=%"
                  NACL_PRId32")\n", pp_error));
   if (pp_error != PP_OK) {
-    ReportPpapiError(pp_error);
+    ReportPpapiError(ERROR_PNACL_CREATE_TEMP,
+                     pp_error,
+                     "Failed to open scratch object file.");
     return;
   }
   // Create the nexe file for connecting ld and sel_ldr.
@@ -629,6 +986,8 @@
                                   temp_nexe_file_.get(),
                                   &error_info_,
                                   resources_.get(),
+                                  &pnacl_options_,
+                                  this,
                                   plugin_);
 }
 
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h
index 6d23557..784b8c7 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h
@@ -22,6 +22,7 @@
 #include "native_client/src/trusted/plugin/local_temp_file.h"
 #include "native_client/src/trusted/plugin/nacl_subprocess.h"
 #include "native_client/src/trusted/plugin/plugin_error.h"
+#include "native_client/src/trusted/plugin/pnacl_options.h"
 #include "native_client/src/trusted/plugin/pnacl_resources.h"
 
 #include "ppapi/c/pp_file_info.h"
@@ -45,6 +46,7 @@
 // (1) Invoke the factory method, e.g.,
 //     PnaclCoordinator* coord = BitcodeToNative(plugin,
 //                                               "http://foo.com/my.pexe",
+//                                               pnacl_options,
 //                                               TranslateNotifyCallback);
 // (2) TranslateNotifyCallback gets invoked when translation is complete.
 //     If the translation was successful, the pp_error argument is PP_OK.
@@ -101,7 +103,7 @@
   static PnaclCoordinator* BitcodeToNative(
       Plugin* plugin,
       const nacl::string& pexe_url,
-      const nacl::string& cache_identity,
+      const PnaclOptions& pnacl_options,
       const pp::CompletionCallback& translate_notify_callback);
 
   // Call this to take ownership of the FD of the translated nexe after
@@ -116,12 +118,17 @@
                             const nacl::string& component);
 
   // Run |translate_notify_callback_| with an error condition that is not
-  // PPAPI specific.
-  void ReportNonPpapiError(const nacl::string& message);
+  // PPAPI specific.  Also set ErrorInfo report.
+  void ReportNonPpapiError(PluginErrorCode err, const nacl::string& message);
   // Run when faced with a PPAPI error condition. Bring control back to the
   // plugin by invoking the |translate_notify_callback_|.
-  void ReportPpapiError(int32_t pp_error, const nacl::string& message);
-  void ReportPpapiError(int32_t pp_error);
+  // Also set ErrorInfo report.
+  void ReportPpapiError(PluginErrorCode err,
+                        int32_t pp_error, const nacl::string& message);
+  // Bring control back to the plugin by invoking the
+  // |translate_notify_callback_|.  This does not set the ErrorInfo report,
+  // it is assumed that it was already set.
+  void ExitWithError();
 
   // Implement FileDownloader's template of the CallbackSource interface.
   // This method returns a callback which will be called by the FileDownloader
@@ -129,6 +136,13 @@
   // (BitcodeStreamGotData) passes it to llc over SRPC.
   StreamCallback GetCallback();
 
+  // Return a callback that should be notified when |bytes_compiled| bytes
+  // have been compiled.
+  pp::CompletionCallback GetCompileProgressCallback(int64_t bytes_compiled);
+
+  // Get the last known load progress.
+  void GetCurrentProgress(int64_t* bytes_loaded, int64_t* bytes_total);
+
  private:
   NACL_DISALLOW_COPY_AND_ASSIGN(PnaclCoordinator);
 
@@ -136,7 +150,7 @@
   // Therefore the constructor is private.
   PnaclCoordinator(Plugin* plugin,
                    const nacl::string& pexe_url,
-                   const nacl::string& cache_identity,
+                   const PnaclOptions& pnacl_options,
                    const pp::CompletionCallback& translate_notify_callback);
 
   // Callback for when llc and ld have been downloaded.
@@ -153,6 +167,8 @@
   void CachedFileDidOpen(int32_t pp_error);
   // Invoked when a pexe data chunk arrives (when using streaming translation)
   void BitcodeStreamGotData(int32_t pp_error, FileStreamData data);
+  // Invoked when a pexe data chunk is compiled.
+  void BitcodeGotCompiled(int32_t pp_error, int64_t bytes_compiled);
   // Invoked when the pexe download finishes (using streaming translation)
   void BitcodeStreamDidFinish(int32_t pp_error);
   // Invoked when the write descriptor for obj_file_ is created.
@@ -173,6 +189,11 @@
   void DidCopyNexeToCachePartial(int32_t pp_error, int32_t num_read_prev,
                                  int64_t cur_offset);
   void NexeWasCopiedToCache(int32_t pp_error);
+  // If the copy of the nexe to the not-yet-committed-to-cache file
+  // failed after partial writes, we attempt to delete the partially written
+  // file. This callback is invoked when the delete is completed.
+  void CorruptCacheFileWasDeleted(int32_t delete_pp_error,
+                                  int32_t orig_pp_error);
   // Invoked when the nexe_file_ temporary has been renamed to the nexe name.
   void NexeFileWasRenamed(int32_t pp_error);
   // Invoked when the read descriptor for nexe_file_ is created.
@@ -213,8 +234,9 @@
 
   // The URL for the pexe file.
   nacl::string pexe_url_;
-  // Optional cache identity for translation caching.
-  nacl::string cache_identity_;
+  // Options for translation.
+  PnaclOptions pnacl_options_;
+
   // Object file, produced by the translator and consumed by the linker.
   nacl::scoped_ptr<TempFile> obj_file_;
   // Translated nexe file, produced by the linker.
@@ -229,6 +251,7 @@
 
   // Used to report information when errors (PPAPI or otherwise) are reported.
   ErrorInfo error_info_;
+
   // True if an error was already reported, and translate_notify_callback_
   // was already run/consumed.
   bool error_already_reported_;
@@ -236,6 +259,12 @@
   // True if compilation is off_the_record.
   bool off_the_record_;
 
+  // State for timing and size information for UMA stats.
+  int64_t pnacl_init_time_;
+  int64_t pexe_size_;  // Count as we stream -- will converge to pexe size.
+  int64_t pexe_bytes_compiled_;  // Count as we compile.
+  int64_t expected_pexe_size_;   // Expected download total (-1 if unknown).
+
   // The helper thread used to do translations via SRPC.
   // Keep this last in declaration order to ensure the other variables
   // haven't been destroyed yet when its destructor runs.
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_options.cc b/ppapi/native_client/src/trusted/plugin/pnacl_options.cc
new file mode 100644
index 0000000..05eecf2
--- /dev/null
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_options.cc
@@ -0,0 +1,82 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "native_client/src/trusted/plugin/pnacl_options.h"
+
+#include <iterator>
+#include <vector>
+
+#include "native_client/src/include/nacl_string.h"
+
+namespace plugin {
+
+// Default to -O0 for now.
+PnaclOptions::PnaclOptions() : translate_(false), opt_level_(0) { }
+
+PnaclOptions::~PnaclOptions() {
+}
+
+nacl::string PnaclOptions::GetCacheKey() {
+  // TODO(jvoung): We need to read the PNaCl translator's manifest
+  // to grab the NaCl / PNaCl ABI version too.
+  nacl::stringstream ss;
+  // Cast opt_level_ as int so that it doesn't think it's a char.
+  ss << "-O:" << static_cast<int>(opt_level_)
+     << ";flags:" << experimental_flags_
+     <<  ";bitcode_hash:" << bitcode_hash_;
+  return ss.str();
+}
+
+void PnaclOptions::set_opt_level(int8_t l) {
+  if (l < 0) {
+    opt_level_ = 0;
+    return;
+  }
+  if (l > 3) {
+    opt_level_ = 3;
+    return;
+  }
+  opt_level_ = l;
+}
+
+std::vector<char> PnaclOptions::GetOptCommandline() {
+  std::vector<char> result;
+  std::vector<nacl::string> tokens;
+
+  // Split the experimental_flags_ + the -On along whitespace.
+  // Mostly a copy of "base/string_util.h", but avoid importing
+  // base into the PPAPI plugin for now.
+  nacl::string delim(" ");
+  nacl::string str = experimental_flags_;
+
+  if (opt_level_ != -1) {
+    nacl::stringstream ss;
+    // Cast as int so that it doesn't think it's a char.
+    ss << " -O" << static_cast<int>(opt_level_);
+    str += ss.str();
+  }
+
+  size_t start = str.find_first_not_of(delim);
+  while (start != nacl::string::npos) {
+    size_t end = str.find_first_of(delim, start + 1);
+    if (end == nacl::string::npos) {
+      tokens.push_back(str.substr(start));
+      break;
+    } else {
+      tokens.push_back(str.substr(start, end - start));
+      start = str.find_first_not_of(delim, end + 1);
+    }
+  }
+
+  for (size_t i = 0; i < tokens.size(); ++i) {
+    nacl::string t = tokens[i];
+    result.reserve(result.size() + t.size());
+    std::copy(t.begin(), t.end(), std::back_inserter(result));
+    result.push_back('\x00');
+  }
+
+  return result;
+}
+
+}  // namespace plugin
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_options.h b/ppapi/native_client/src/trusted/plugin/pnacl_options.h
new file mode 100644
index 0000000..55bbbb9
--- /dev/null
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_options.h
@@ -0,0 +1,66 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_OPTIONS_H_
+#define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_OPTIONS_H_
+
+#include <vector>
+
+#include "native_client/src/include/nacl_string.h"
+#include "native_client/src/include/portability.h"
+
+namespace plugin {
+
+// Options for PNaCl translation.
+class PnaclOptions {
+
+ public:
+  PnaclOptions();
+  ~PnaclOptions();
+
+  // Return true if we know the hash of the bitcode, for caching.
+  bool HasCacheKey() { return bitcode_hash_ != ""; }
+
+  // Return the cache key (which takes into account the bitcode hash,
+  // as well as the commandline options).
+  nacl::string GetCacheKey();
+
+  // Return true if the manifest did not specify any special options
+  // (just using the default).
+  bool HasDefaultOpts() {
+    return opt_level_ == -1 && experimental_flags_ == "";
+  }
+
+  // Return a character array of \x00 delimited commandline options.
+  std::vector<char> GetOptCommandline();
+
+  bool translate() { return translate_; }
+  void set_translate(bool t) { translate_ = t; }
+
+  uint8_t opt_level() { return opt_level_; }
+  void set_opt_level(int8_t l);
+
+  nacl::string experimental_flags() {
+    return experimental_flags_;
+  }
+  void set_experimental_flags(const nacl::string& f) {
+    experimental_flags_ = f;
+  }
+
+  void set_bitcode_hash(const nacl::string& c) {
+    bitcode_hash_ = c;
+  }
+
+ private:
+  // NOTE: There are users of this class that use the copy constructor.
+  // Currently the default copy constructor is good enough, but
+  // double-check that it is the case when more fields are added.
+  bool translate_;
+  int8_t opt_level_;
+  nacl::string experimental_flags_;
+  nacl::string bitcode_hash_;
+};
+
+}  // namespace plugin;
+#endif  // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_OPTIONS_H_
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc b/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc
index d2535c0..d1b3b34 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc
@@ -16,23 +16,16 @@
 
 namespace plugin {
 
-const char PnaclUrls::kExtensionOrigin[] =
+static const char kExtensionOrigin[] =
     "chrome-extension://gcodniebolpnpaiggndmcmmfpldlknih/";
-const char PnaclUrls::kPnaclComponentID[] =
+static const char kPnaclComponentID[] =
     "pnacl-component://";
-const char PnaclUrls::kLlcUrl[] = "llc";
-const char PnaclUrls::kLdUrl[] = "ld";
+const char PnaclUrls::kLlcUrl[] = "llc.nexe";
+const char PnaclUrls::kLdUrl[] = "ld.nexe";
 
 bool PnaclUrls::UsePnaclExtension(const Plugin* plugin) {
-  // Use the chrome webstore extension for now, if --enable-pnacl is not
-  // explicitly requested.  Eventually we will always behave as if
-  // --enable-pnacl is used and not use the chrome extension.
-  // Some UI work, etc. remains before --enable-pnacl is usable:
-  // http://code.google.com/p/nativeclient/issues/detail?id=2813
-  // TODO(jvoung): re-enable the non-extension path if we decide
-  // to use that / once we have renamed and remap some of the files.
-  return true;
-  // return !(plugin->nacl_interface()->IsPnaclEnabled());
+  // TODO(jvoung): remove extension stuff if we aren't using it.
+  return false;
 }
 
 nacl::string PnaclUrls::GetBaseUrl(bool use_extension) {
@@ -47,9 +40,22 @@
   return full_url.find(kPnaclComponentID, 0) == 0;
 }
 
-nacl::string PnaclUrls::StripPnaclComponentPrefix(
+// Convert a URL to a filename accepted by GetReadonlyPnaclFd.
+// Must be kept in sync with pnacl_file_host.cc.
+nacl::string PnaclUrls::PnaclComponentURLToFilename(
     const nacl::string& full_url) {
-  return full_url.substr(nacl::string(kPnaclComponentID).length());
+  // strip componentID.
+  nacl::string r = full_url.substr(nacl::string(kPnaclComponentID).length());
+
+  // Use white-listed-chars.
+  size_t replace_pos;
+  static const char* white_list = "abcdefghijklmnopqrstuvwxyz0123456789_";
+  replace_pos = r.find_first_not_of(white_list);
+  while(replace_pos != nacl::string::npos) {
+    r = r.replace(replace_pos, 1, "_");
+    replace_pos = r.find_first_not_of(white_list);
+  }
+  return r;
 }
 
 //////////////////////////////////////////////////////////////////////
@@ -110,9 +116,11 @@
       nacl::string full_url;
       ErrorInfo error_info;
       if (!manifest_->ResolveURL(resource_urls_[i], &full_url, &error_info)) {
-        coordinator_->ReportNonPpapiError(nacl::string("failed to resolve ") +
-                                          resource_urls_[i] + ": " +
-                                          error_info.message() + ".");
+        coordinator_->ReportNonPpapiError(
+            ERROR_PNACL_RESOURCE_FETCH,
+            nacl::string("failed to resolve ") +
+            resource_urls_[i] + ": " +
+            error_info.message() + ".");
         break;
       }
       pp::CompletionCallback ready_callback =
@@ -122,8 +130,10 @@
               full_url);
       if (!plugin_->StreamAsFile(full_url,
                                  ready_callback.pp_completion_callback())) {
-        coordinator_->ReportNonPpapiError(nacl::string("failed to download ") +
-                                          resource_urls_[i] + ".");
+        coordinator_->ReportNonPpapiError(
+            ERROR_PNACL_RESOURCE_FETCH,
+            nacl::string("failed to download ") +
+            resource_urls_[i] + ".");
         break;
       }
     }
@@ -136,18 +146,21 @@
       nacl::string full_url;
       ErrorInfo error_info;
       if (!manifest_->ResolveURL(resource_urls_[i], &full_url, &error_info)) {
-        coordinator_->ReportNonPpapiError(nacl::string("failed to resolve ") +
-                                          url + ": " +
-                                          error_info.message() + ".");
+        coordinator_->ReportNonPpapiError(
+            ERROR_PNACL_RESOURCE_FETCH,
+            nacl::string("failed to resolve ") +
+            url + ": " +
+            error_info.message() + ".");
         break;
       }
-      full_url = PnaclUrls::StripPnaclComponentPrefix(full_url);
+      nacl::string filename = PnaclUrls::PnaclComponentURLToFilename(full_url);
 
-      int32_t fd = PnaclResources::GetPnaclFD(plugin_, full_url.c_str());
+      int32_t fd = PnaclResources::GetPnaclFD(plugin_, filename.c_str());
       if (fd < 0) {
         coordinator_->ReportNonPpapiError(
+            ERROR_PNACL_RESOURCE_FETCH,
             nacl::string("PnaclLocalResources::StartLoad failed for: ") +
-            full_url);
+            filename);
         result = PP_ERROR_FILENOTFOUND;
         break;
       } else {
@@ -171,7 +184,8 @@
                                                full_url,
                                                "resource " + url);
   if (fd < 0) {
-    coordinator_->ReportPpapiError(pp_error,
+    coordinator_->ReportPpapiError(ERROR_PNACL_RESOURCE_FETCH,
+                                   pp_error,
                                    "PnaclResources::ResourceReady failed.");
   } else {
     resource_wrappers_[url] =
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_resources.h b/ppapi/native_client/src/trusted/plugin/pnacl_resources.h
index 41bbccf..dcc98c4 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_resources.h
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_resources.h
@@ -31,12 +31,11 @@
   static bool UsePnaclExtension(const Plugin* plugin);
   static nacl::string GetBaseUrl(bool use_extension);
   static bool IsPnaclComponent(const nacl::string& full_url);
-  static nacl::string StripPnaclComponentPrefix(const nacl::string& full_url);
+  static nacl::string PnaclComponentURLToFilename(
+      const nacl::string& full_url);
   static const nacl::string GetLlcUrl() { return nacl::string(kLlcUrl); }
   static const nacl::string GetLdUrl() { return nacl::string(kLdUrl); }
  private:
-  static const char kExtensionOrigin[];
-  static const char kPnaclComponentID[];
   static const char kLlcUrl[];
   static const char kLdUrl[];
 };
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc
index 6704ff5..a7d3f24 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc
@@ -6,6 +6,7 @@
 
 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
 #include "native_client/src/trusted/plugin/plugin.h"
+#include "native_client/src/trusted/plugin/plugin_error.h"
 #include "native_client/src/trusted/plugin/pnacl_resources.h"
 #include "native_client/src/trusted/plugin/srpc_params.h"
 #include "native_client/src/trusted/plugin/temporary_file.h"
@@ -16,12 +17,14 @@
 PnaclTranslateThread::PnaclTranslateThread() : llc_subprocess_active_(false),
                                                ld_subprocess_active_(false),
                                                done_(false),
+                                               time_stats_(),
                                                manifest_(NULL),
                                                ld_manifest_(NULL),
                                                obj_file_(NULL),
                                                nexe_file_(NULL),
                                                coordinator_error_info_(NULL),
                                                resources_(NULL),
+                                               coordinator_(NULL),
                                                plugin_(NULL) {
   NaClXMutexCtor(&subprocess_mu_);
   NaClXMutexCtor(&cond_mu_);
@@ -36,6 +39,8 @@
     TempFile* nexe_file,
     ErrorInfo* error_info,
     PnaclResources* resources,
+    PnaclOptions* pnacl_options,
+    PnaclCoordinator* coordinator,
     Plugin* plugin) {
   PLUGIN_PRINTF(("PnaclStreamingTranslateThread::RunTranslate)\n"));
   manifest_ = manifest;
@@ -44,6 +49,8 @@
   nexe_file_ = nexe_file;
   coordinator_error_info_ = error_info;
   resources_ = resources;
+  pnacl_options_ = pnacl_options;
+  coordinator_ = coordinator;
   plugin_ = plugin;
 
   // Invoke llc followed by ld off the main thread.  This allows use of
@@ -51,7 +58,8 @@
   report_translate_finished_ = finish_callback;
   translate_thread_.reset(new NaClThread);
   if (translate_thread_ == NULL) {
-    TranslateFailed("could not allocate thread struct.");
+    TranslateFailed(ERROR_PNACL_THREAD_CREATE,
+                    "could not allocate thread struct.");
     return;
   }
   const int32_t kArbitraryStackSize = 128 * 1024;
@@ -59,7 +67,8 @@
                                 DoTranslateThread,
                                 this,
                                 kArbitraryStackSize)) {
-    TranslateFailed("could not create thread.");
+    TranslateFailed(ERROR_PNACL_THREAD_CREATE,
+                    "could not create thread.");
     translate_thread_.reset(NULL);
   }
 }
@@ -67,8 +76,8 @@
 // Called from main thread to send bytes to the translator.
 void PnaclTranslateThread::PutBytes(std::vector<char>* bytes,
                                              int count) {
-  PLUGIN_PRINTF(("PutBytes, this %p bytes %p, size %d, count %d\n", this, bytes,
-                 bytes ? bytes->size(): 0, count));
+  PLUGIN_PRINTF(("PutBytes (this=%p, bytes=%p, size=%"NACL_PRIuS", count=%d)\n",
+                 this, bytes, bytes ? bytes->size() : 0, count));
   size_t buffer_size = 0;
   // If we are done (error or not), Signal the translation thread to stop.
   if (count <= PP_OK) {
@@ -127,36 +136,59 @@
 
   {
     nacl::MutexLocker ml(&subprocess_mu_);
+    int64_t llc_start_time = NaClGetTimeOfDayMicroseconds();
     llc_subprocess_.reset(
       StartSubprocess(PnaclUrls::GetLlcUrl(), manifest_, &error_info));
     if (llc_subprocess_ == NULL) {
-      TranslateFailed("Compile process could not be created: " +
+      TranslateFailed(ERROR_PNACL_LLC_SETUP,
+                      "Compile process could not be created: " +
                       error_info.message());
       return;
     }
     llc_subprocess_active_ = true;
+    time_stats_.pnacl_llc_load_time =
+        (NaClGetTimeOfDayMicroseconds() - llc_start_time);
     // Run LLC.
     PluginReverseInterface* llc_reverse =
         llc_subprocess_->service_runtime()->rev_interface();
     llc_reverse->AddTempQuotaManagedFile(obj_file_->identifier());
   }
 
-  if (!llc_subprocess_->InvokeSrpcMethod("StreamInit",
-                                         "h",
-                                         &params,
-                                         llc_out_file->desc())) {
+  int64_t compile_start_time = NaClGetTimeOfDayMicroseconds();
+  bool init_success;
+  if (pnacl_options_->HasDefaultOpts()) {
+    PLUGIN_PRINTF(("PnaclCoordinator: StreamInit with default options\n"));
+    init_success = llc_subprocess_->InvokeSrpcMethod("StreamInit",
+                                                     "h",
+                                                     &params,
+                                                     llc_out_file->desc());
+  } else {
+    std::vector<char> options = pnacl_options_->GetOptCommandline();
+    init_success = llc_subprocess_->InvokeSrpcMethod(
+        "StreamInitWithOverrides",
+        "hC",
+        &params,
+        llc_out_file->desc(),
+        &options[0],
+        options.size());
+  }
+
+  if (!init_success) {
     if (llc_subprocess_->srpc_client()->GetLastError() ==
         NACL_SRPC_RESULT_APP_ERROR) {
       // The error message is only present if the error was returned from llc
-      TranslateFailed(nacl::string("Stream init failed: ") +
+      TranslateFailed(ERROR_PNACL_LLC_INTERNAL,
+                      nacl::string("Stream init failed: ") +
                       nacl::string(params.outs()[0]->arrays.str));
     } else {
-      TranslateFailed("Stream init internal error");
+      TranslateFailed(ERROR_PNACL_LLC_INTERNAL,
+                      "Stream init internal error");
     }
     return;
   }
 
   PLUGIN_PRINTF(("PnaclCoordinator: StreamInit successful\n"));
+  pp::Core* core = pp::Module::Get()->core();
 
   // llc process is started.
   while(!done_ || data_buffers_.size() > 0) {
@@ -164,7 +196,7 @@
     while(!done_ && data_buffers_.size() == 0) {
       NaClXCondVarWait(&buffer_cond_, &cond_mu_);
     }
-    PLUGIN_PRINTF(("PnaclTranslateThread awake, done %d, size %d\n",
+    PLUGIN_PRINTF(("PnaclTranslateThread awake (done=%d, size=%"NACL_PRIuS")\n",
                    done_, data_buffers_.size()));
     if (data_buffers_.size() > 0) {
       std::vector<char> data;
@@ -177,10 +209,15 @@
                                              &params,
                                              &data[0],
                                              data.size())) {
-        TranslateFailed("Compile stream chunk failed.");
+        TranslateFailed(ERROR_PNACL_LLC_INTERNAL,
+                        "Compile stream chunk failed.");
         return;
       }
       PLUGIN_PRINTF(("StreamChunk Successful\n"));
+      core->CallOnMainThread(
+          0,
+          coordinator_->GetCompileProgressCallback(data.size()),
+          PP_OK);
     } else {
       NaClXMutexUnlock(&cond_mu_);
     }
@@ -193,13 +230,18 @@
     PLUGIN_PRINTF(("PnaclTranslateThread StreamEnd failed\n"));
     if (llc_subprocess_->srpc_client()->GetLastError() ==
         NACL_SRPC_RESULT_APP_ERROR) {
-      // The error string is only present if the error was sent back from llc
-      TranslateFailed(params.outs()[3]->arrays.str);
+      // The error string is only present if the error was sent back from llc.
+      TranslateFailed(ERROR_PNACL_LLC_INTERNAL,
+                      params.outs()[3]->arrays.str);
     } else {
-      TranslateFailed("Compile StreamEnd internal error");
+      TranslateFailed(ERROR_PNACL_LLC_INTERNAL,
+                      "Compile StreamEnd internal error");
     }
     return;
   }
+  time_stats_.pnacl_compile_time =
+      (NaClGetTimeOfDayMicroseconds() - compile_start_time);
+
   // LLC returns values that are used to determine how linking is done.
   int is_shared_library = (params.outs()[0]->u.ival != 0);
   nacl::string soname = params.outs()[1]->arrays.str;
@@ -218,7 +260,6 @@
   if(!RunLdSubprocess(is_shared_library, soname, lib_dependencies)) {
     return;
   }
-  pp::Core* core = pp::Module::Get()->core();
   core->CallOnMainThread(0, report_translate_finished_, PP_OK);
 }
 
@@ -230,7 +271,8 @@
   SrpcParams params;
   // Reset object file for reading first.
   if (!obj_file_->Reset()) {
-    TranslateFailed("Link process could not reset object file");
+    TranslateFailed(ERROR_PNACL_LD_SETUP,
+                    "Link process could not reset object file");
     return false;
   }
   nacl::DescWrapper* ld_in_file = obj_file_->read_wrapper();
@@ -239,18 +281,24 @@
   {
     // Create LD process
     nacl::MutexLocker ml(&subprocess_mu_);
+    int64_t ld_start_time = NaClGetTimeOfDayMicroseconds();
     ld_subprocess_.reset(
       StartSubprocess(PnaclUrls::GetLdUrl(), ld_manifest_, &error_info));
     if (ld_subprocess_ == NULL) {
-      TranslateFailed("Link process could not be created: " +
+      TranslateFailed(ERROR_PNACL_LD_SETUP,
+                      "Link process could not be created: " +
                       error_info.message());
       return false;
     }
     ld_subprocess_active_ = true;
+    time_stats_.pnacl_ld_load_time =
+        (NaClGetTimeOfDayMicroseconds() - ld_start_time);
     PluginReverseInterface* ld_reverse =
         ld_subprocess_->service_runtime()->rev_interface();
     ld_reverse->AddTempQuotaManagedFile(nexe_file_->identifier());
   }
+
+  int64_t link_start_time = NaClGetTimeOfDayMicroseconds();
   // Run LD.
   if (!ld_subprocess_->InvokeSrpcMethod("RunWithDefaultCommandLine",
                                        "hhiss",
@@ -260,9 +308,12 @@
                                        is_shared_library,
                                        soname.c_str(),
                                        lib_dependencies.c_str())) {
-    TranslateFailed("link failed.");
+    TranslateFailed(ERROR_PNACL_LD_INTERNAL,
+                    "link failed.");
     return false;
   }
+  time_stats_.pnacl_link_time =
+      NaClGetTimeOfDayMicroseconds() - link_start_time;
   PLUGIN_PRINTF(("PnaclCoordinator: link (translator=%p) succeeded\n",
                  this));
   // Shut down the ld subprocess.
@@ -273,14 +324,16 @@
   return true;
 }
 
-void PnaclTranslateThread::TranslateFailed(const nacl::string& error_string) {
+void PnaclTranslateThread::TranslateFailed(
+    enum PluginErrorCode err_code,
+    const nacl::string& error_string) {
   PLUGIN_PRINTF(("PnaclTranslateThread::TranslateFailed (error_string='%s')\n",
                  error_string.c_str()));
   pp::Core* core = pp::Module::Get()->core();
   if (coordinator_error_info_->message().empty()) {
     // Only use our message if one hasn't already been set by the coordinator
     // (e.g. pexe load failed).
-    coordinator_error_info_->SetReport(ERROR_UNKNOWN,
+    coordinator_error_info_->SetReport(err_code,
                                        nacl::string("PnaclCoordinator: ") +
                                        error_string);
   }
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h
index 727e4f6..39e7ba4 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h
@@ -28,9 +28,18 @@
 class Manifest;
 class NaClSubprocess;
 class Plugin;
+class PnaclCoordinator;
+class PnaclOptions;
 class PnaclResources;
 class TempFile;
 
+struct PnaclTimeStats {
+  int64_t pnacl_llc_load_time;
+  int64_t pnacl_compile_time;
+  int64_t pnacl_ld_load_time;
+  int64_t pnacl_link_time;
+};
+
 class PnaclTranslateThread {
  public:
   PnaclTranslateThread();
@@ -45,6 +54,8 @@
                     TempFile* nexe_file,
                     ErrorInfo* error_info,
                     PnaclResources* resources,
+                    PnaclOptions* pnacl_options,
+                    PnaclCoordinator* coordinator,
                     Plugin* plugin);
 
   // Kill the llc and/or ld subprocesses. This happens by closing the command
@@ -58,6 +69,8 @@
   // Send bitcode bytes to the translator. Called from the main thread.
   void PutBytes(std::vector<char>* data, int count);
 
+  const PnaclTimeStats& GetTimeStats() const { return time_stats_; }
+
  private:
   // Starts an individual llc or ld subprocess used for translation.
   NaClSubprocess* StartSubprocess(const nacl::string& url,
@@ -69,7 +82,8 @@
   // Runs the streaming translation. Called from the helper thread.
   void DoTranslate() ;
   // Signal that Pnacl translation failed, from the translation thread only.
-  void TranslateFailed(const nacl::string& error_string);
+  void TranslateFailed(enum PluginErrorCode err_code,
+                       const nacl::string& error_string);
   // Run the LD subprocess, returning true on success
   bool RunLdSubprocess(int is_shared_library,
                        const nacl::string& soname,
@@ -103,6 +117,8 @@
   // Associated with buffer_cond_
   bool done_;
 
+  PnaclTimeStats time_stats_;
+
   // Data about the translation files, owned by the coordinator
   const Manifest* manifest_;
   const Manifest* ld_manifest_;
@@ -110,6 +126,8 @@
   TempFile* nexe_file_;
   ErrorInfo* coordinator_error_info_;
   PnaclResources* resources_;
+  PnaclOptions* pnacl_options_;
+  PnaclCoordinator* coordinator_;
   Plugin* plugin_;
  private:
   NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread);
diff --git a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
index d176400..b625dcd 100644
--- a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
+++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
@@ -11,21 +11,23 @@
 namespace plugin {
 
 bool SelLdrLauncherChrome::Start(const char* url) {
-  return Start(0, url, false);
+  return Start(0, url, true, true, false);
 }
 
 bool SelLdrLauncherChrome::Start(PP_Instance instance,
                                  const char* url,
+                                 bool uses_irt,
+                                 bool uses_ppapi,
                                  bool enable_ppapi_dev) {
+  if (!launch_nacl_process)
+    return false;
   // send a synchronous message to the browser process
-  // TODO(sehr): This is asserted to be one.  Remove this parameter.
-  static const int kNumberOfChannelsToBeCreated = 1;
-  if (!launch_nacl_process ||
-      !launch_nacl_process(instance,
-                           url,
-                           enable_ppapi_dev,
-                           kNumberOfChannelsToBeCreated,
-                           &channel_)) {
+  if (launch_nacl_process(instance,
+                          url,
+                          PP_FromBool(uses_irt),
+                          PP_FromBool(uses_ppapi),
+                          PP_FromBool(enable_ppapi_dev),
+                          &channel_) != PP_NACL_OK) {
     return false;
   }
   return true;
diff --git a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
index 18defeb..ebcd52f 100644
--- a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
+++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
@@ -15,6 +15,8 @@
   virtual bool Start(const char* url);
   virtual bool Start(PP_Instance instance,
                      const char* url,
+                     bool uses_irt,
+                     bool uses_ppapi,
                      bool enable_ppapi_dev);
 };
 
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index 3b50c3f..00f64c7 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
@@ -21,7 +21,6 @@
 #include "native_client/src/include/nacl_macros.h"
 #include "native_client/src/include/nacl_scoped_ptr.h"
 #include "native_client/src/include/nacl_string.h"
-#include "native_client/src/shared/imc/nacl_imc.h"
 #include "native_client/src/shared/platform/nacl_check.h"
 #include "native_client/src/shared/platform/nacl_log.h"
 #include "native_client/src/shared/platform/nacl_sync.h"
@@ -47,7 +46,6 @@
 #include "native_client/src/trusted/plugin/pnacl_resources.h"
 #include "native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h"
 #include "native_client/src/trusted/plugin/srpc_client.h"
-#include "native_client/src/trusted/plugin/utility.h"
 
 #include "native_client/src/trusted/weak_ref/call_on_main_thread.h"
 
@@ -261,9 +259,9 @@
   NaClLog(4, "Entered OpenManifestEntry_MainThreadContinuation\n");
 
   std::string mapped_url;
-  std::string cache_identity;
-  if (!manifest_->ResolveKey(p->url, &mapped_url, &cache_identity,
-                             p->error_info, &p->pnacl_translate)) {
+  PnaclOptions pnacl_options;
+  if (!manifest_->ResolveKey(p->url, &mapped_url,
+                             &pnacl_options, p->error_info)) {
     NaClLog(4, "OpenManifestEntry_MainThreadContinuation: ResolveKey failed\n");
     // Failed, and error_info has the details on what happened.  Wake
     // up requesting thread -- we are done.
@@ -276,18 +274,18 @@
   NaClLog(4,
           "OpenManifestEntry_MainThreadContinuation: "
           "ResolveKey: %s -> %s (pnacl_translate(%d))\n",
-          p->url.c_str(), mapped_url.c_str(), p->pnacl_translate);
+          p->url.c_str(), mapped_url.c_str(), pnacl_options.translate());
 
   open_cont = new OpenManifestEntryResource(*p);  // copy ctor!
   CHECK(open_cont != NULL);
   open_cont->url = mapped_url;
-  if (!open_cont->pnacl_translate) {
+  if (!pnacl_options.translate()) {
     pp::CompletionCallback stream_cc = WeakRefNewCallback(
         anchor_,
         this,
         &PluginReverseInterface::StreamAsFile_MainThreadContinuation,
         open_cont);
-    //
+    // Normal files.
     if (!PnaclUrls::IsPnaclComponent(mapped_url)) {
       if (!plugin_->StreamAsFile(mapped_url,
                                  stream_cc.pp_completion_callback())) {
@@ -305,9 +303,11 @@
       NaClLog(4,
               "OpenManifestEntry_MainThreadContinuation: StreamAsFile okay\n");
     } else {
+      // Special PNaCl support files, that are installed on the
+      // user machine.
       int32_t fd = PnaclResources::GetPnaclFD(
           plugin_,
-          PnaclUrls::StripPnaclComponentPrefix(mapped_url).c_str());
+          PnaclUrls::PnaclComponentURLToFilename(mapped_url).c_str());
       if (fd < 0) {
         // We should check earlier if the pnacl component wasn't installed
         // yet.  At this point, we can't do much anymore, so just continue
@@ -327,21 +327,33 @@
               "OpenManifestEntry_MainThreadContinuation: GetPnaclFd okay\n");
     }
   } else {
+    // Requires PNaCl translation.
     NaClLog(4,
             "OpenManifestEntry_MainThreadContinuation: "
             "pulling down and translating.\n");
-    pp::CompletionCallback translate_callback =
-        WeakRefNewCallback(
-            anchor_,
-            this,
-            &PluginReverseInterface::BitcodeTranslate_MainThreadContinuation,
-            open_cont);
-    // Will always call the callback on success or failure.
-    pnacl_coordinator_.reset(
-        PnaclCoordinator::BitcodeToNative(plugin_,
-                                          mapped_url,
-                                          cache_identity,
-                                          translate_callback));
+    if (plugin_->nacl_interface()->IsPnaclEnabled()) {
+      pp::CompletionCallback translate_callback =
+          WeakRefNewCallback(
+              anchor_,
+              this,
+              &PluginReverseInterface::BitcodeTranslate_MainThreadContinuation,
+              open_cont);
+      // Will always call the callback on success or failure.
+      pnacl_coordinator_.reset(
+          PnaclCoordinator::BitcodeToNative(plugin_,
+                                            mapped_url,
+                                            pnacl_options,
+                                            translate_callback));
+    } else {
+      nacl::MutexLocker take(&mu_);
+      *p->op_complete_ptr = true;  // done...
+      *p->out_desc = -1;       // but failed.
+      p->error_info->SetReport(ERROR_PNACL_NOT_ENABLED,
+                               "ServiceRuntime: GetPnaclFd failed -- pnacl not "
+                               "enabled with --enable-pnacl.");
+      NaClXCondVarBroadcast(&cv_);
+      return;
+    }
   }
   // p is deleted automatically
 }
@@ -396,7 +408,7 @@
             "setting desc -1\n");
     *p->out_desc = -1;
     // Error should have been reported by pnacl coordinator.
-    PLUGIN_PRINTF(("PluginReverseInterface::BitcodeTranslate error.\n"));
+    NaClLog(LOG_ERROR, "PluginReverseInterface::BitcodeTranslate error.\n");
   }
   *p->op_complete_ptr = true;
   NaClXCondVarBroadcast(&cv_);
@@ -596,8 +608,8 @@
 
 void PluginReverseInterface::AddTempQuotaManagedFile(
     const nacl::string& file_id) {
-  PLUGIN_PRINTF(("PluginReverseInterface::AddTempQuotaManagedFile: "
-                 "(file_id='%s')\n", file_id.c_str()));
+  NaClLog(4, "PluginReverseInterface::AddTempQuotaManagedFile: "
+          "(file_id='%s')\n", file_id.c_str());
   nacl::MutexLocker take(&mu_);
   uint64_t file_key = STRTOULL(file_id.c_str(), NULL, 10);
   QuotaData data(plugin::TempQuotaType, 0);
@@ -625,10 +637,10 @@
 
 bool ServiceRuntime::InitCommunication(nacl::DescWrapper* nacl_desc,
                                        ErrorInfo* error_info) {
-  PLUGIN_PRINTF(("ServiceRuntime::InitCommunication"
-                 " (this=%p, subprocess=%p)\n",
-                 static_cast<void*>(this),
-                 static_cast<void*>(subprocess_.get())));
+  NaClLog(4, "ServiceRuntime::InitCommunication"
+          " (this=%p, subprocess=%p)\n",
+          static_cast<void*>(this),
+          static_cast<void*>(subprocess_.get()));
   // Create the command channel to the sel_ldr and load the nexe from nacl_desc.
   if (!subprocess_->SetupCommandAndLoad(&command_channel_, nacl_desc)) {
     error_info->SetReport(ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL,
@@ -650,8 +662,8 @@
   }
   //  Get connection capability to service runtime where the IMC
   //  server/SRPC client is waiting for a rendezvous.
-  PLUGIN_PRINTF(("ServiceRuntime: got 0x%"NACL_PRIxPTR"\n",
-                 (uintptr_t) out_conn_cap));
+  NaClLog(4, "ServiceRuntime: got 0x%"NACL_PRIxPTR"\n",
+          (uintptr_t) out_conn_cap);
   nacl::DescWrapper* conn_cap = plugin_->wrapper_factory()->MakeGenericCleanup(
       out_conn_cap);
   if (conn_cap == NULL) {
@@ -660,8 +672,7 @@
     return false;
   }
   out_conn_cap = NULL;  // ownership passed
-  PLUGIN_PRINTF(("ServiceRuntime::InitCommunication"
-                 " starting reverse service\n"));
+  NaClLog(4, "ServiceRuntime::InitCommunication: starting reverse service\n");
   reverse_service_ = new nacl::ReverseService(conn_cap, rev_interface_->Ref());
   if (!reverse_service_->Start()) {
     error_info->SetReport(ERROR_SEL_LDR_COMMUNICATION_REV_SERVICE,
@@ -683,8 +694,8 @@
                           "ServiceRuntime: could not start nacl module");
     return false;
   }
-  PLUGIN_PRINTF(("ServiceRuntime::InitCommunication (load_status=%d)\n",
-                 load_status));
+  NaClLog(4, "ServiceRuntime::InitCommunication (load_status=%d)\n",
+          load_status);
   if (should_report_uma_) {
     plugin_->ReportSelLdrLoadStatus(load_status);
   }
@@ -700,24 +711,28 @@
 bool ServiceRuntime::Start(nacl::DescWrapper* nacl_desc,
                            ErrorInfo* error_info,
                            const nacl::string& url,
+                           bool uses_irt,
+                           bool uses_ppapi,
                            bool enable_ppapi_dev,
                            pp::CompletionCallback crash_cb) {
-  PLUGIN_PRINTF(("ServiceRuntime::Start (nacl_desc=%p)\n",
-                 reinterpret_cast<void*>(nacl_desc)));
+  NaClLog(4, "ServiceRuntime::Start (nacl_desc=%p)\n",
+          reinterpret_cast<void*>(nacl_desc));
 
   nacl::scoped_ptr<SelLdrLauncherChrome>
       tmp_subprocess(new SelLdrLauncherChrome());
   if (NULL == tmp_subprocess.get()) {
-    PLUGIN_PRINTF(("ServiceRuntime::Start (subprocess create failed)\n"));
+    NaClLog(LOG_ERROR, "ServiceRuntime::Start (subprocess create failed)\n");
     error_info->SetReport(ERROR_SEL_LDR_CREATE_LAUNCHER,
                           "ServiceRuntime: failed to create sel_ldr launcher");
     return false;
   }
   bool started = tmp_subprocess->Start(plugin_->pp_instance(),
                                        url.c_str(),
+                                       uses_irt,
+                                       uses_ppapi,
                                        enable_ppapi_dev);
   if (!started) {
-    PLUGIN_PRINTF(("ServiceRuntime::Start (start failed)\n"));
+    NaClLog(LOG_ERROR, "ServiceRuntime::Start (start failed)\n");
     error_info->SetReport(ERROR_SEL_LDR_LAUNCH,
                           "ServiceRuntime: failed to start");
     return false;
@@ -735,32 +750,32 @@
     Log(LOG_FATAL, "reap logs");
     if (NULL == reverse_service_) {
       // No crash detector thread.
-      PLUGIN_PRINTF(("scheduling to get crash log\n"));
+      NaClLog(LOG_ERROR, "scheduling to get crash log\n");
       pp::Module::Get()->core()->CallOnMainThread(0, crash_cb, PP_OK);
-      PLUGIN_PRINTF(("should fire soon\n"));
+      NaClLog(LOG_ERROR, "should fire soon\n");
     } else {
-      PLUGIN_PRINTF(("Reverse service thread will pick up crash log\n"));
+      NaClLog(LOG_ERROR, "Reverse service thread will pick up crash log\n");
     }
     return false;
   }
 
-  PLUGIN_PRINTF(("ServiceRuntime::Start (return 1)\n"));
+  NaClLog(4, "ServiceRuntime::Start (return 1)\n");
   return true;
 }
 
 SrpcClient* ServiceRuntime::SetupAppChannel() {
-  PLUGIN_PRINTF(("ServiceRuntime::SetupAppChannel (subprocess_=%p)\n",
-                 reinterpret_cast<void*>(subprocess_.get())));
+  NaClLog(4, "ServiceRuntime::SetupAppChannel (subprocess_=%p)\n",
+          reinterpret_cast<void*>(subprocess_.get()));
   nacl::DescWrapper* connect_desc = subprocess_->socket_addr()->Connect();
   if (NULL == connect_desc) {
-    PLUGIN_PRINTF(("ServiceRuntime::SetupAppChannel (connect failed)\n"));
+    NaClLog(LOG_ERROR, "ServiceRuntime::SetupAppChannel (connect failed)\n");
     return NULL;
   } else {
-    PLUGIN_PRINTF(("ServiceRuntime::SetupAppChannel (conect_desc=%p)\n",
-                   static_cast<void*>(connect_desc)));
+    NaClLog(4, "ServiceRuntime::SetupAppChannel (conect_desc=%p)\n",
+            static_cast<void*>(connect_desc));
     SrpcClient* srpc_client = SrpcClient::New(connect_desc);
-    PLUGIN_PRINTF(("ServiceRuntime::SetupAppChannel (srpc_client=%p)\n",
-                   static_cast<void*>(srpc_client)));
+    NaClLog(4, "ServiceRuntime::SetupAppChannel (srpc_client=%p)\n",
+            static_cast<void*>(srpc_client));
     delete connect_desc;
     return srpc_client;
   }
@@ -803,8 +818,8 @@
 }
 
 ServiceRuntime::~ServiceRuntime() {
-  PLUGIN_PRINTF(("ServiceRuntime::~ServiceRuntime (this=%p)\n",
-                 static_cast<void*>(this)));
+  NaClLog(4, "ServiceRuntime::~ServiceRuntime (this=%p)\n",
+          static_cast<void*>(this));
   // We do this just in case Shutdown() was not called.
   subprocess_.reset(NULL);
   if (reverse_service_ != NULL) {
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.h b/ppapi/native_client/src/trusted/plugin/service_runtime.h
index 953f979..f11346e 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.h
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.h
@@ -69,12 +69,10 @@
       : url(target_url),
         out_desc(descp),
         error_info(infop),
-        pnacl_translate(false),
         op_complete_ptr(op_complete) {}
   std::string url;
   int32_t* out_desc;
   ErrorInfo* error_info;
-  bool pnacl_translate;
   bool* op_complete_ptr;
 };
 
@@ -238,6 +236,8 @@
   bool Start(nacl::DescWrapper* nacl_file_desc,
              ErrorInfo* error_info,
              const nacl::string& url,
+             bool uses_irt,
+             bool uses_ppapi,
              bool enable_ppapi_dev,
              pp::CompletionCallback crash_cb);
 
diff --git a/ppapi/native_client/src/trusted/plugin/srpc_client.cc b/ppapi/native_client/src/trusted/plugin/srpc_client.cc
index 31cc37b..e22ed34 100644
--- a/ppapi/native_client/src/trusted/plugin/srpc_client.cc
+++ b/ppapi/native_client/src/trusted/plugin/srpc_client.cc
@@ -104,12 +104,6 @@
   PLUGIN_PRINTF(("SrpcClient::~SrpcClient (return)\n"));
 }
 
-bool SrpcClient::StartJSObjectProxy(Plugin* plugin, ErrorInfo *error_info) {
-  // Start up PPAPI interaction if the plugin determines that the
-  // requisite methods are exported.
-  return plugin->StartProxiedExecution(&srpc_channel_, error_info);
-}
-
 void SrpcClient::GetMethods() {
   PLUGIN_PRINTF(("SrpcClient::GetMethods (this=%p)\n",
                  static_cast<void*>(this)));
diff --git a/ppapi/native_client/src/trusted/plugin/srpc_client.h b/ppapi/native_client/src/trusted/plugin/srpc_client.h
index 072c263..34b2b0d 100644
--- a/ppapi/native_client/src/trusted/plugin/srpc_client.h
+++ b/ppapi/native_client/src/trusted/plugin/srpc_client.h
@@ -40,7 +40,6 @@
   //  The destructor closes the connection to sel_ldr.
   ~SrpcClient();
 
-  bool StartJSObjectProxy(Plugin* plugin, ErrorInfo* error_info);
   //  Test whether the SRPC service has a given method.
   bool HasMethod(const nacl::string& method_name);
   //  Invoke an SRPC method.
diff --git a/ppapi/native_client/src/untrusted/irt_stub/irt_stub.gyp b/ppapi/native_client/src/untrusted/irt_stub/irt_stub.gyp
index 951dd32..2259578 100644
--- a/ppapi/native_client/src/untrusted/irt_stub/irt_stub.gyp
+++ b/ppapi/native_client/src/untrusted/irt_stub/irt_stub.gyp
@@ -14,6 +14,7 @@
         'nlib_target': 'libppapi_stub.a',
         'build_glibc': 1,
         'build_newlib': 1,
+        'build_pnacl_newlib': 1,
       },
       'include_dirs': [
         '../../../..',
diff --git a/ppapi/native_client/src/untrusted/nacl_ppapi_util/ppapi_srpc_main.h b/ppapi/native_client/src/untrusted/nacl_ppapi_util/ppapi_srpc_main.h
index 17c1a98..bc8d861 100644
--- a/ppapi/native_client/src/untrusted/nacl_ppapi_util/ppapi_srpc_main.h
+++ b/ppapi/native_client/src/untrusted/nacl_ppapi_util/ppapi_srpc_main.h
@@ -11,7 +11,7 @@
 
 EXTERN_C_BEGIN
 
-extern int PpapiPluginMain();
+extern int PpapiPluginMain(void);
 
 EXTERN_C_END
 
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp
index fc6f743..7c67da4 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp
@@ -11,9 +11,10 @@
       'target_name': 'pnacl_irt_shim',
       'type': 'none',
       'variables': {
-        'nlib_target': 'pnacl_irt_shim.a',
-        'out_newlib64': '<(PRODUCT_DIR)/libpnacl_irt_shim.a',
-        'out_newlib_arm': '<(PRODUCT_DIR)/libpnacl_irt_shim.a',
+        'nlib_target': 'libpnacl_irt_shim.a',
+        'out_newlib_arm': '<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_translate/lib-arm/libpnacl_irt_shim.a',
+        'out_newlib32': '<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_translate/lib-x86-32/libpnacl_irt_shim.a',
+        'out_newlib64': '<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_translate/lib-x86-64/libpnacl_irt_shim.a',
         'build_glibc': 0,
         'build_newlib': 1,
         'sources': [
@@ -24,6 +25,9 @@
         'include_dirs': [
           '../../../..',
         ],
+        'extra_args': [
+          '--strip-debug',
+        ],
         'conditions': [
           ['target_arch=="arm"', {
             'compile_flags': [
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index c38569a..ec71ae4 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -1,18 +1,18 @@
-/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
+/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
-/* Last generated from IDL: Fri Nov  9 15:24:06 2012. */
+/* NOTE: this is auto-generated from IDL */
 #include "ppapi/generators/pnacl_shim.h"
 
 #include "ppapi/c/ppb.h"
 #include "ppapi/c/dev/ppb_audio_input_dev.h"
 #include "ppapi/c/dev/ppb_buffer_dev.h"
-#include "ppapi/c/dev/ppb_console_dev.h"
 #include "ppapi/c/dev/ppb_crypto_dev.h"
 #include "ppapi/c/dev/ppb_cursor_control_dev.h"
 #include "ppapi/c/dev/ppb_device_ref_dev.h"
+#include "ppapi/c/dev/ppb_directory_reader_dev.h"
 #include "ppapi/c/dev/ppb_file_chooser_dev.h"
 #include "ppapi/c/dev/ppb_find_dev.h"
 #include "ppapi/c/dev/ppb_font_dev.h"
@@ -20,13 +20,16 @@
 #include "ppapi/c/dev/ppb_ime_input_event_dev.h"
 #include "ppapi/c/dev/ppb_keyboard_input_event_dev.h"
 #include "ppapi/c/dev/ppb_memory_dev.h"
-#include "ppapi/c/dev/ppb_message_loop_dev.h"
 #include "ppapi/c/dev/ppb_printing_dev.h"
 #include "ppapi/c/dev/ppb_resource_array_dev.h"
 #include "ppapi/c/dev/ppb_scrollbar_dev.h"
 #include "ppapi/c/dev/ppb_testing_dev.h"
 #include "ppapi/c/dev/ppb_text_input_dev.h"
+#include "ppapi/c/dev/ppb_trace_event_dev.h"
+#include "ppapi/c/dev/ppb_truetype_font_dev.h"
 #include "ppapi/c/dev/ppb_url_util_dev.h"
+#include "ppapi/c/dev/ppb_var_array_dev.h"
+#include "ppapi/c/dev/ppb_var_dictionary_dev.h"
 #include "ppapi/c/dev/ppb_video_capture_dev.h"
 #include "ppapi/c/dev/ppb_video_decoder_dev.h"
 #include "ppapi/c/dev/ppb_view_dev.h"
@@ -34,13 +37,18 @@
 #include "ppapi/c/dev/ppb_zoom_dev.h"
 #include "ppapi/c/dev/ppp_network_state_dev.h"
 #include "ppapi/c/dev/ppp_printing_dev.h"
+#include "ppapi/c/dev/ppp_scrollbar_dev.h"
+#include "ppapi/c/dev/ppp_selection_dev.h"
 #include "ppapi/c/dev/ppp_text_input_dev.h"
 #include "ppapi/c/dev/ppp_video_capture_dev.h"
 #include "ppapi/c/dev/ppp_video_decoder_dev.h"
 #include "ppapi/c/dev/ppp_widget_dev.h"
 #include "ppapi/c/dev/ppp_zoom_dev.h"
+#include "ppapi/c/extensions/dev/ppb_alarms_dev.h"
+#include "ppapi/c/extensions/dev/ppb_events_dev.h"
 #include "ppapi/c/ppb_audio.h"
 #include "ppapi/c/ppb_audio_config.h"
+#include "ppapi/c/ppb_console.h"
 #include "ppapi/c/ppb_core.h"
 #include "ppapi/c/ppb_file_io.h"
 #include "ppapi/c/ppb_file_ref.h"
@@ -52,6 +60,7 @@
 #include "ppapi/c/ppb_image_data.h"
 #include "ppapi/c/ppb_input_event.h"
 #include "ppapi/c/ppb_instance.h"
+#include "ppapi/c/ppb_message_loop.h"
 #include "ppapi/c/ppb_messaging.h"
 #include "ppapi/c/ppb_mouse_cursor.h"
 #include "ppapi/c/ppb_mouse_lock.h"
@@ -74,11 +83,13 @@
 #include "ppapi/c/private/ppb_flash_device_id.h"
 #include "ppapi/c/private/ppb_flash_font_file.h"
 #include "ppapi/c/private/ppb_flash_fullscreen.h"
+#include "ppapi/c/private/ppb_flash_menu.h"
 #include "ppapi/c/private/ppb_flash_message_loop.h"
 #include "ppapi/c/private/ppb_flash_print.h"
 #include "ppapi/c/private/ppb_gpu_blacklist_private.h"
 #include "ppapi/c/private/ppb_host_resolver_private.h"
 #include "ppapi/c/private/ppb_instance_private.h"
+#include "ppapi/c/private/ppb_nacl_private.h"
 #include "ppapi/c/private/ppb_net_address_private.h"
 #include "ppapi/c/private/ppb_network_list_private.h"
 #include "ppapi/c/private/ppb_network_monitor_private.h"
@@ -98,6 +109,7 @@
 #include "ppapi/c/trusted/ppb_char_set_trusted.h"
 #include "ppapi/c/trusted/ppb_file_chooser_trusted.h"
 #include "ppapi/c/trusted/ppb_file_io_trusted.h"
+#include "ppapi/c/trusted/ppb_graphics_3d_trusted.h"
 #include "ppapi/c/trusted/ppb_image_data_trusted.h"
 #include "ppapi/c/trusted/ppb_url_loader_trusted.h"
 
@@ -107,8 +119,14 @@
 
 /* Use local strcmp to avoid dependency on libc. */
 static int mystrcmp(const char* s1, const char *s2) {
-  while((*s1 && *s2) && (*s1++ == *s2++));
-  return *(--s1) - *(--s2);
+  while (1) {
+    if (*s1 == 0) break;
+    if (*s2 == 0) break;
+    if (*s1 != *s2) break;
+    ++s1;
+    ++s2;
+  }
+  return (int)(*s1) - (int)(*s2);
 }
 
 /* BEGIN Declarations for all Wrapper Infos */
@@ -116,8 +134,10 @@
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Audio_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioConfig_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioConfig_1_1;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Console_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Core_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_1_0;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_1_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRef_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileSystem_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Fullscreen_1_0;
@@ -131,8 +151,8 @@
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WheelInputEvent_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TouchInputEvent_1_0;
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Instance_0_5;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Instance_1_0;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MessageLoop_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Messaging_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MouseCursor_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MouseLock_1_0;
@@ -152,20 +172,23 @@
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_MouseLock_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioTrusted_0_6;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_BrokerTrusted_0_2;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_BrowserFont_Trusted_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_BufferTrusted_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_CharSet_Trusted_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_5;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_6;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIOTrusted_0_4;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ImageDataTrusted_0_4;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLLoaderTrusted_0_3;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Buffer_Dev_0_4;
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Console_Dev_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Crypto_Dev_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_CursorControl_Dev_0_4;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_DeviceRef_Dev_0_1;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_DirectoryReader_Dev_0_6;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_5;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_6;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Find_Dev_0_3;
@@ -175,7 +198,6 @@
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_KeyboardInputEvent_Dev_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Memory_Dev_0_1;
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MessageLoop_Dev_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Printing_Dev_0_6;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Printing_Dev_0_7;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ResourceArray_Dev_0_1;
@@ -186,9 +208,13 @@
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Testing_Dev_0_91;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TextInput_Dev_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TextInput_Dev_0_2;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Trace_Event_Dev_0_1;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6;
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_1;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_View_Dev_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Widget_Dev_0_3;
@@ -196,6 +222,9 @@
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Zoom_Dev_0_2;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_NetworkState_Dev_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Printing_Dev_0_6;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Scrollbar_Dev_0_2;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Scrollbar_Dev_0_3;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Selection_Dev_0_3;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_TextInput_Dev_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_VideoCapture_Dev_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_VideoDecoder_Dev_0_9;
@@ -205,24 +234,23 @@
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Zoom_Dev_0_3;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRefPrivate_0_1;
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_0;
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_1;
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_2;
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_3;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_4;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_5;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_6;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_13_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Clipboard_4_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Clipboard_5_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_DeviceID_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_FontFile_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FlashFullscreen_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FlashFullscreen_1_0;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Menu_0_2;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_MessageLoop_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Print_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_GpuBlacklist_Private_0_2;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Instance_Private_0_1;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NaCl_Private_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Private_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1;
@@ -232,6 +260,7 @@
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0_1;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4;
@@ -242,6 +271,8 @@
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_2;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_3;
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Instance_Private_0_1;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_Events_Dev_0_1;
 /* END Declarations for all Wrapper Infos. */
 
 /* Not generating wrapper methods for PPB_Audio_1_0 */
@@ -250,6 +281,22 @@
 
 /* Not generating wrapper methods for PPB_AudioConfig_1_1 */
 
+/* Begin wrapper methods for PPB_Console_1_0 */
+
+static __attribute__((pnaclcall))
+void Pnacl_M25_PPB_Console_Log(PP_Instance instance, PP_LogLevel level, struct PP_Var value) {
+  const struct PPB_Console_1_0 *iface = Pnacl_WrapperInfo_PPB_Console_1_0.real_iface;
+  iface->Log(instance, level, value);
+}
+
+static __attribute__((pnaclcall))
+void Pnacl_M25_PPB_Console_LogWithSource(PP_Instance instance, PP_LogLevel level, struct PP_Var source, struct PP_Var value) {
+  const struct PPB_Console_1_0 *iface = Pnacl_WrapperInfo_PPB_Console_1_0.real_iface;
+  iface->LogWithSource(instance, level, source, value);
+}
+
+/* End wrapper methods for PPB_Console_1_0 */
+
 /* Begin wrapper methods for PPB_Core_1_0 */
 
 static __attribute__((pnaclcall))
@@ -265,13 +312,13 @@
 }
 
 static __attribute__((pnaclcall))
-PP_Time Pnacl_M14_PPB_Core_GetTime() {
+PP_Time Pnacl_M14_PPB_Core_GetTime(void) {
   const struct PPB_Core_1_0 *iface = Pnacl_WrapperInfo_PPB_Core_1_0.real_iface;
   return iface->GetTime();
 }
 
 static __attribute__((pnaclcall))
-PP_TimeTicks Pnacl_M14_PPB_Core_GetTimeTicks() {
+PP_TimeTicks Pnacl_M14_PPB_Core_GetTimeTicks(void) {
   const struct PPB_Core_1_0 *iface = Pnacl_WrapperInfo_PPB_Core_1_0.real_iface;
   return iface->GetTimeTicks();
 }
@@ -283,7 +330,7 @@
 }
 
 static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_Core_IsMainThread() {
+PP_Bool Pnacl_M14_PPB_Core_IsMainThread(void) {
   const struct PPB_Core_1_0 *iface = Pnacl_WrapperInfo_PPB_Core_1_0.real_iface;
   return iface->IsMainThread();
 }
@@ -354,6 +401,76 @@
 
 /* End wrapper methods for PPB_FileIO_1_0 */
 
+/* Begin wrapper methods for PPB_FileIO_1_1 */
+
+static __attribute__((pnaclcall))
+PP_Resource Pnacl_M25_PPB_FileIO_Create(PP_Instance instance) {
+  const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
+  return iface->Create(instance);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M25_PPB_FileIO_IsFileIO(PP_Resource resource) {
+  const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
+  return iface->IsFileIO(resource);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_FileIO_Open(PP_Resource file_io, PP_Resource file_ref, int32_t open_flags, struct PP_CompletionCallback callback) {
+  const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
+  return iface->Open(file_io, file_ref, open_flags, callback);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_FileIO_Query(PP_Resource file_io, struct PP_FileInfo* info, struct PP_CompletionCallback callback) {
+  const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
+  return iface->Query(file_io, info, callback);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_FileIO_Touch(PP_Resource file_io, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback) {
+  const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
+  return iface->Touch(file_io, last_access_time, last_modified_time, callback);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_FileIO_Read(PP_Resource file_io, int64_t offset, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) {
+  const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
+  return iface->Read(file_io, offset, buffer, bytes_to_read, callback);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_FileIO_Write(PP_Resource file_io, int64_t offset, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) {
+  const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
+  return iface->Write(file_io, offset, buffer, bytes_to_write, callback);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_FileIO_SetLength(PP_Resource file_io, int64_t length, struct PP_CompletionCallback callback) {
+  const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
+  return iface->SetLength(file_io, length, callback);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_FileIO_Flush(PP_Resource file_io, struct PP_CompletionCallback callback) {
+  const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
+  return iface->Flush(file_io, callback);
+}
+
+static __attribute__((pnaclcall))
+void Pnacl_M25_PPB_FileIO_Close(PP_Resource file_io) {
+  const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
+  iface->Close(file_io);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_FileIO_ReadToArray(PP_Resource file_io, int64_t offset, int32_t max_read_length, struct PP_ArrayOutput* output, struct PP_CompletionCallback callback) {
+  const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
+  return iface->ReadToArray(file_io, offset, max_read_length, output, callback);
+}
+
+/* End wrapper methods for PPB_FileIO_1_1 */
+
 /* Begin wrapper methods for PPB_FileRef_1_0 */
 
 static __attribute__((pnaclcall))
@@ -728,36 +845,54 @@
 
 /* End wrapper methods for PPB_TouchInputEvent_1_0 */
 
-/* Begin wrapper methods for PPB_Instance_0_5 */
-
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M13_PPB_Instance_GetWindowObject(PP_Instance instance) {
-  const struct PPB_Instance_0_5 *iface = Pnacl_WrapperInfo_PPB_Instance_0_5.real_iface;
-  return iface->GetWindowObject(instance);
-}
-
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M13_PPB_Instance_GetOwnerElementObject(PP_Instance instance) {
-  const struct PPB_Instance_0_5 *iface = Pnacl_WrapperInfo_PPB_Instance_0_5.real_iface;
-  return iface->GetOwnerElementObject(instance);
-}
-
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M13_PPB_Instance_BindGraphics(PP_Instance instance, PP_Resource device) {
-  const struct PPB_Instance_0_5 *iface = Pnacl_WrapperInfo_PPB_Instance_0_5.real_iface;
-  return iface->BindGraphics(instance, device);
-}
-
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M13_PPB_Instance_IsFullFrame(PP_Instance instance) {
-  const struct PPB_Instance_0_5 *iface = Pnacl_WrapperInfo_PPB_Instance_0_5.real_iface;
-  return iface->IsFullFrame(instance);
-}
-
-/* End wrapper methods for PPB_Instance_0_5 */
-
 /* Not generating wrapper methods for PPB_Instance_1_0 */
 
+/* Begin wrapper methods for PPB_MessageLoop_1_0 */
+
+static __attribute__((pnaclcall))
+PP_Resource Pnacl_M25_PPB_MessageLoop_Create(PP_Instance instance) {
+  const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface;
+  return iface->Create(instance);
+}
+
+static __attribute__((pnaclcall))
+PP_Resource Pnacl_M25_PPB_MessageLoop_GetForMainThread(void) {
+  const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface;
+  return iface->GetForMainThread();
+}
+
+static __attribute__((pnaclcall))
+PP_Resource Pnacl_M25_PPB_MessageLoop_GetCurrent(void) {
+  const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface;
+  return iface->GetCurrent();
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_MessageLoop_AttachToCurrentThread(PP_Resource message_loop) {
+  const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface;
+  return iface->AttachToCurrentThread(message_loop);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_MessageLoop_Run(PP_Resource message_loop) {
+  const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface;
+  return iface->Run(message_loop);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_MessageLoop_PostWork(PP_Resource message_loop, struct PP_CompletionCallback callback, int64_t delay_ms) {
+  const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface;
+  return iface->PostWork(message_loop, callback, delay_ms);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_MessageLoop_PostQuit(PP_Resource message_loop, PP_Bool should_destroy) {
+  const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface;
+  return iface->PostQuit(message_loop, should_destroy);
+}
+
+/* End wrapper methods for PPB_MessageLoop_1_0 */
+
 /* Begin wrapper methods for PPB_Messaging_1_0 */
 
 static __attribute__((pnaclcall))
@@ -1156,6 +1291,40 @@
 
 /* End wrapper methods for PPB_BrokerTrusted_0_2 */
 
+/* Begin wrapper methods for PPB_BrokerTrusted_0_3 */
+
+static __attribute__((pnaclcall))
+PP_Resource Pnacl_M25_PPB_BrokerTrusted_CreateTrusted(PP_Instance instance) {
+  const struct PPB_BrokerTrusted_0_3 *iface = Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3.real_iface;
+  return iface->CreateTrusted(instance);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M25_PPB_BrokerTrusted_IsBrokerTrusted(PP_Resource resource) {
+  const struct PPB_BrokerTrusted_0_3 *iface = Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3.real_iface;
+  return iface->IsBrokerTrusted(resource);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_BrokerTrusted_Connect(PP_Resource broker, struct PP_CompletionCallback connect_callback) {
+  const struct PPB_BrokerTrusted_0_3 *iface = Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3.real_iface;
+  return iface->Connect(broker, connect_callback);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_BrokerTrusted_GetHandle(PP_Resource broker, int32_t* handle) {
+  const struct PPB_BrokerTrusted_0_3 *iface = Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3.real_iface;
+  return iface->GetHandle(broker, handle);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M25_PPB_BrokerTrusted_IsAllowed(PP_Resource broker) {
+  const struct PPB_BrokerTrusted_0_3 *iface = Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3.real_iface;
+  return iface->IsAllowed(broker);
+}
+
+/* End wrapper methods for PPB_BrokerTrusted_0_3 */
+
 /* Begin wrapper methods for PPB_BrowserFont_Trusted_1_0 */
 
 static __attribute__((pnaclcall))
@@ -1274,6 +1443,70 @@
 
 /* End wrapper methods for PPB_FileIOTrusted_0_4 */
 
+/* Begin wrapper methods for PPB_Graphics3DTrusted_1_0 */
+
+static __attribute__((pnaclcall))
+PP_Resource Pnacl_M16_PPB_Graphics3DTrusted_CreateRaw(PP_Instance instance_id, PP_Resource share_context, const int32_t attrib_list[]) {
+  const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+  return iface->CreateRaw(instance_id, share_context, attrib_list);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_InitCommandBuffer(PP_Resource context_id) {
+  const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+  return iface->InitCommandBuffer(context_id);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_SetGetBuffer(PP_Resource context, int32_t transfer_buffer_id) {
+  const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+  return iface->SetGetBuffer(context, transfer_buffer_id);
+}
+
+static __attribute__((pnaclcall))
+struct PP_Graphics3DTrustedState Pnacl_M16_PPB_Graphics3DTrusted_GetState(PP_Resource context) {
+  const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+  return iface->GetState(context);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M16_PPB_Graphics3DTrusted_CreateTransferBuffer(PP_Resource context, uint32_t size) {
+  const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+  return iface->CreateTransferBuffer(context, size);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_DestroyTransferBuffer(PP_Resource context, int32_t id) {
+  const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+  return iface->DestroyTransferBuffer(context, id);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_GetTransferBuffer(PP_Resource context, int32_t id, int* shm_handle, uint32_t* shm_size) {
+  const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+  return iface->GetTransferBuffer(context, id, shm_handle, shm_size);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_Flush(PP_Resource context, int32_t put_offset) {
+  const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+  return iface->Flush(context, put_offset);
+}
+
+static __attribute__((pnaclcall))
+struct PP_Graphics3DTrustedState Pnacl_M16_PPB_Graphics3DTrusted_FlushSync(PP_Resource context, int32_t put_offset) {
+  const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+  return iface->FlushSync(context, put_offset);
+}
+
+static __attribute__((pnaclcall))
+struct PP_Graphics3DTrustedState Pnacl_M16_PPB_Graphics3DTrusted_FlushSyncFast(PP_Resource context, int32_t put_offset, int32_t last_known_get) {
+  const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+  return iface->FlushSyncFast(context, put_offset, last_known_get);
+}
+
+/* End wrapper methods for PPB_Graphics3DTrusted_1_0 */
+
 /* Not generating wrapper methods for PPB_ImageDataTrusted_0_4 */
 
 /* Not generating wrapper methods for PPB_URLLoaderTrusted_0_3 */
@@ -1330,24 +1563,66 @@
 
 /* End wrapper methods for PPB_AudioInput_Dev_0_2 */
 
+/* Begin wrapper methods for PPB_AudioInput_Dev_0_3 */
+
+static __attribute__((pnaclcall))
+PP_Resource Pnacl_M25_PPB_AudioInput_Dev_Create(PP_Instance instance) {
+  const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
+  return iface->Create(instance);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M25_PPB_AudioInput_Dev_IsAudioInput(PP_Resource resource) {
+  const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
+  return iface->IsAudioInput(resource);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_AudioInput_Dev_EnumerateDevices(PP_Resource audio_input, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) {
+  const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
+  return iface->EnumerateDevices(audio_input, output, callback);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_AudioInput_Dev_MonitorDeviceChange(PP_Resource audio_input, PP_MonitorDeviceChangeCallback callback, void* user_data) {
+  const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
+  return iface->MonitorDeviceChange(audio_input, callback, user_data);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_AudioInput_Dev_Open(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback audio_input_callback, void* user_data, struct PP_CompletionCallback callback) {
+  const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
+  return iface->Open(audio_input, device_ref, config, audio_input_callback, user_data, callback);
+}
+
+static __attribute__((pnaclcall))
+PP_Resource Pnacl_M25_PPB_AudioInput_Dev_GetCurrentConfig(PP_Resource audio_input) {
+  const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
+  return iface->GetCurrentConfig(audio_input);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M25_PPB_AudioInput_Dev_StartCapture(PP_Resource audio_input) {
+  const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
+  return iface->StartCapture(audio_input);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M25_PPB_AudioInput_Dev_StopCapture(PP_Resource audio_input) {
+  const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
+  return iface->StopCapture(audio_input);
+}
+
+static __attribute__((pnaclcall))
+void Pnacl_M25_PPB_AudioInput_Dev_Close(PP_Resource audio_input) {
+  const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
+  iface->Close(audio_input);
+}
+
+/* End wrapper methods for PPB_AudioInput_Dev_0_3 */
+
 /* Not generating wrapper methods for PPB_Buffer_Dev_0_4 */
 
-/* Begin wrapper methods for PPB_Console_Dev_0_1 */
-
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_Console_Dev_Log(PP_Instance instance, PP_LogLevel_Dev level, struct PP_Var value) {
-  const struct PPB_Console_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Console_Dev_0_1.real_iface;
-  iface->Log(instance, level, value);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_Console_Dev_LogWithSource(PP_Instance instance, PP_LogLevel_Dev level, struct PP_Var source, struct PP_Var value) {
-  const struct PPB_Console_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Console_Dev_0_1.real_iface;
-  iface->LogWithSource(instance, level, source, value);
-}
-
-/* End wrapper methods for PPB_Console_Dev_0_1 */
-
 /* Not generating wrapper methods for PPB_Crypto_Dev_0_1 */
 
 /* Not generating wrapper methods for PPB_CursorControl_Dev_0_4 */
@@ -1374,6 +1649,28 @@
 
 /* End wrapper methods for PPB_DeviceRef_Dev_0_1 */
 
+/* Begin wrapper methods for PPB_DirectoryReader_Dev_0_6 */
+
+static __attribute__((pnaclcall))
+PP_Resource Pnacl_M27_PPB_DirectoryReader_Dev_Create(PP_Resource directory_ref) {
+  const struct PPB_DirectoryReader_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_DirectoryReader_Dev_0_6.real_iface;
+  return iface->Create(directory_ref);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M27_PPB_DirectoryReader_Dev_IsDirectoryReader(PP_Resource resource) {
+  const struct PPB_DirectoryReader_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_DirectoryReader_Dev_0_6.real_iface;
+  return iface->IsDirectoryReader(resource);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M27_PPB_DirectoryReader_Dev_ReadEntries(PP_Resource directory_reader, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) {
+  const struct PPB_DirectoryReader_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_DirectoryReader_Dev_0_6.real_iface;
+  return iface->ReadEntries(directory_reader, output, callback);
+}
+
+/* End wrapper methods for PPB_DirectoryReader_Dev_0_6 */
+
 /* Begin wrapper methods for PPB_FileChooser_Dev_0_5 */
 
 static __attribute__((pnaclcall))
@@ -1570,52 +1867,6 @@
 
 /* Not generating wrapper methods for PPB_Memory_Dev_0_1 */
 
-/* Begin wrapper methods for PPB_MessageLoop_Dev_0_1 */
-
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M18_PPB_MessageLoop_Dev_Create(PP_Instance instance) {
-  const struct PPB_MessageLoop_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_Dev_0_1.real_iface;
-  return iface->Create(instance);
-}
-
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M18_PPB_MessageLoop_Dev_GetForMainThread() {
-  const struct PPB_MessageLoop_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_Dev_0_1.real_iface;
-  return iface->GetForMainThread();
-}
-
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M18_PPB_MessageLoop_Dev_GetCurrent() {
-  const struct PPB_MessageLoop_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_Dev_0_1.real_iface;
-  return iface->GetCurrent();
-}
-
-static __attribute__((pnaclcall))
-int32_t Pnacl_M18_PPB_MessageLoop_Dev_AttachToCurrentThread(PP_Resource message_loop) {
-  const struct PPB_MessageLoop_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_Dev_0_1.real_iface;
-  return iface->AttachToCurrentThread(message_loop);
-}
-
-static __attribute__((pnaclcall))
-int32_t Pnacl_M18_PPB_MessageLoop_Dev_Run(PP_Resource message_loop) {
-  const struct PPB_MessageLoop_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_Dev_0_1.real_iface;
-  return iface->Run(message_loop);
-}
-
-static __attribute__((pnaclcall))
-int32_t Pnacl_M18_PPB_MessageLoop_Dev_PostWork(PP_Resource message_loop, struct PP_CompletionCallback callback, int64_t delay_ms) {
-  const struct PPB_MessageLoop_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_Dev_0_1.real_iface;
-  return iface->PostWork(message_loop, callback, delay_ms);
-}
-
-static __attribute__((pnaclcall))
-int32_t Pnacl_M18_PPB_MessageLoop_Dev_PostQuit(PP_Resource message_loop, PP_Bool should_destroy) {
-  const struct PPB_MessageLoop_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_Dev_0_1.real_iface;
-  return iface->PostQuit(message_loop, should_destroy);
-}
-
-/* End wrapper methods for PPB_MessageLoop_Dev_0_1 */
-
 /* Not generating wrapper methods for PPB_Printing_Dev_0_6 */
 
 /* Begin wrapper methods for PPB_Printing_Dev_0_7 */
@@ -1669,7 +1920,7 @@
 }
 
 static __attribute__((pnaclcall))
-PP_Bool Pnacl_M17_PPB_Testing_Dev_IsOutOfProcess() {
+PP_Bool Pnacl_M17_PPB_Testing_Dev_IsOutOfProcess(void) {
   const struct PPB_Testing_Dev_0_9 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_9.real_iface;
   return iface->IsOutOfProcess();
 }
@@ -1715,7 +1966,7 @@
 }
 
 static __attribute__((pnaclcall))
-PP_Bool Pnacl_M18_PPB_Testing_Dev_IsOutOfProcess() {
+PP_Bool Pnacl_M18_PPB_Testing_Dev_IsOutOfProcess(void) {
   const struct PPB_Testing_Dev_0_91 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_91.real_iface;
   return iface->IsOutOfProcess();
 }
@@ -1744,6 +1995,48 @@
 
 /* Not generating wrapper methods for PPB_TextInput_Dev_0_2 */
 
+/* Not generating wrapper methods for PPB_Trace_Event_Dev_0_1 */
+
+/* Begin wrapper methods for PPB_TrueTypeFont_Dev_0_1 */
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M26_PPB_TrueTypeFont_Dev_GetFontFamilies(PP_Instance instance, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) {
+  const struct PPB_TrueTypeFont_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1.real_iface;
+  return iface->GetFontFamilies(instance, output, callback);
+}
+
+static __attribute__((pnaclcall))
+PP_Resource Pnacl_M26_PPB_TrueTypeFont_Dev_Create(PP_Instance instance, const struct PP_TrueTypeFontDesc_Dev* desc) {
+  const struct PPB_TrueTypeFont_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1.real_iface;
+  return iface->Create(instance, desc);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M26_PPB_TrueTypeFont_Dev_IsFont(PP_Resource resource) {
+  const struct PPB_TrueTypeFont_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1.real_iface;
+  return iface->IsFont(resource);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M26_PPB_TrueTypeFont_Dev_Describe(PP_Resource font, struct PP_TrueTypeFontDesc_Dev* desc, struct PP_CompletionCallback callback) {
+  const struct PPB_TrueTypeFont_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1.real_iface;
+  return iface->Describe(font, desc, callback);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M26_PPB_TrueTypeFont_Dev_GetTableTags(PP_Resource font, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) {
+  const struct PPB_TrueTypeFont_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1.real_iface;
+  return iface->GetTableTags(font, output, callback);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M26_PPB_TrueTypeFont_Dev_GetTable(PP_Resource font, uint32_t table, int32_t offset, int32_t max_data_length, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) {
+  const struct PPB_TrueTypeFont_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1.real_iface;
+  return iface->GetTable(font, table, offset, max_data_length, output, callback);
+}
+
+/* End wrapper methods for PPB_TrueTypeFont_Dev_0_1 */
+
 /* Begin wrapper methods for PPB_URLUtil_Dev_0_6 */
 
 static __attribute__((pnaclcall))
@@ -1796,7 +2089,79 @@
 
 /* End wrapper methods for PPB_URLUtil_Dev_0_6 */
 
-/* Not generating wrapper methods for PPB_VideoCapture_Dev_0_1 */
+/* Begin wrapper methods for PPB_VarArray_Dev_0_1 */
+
+static __attribute__((pnaclcall))
+struct PP_Var Pnacl_M27_PPB_VarArray_Dev_Create(void) {
+  const struct PPB_VarArray_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1.real_iface;
+  return iface->Create();
+}
+
+static __attribute__((pnaclcall))
+struct PP_Var Pnacl_M27_PPB_VarArray_Dev_Get(struct PP_Var array, uint32_t index) {
+  const struct PPB_VarArray_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1.real_iface;
+  return iface->Get(array, index);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M27_PPB_VarArray_Dev_Set(struct PP_Var array, uint32_t index, struct PP_Var value) {
+  const struct PPB_VarArray_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1.real_iface;
+  return iface->Set(array, index, value);
+}
+
+static __attribute__((pnaclcall))
+uint32_t Pnacl_M27_PPB_VarArray_Dev_GetLength(struct PP_Var array) {
+  const struct PPB_VarArray_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1.real_iface;
+  return iface->GetLength(array);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M27_PPB_VarArray_Dev_SetLength(struct PP_Var array, uint32_t length) {
+  const struct PPB_VarArray_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1.real_iface;
+  return iface->SetLength(array, length);
+}
+
+/* End wrapper methods for PPB_VarArray_Dev_0_1 */
+
+/* Begin wrapper methods for PPB_VarDictionary_Dev_0_1 */
+
+static __attribute__((pnaclcall))
+struct PP_Var Pnacl_M27_PPB_VarDictionary_Dev_Create(void) {
+  const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface;
+  return iface->Create();
+}
+
+static __attribute__((pnaclcall))
+struct PP_Var Pnacl_M27_PPB_VarDictionary_Dev_Get(struct PP_Var dict, struct PP_Var key) {
+  const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface;
+  return iface->Get(dict, key);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M27_PPB_VarDictionary_Dev_Set(struct PP_Var dict, struct PP_Var key, struct PP_Var value) {
+  const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface;
+  return iface->Set(dict, key, value);
+}
+
+static __attribute__((pnaclcall))
+void Pnacl_M27_PPB_VarDictionary_Dev_Delete(struct PP_Var dict, struct PP_Var key) {
+  const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface;
+  iface->Delete(dict, key);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M27_PPB_VarDictionary_Dev_HasKey(struct PP_Var dict, struct PP_Var key) {
+  const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface;
+  return iface->HasKey(dict, key);
+}
+
+static __attribute__((pnaclcall))
+struct PP_Var Pnacl_M27_PPB_VarDictionary_Dev_GetKeys(struct PP_Var dict) {
+  const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface;
+  return iface->GetKeys(dict);
+}
+
+/* End wrapper methods for PPB_VarDictionary_Dev_0_1 */
 
 /* Begin wrapper methods for PPB_VideoCapture_Dev_0_2 */
 
@@ -1850,6 +2215,64 @@
 
 /* End wrapper methods for PPB_VideoCapture_Dev_0_2 */
 
+/* Begin wrapper methods for PPB_VideoCapture_Dev_0_3 */
+
+static __attribute__((pnaclcall))
+PP_Resource Pnacl_M25_PPB_VideoCapture_Dev_Create(PP_Instance instance) {
+  const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
+  return iface->Create(instance);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M25_PPB_VideoCapture_Dev_IsVideoCapture(PP_Resource video_capture) {
+  const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
+  return iface->IsVideoCapture(video_capture);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_VideoCapture_Dev_EnumerateDevices(PP_Resource video_capture, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) {
+  const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
+  return iface->EnumerateDevices(video_capture, output, callback);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_VideoCapture_Dev_MonitorDeviceChange(PP_Resource video_capture, PP_MonitorDeviceChangeCallback callback, void* user_data) {
+  const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
+  return iface->MonitorDeviceChange(video_capture, callback, user_data);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_VideoCapture_Dev_Open(PP_Resource video_capture, PP_Resource device_ref, const struct PP_VideoCaptureDeviceInfo_Dev* requested_info, uint32_t buffer_count, struct PP_CompletionCallback callback) {
+  const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
+  return iface->Open(video_capture, device_ref, requested_info, buffer_count, callback);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_VideoCapture_Dev_StartCapture(PP_Resource video_capture) {
+  const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
+  return iface->StartCapture(video_capture);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_VideoCapture_Dev_ReuseBuffer(PP_Resource video_capture, uint32_t buffer) {
+  const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
+  return iface->ReuseBuffer(video_capture, buffer);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M25_PPB_VideoCapture_Dev_StopCapture(PP_Resource video_capture) {
+  const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
+  return iface->StopCapture(video_capture);
+}
+
+static __attribute__((pnaclcall))
+void Pnacl_M25_PPB_VideoCapture_Dev_Close(PP_Resource video_capture) {
+  const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
+  iface->Close(video_capture);
+}
+
+/* End wrapper methods for PPB_VideoCapture_Dev_0_3 */
+
 /* Begin wrapper methods for PPB_VideoDecoder_Dev_0_16 */
 
 static __attribute__((pnaclcall))
@@ -1914,6 +2337,20 @@
 
 /* Not generating wrapper methods for PPP_Printing_Dev_0_6 */
 
+/* Not generating wrapper methods for PPP_Scrollbar_Dev_0_2 */
+
+/* Not generating wrapper methods for PPP_Scrollbar_Dev_0_3 */
+
+/* Begin wrapper methods for PPP_Selection_Dev_0_3 */
+
+static struct PP_Var Pnacl_M13_PPP_Selection_Dev_GetSelectedText(PP_Instance instance, PP_Bool html) {
+  const struct PPP_Selection_Dev_0_3 *iface = Pnacl_WrapperInfo_PPP_Selection_Dev_0_3.real_iface;
+  struct PP_Var (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, PP_Bool html) = ((struct PP_Var (__attribute__((pnaclcall)) *)(PP_Instance instance, PP_Bool html))iface->GetSelectedText);
+  return temp_fp(instance, html);
+}
+
+/* End wrapper methods for PPP_Selection_Dev_0_3 */
+
 /* Not generating wrapper methods for PPP_TextInput_Dev_0_1 */
 
 /* Not generating wrapper methods for PPP_VideoCapture_Dev_0_1 */
@@ -1943,7 +2380,7 @@
 }
 
 static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_ContentDecryptor_Private_KeyMessage(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, PP_Resource message, struct PP_Var default_url) {
+void Pnacl_M24_PPB_ContentDecryptor_Private_KeyMessage(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, struct PP_Var message, struct PP_Var default_url) {
   const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface;
   iface->KeyMessage(instance, key_system, session_id, message, default_url);
 }
@@ -2002,310 +2439,6 @@
 
 /* End wrapper methods for PPB_FileRefPrivate_0_1 */
 
-/* Begin wrapper methods for PPB_Flash_12_0 */
-
-static __attribute__((pnaclcall))
-void Pnacl_M17_PPB_Flash_SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
-  const struct PPB_Flash_12_0 *iface = Pnacl_WrapperInfo_PPB_Flash_12_0.real_iface;
-  iface->SetInstanceAlwaysOnTop(instance, on_top);
-}
-
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M17_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_FontDescription_Dev* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
-  const struct PPB_Flash_12_0 *iface = Pnacl_WrapperInfo_PPB_Flash_12_0.real_iface;
-  return iface->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances);
-}
-
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M17_PPB_Flash_GetProxyForURL(PP_Instance instance, const char* url) {
-  const struct PPB_Flash_12_0 *iface = Pnacl_WrapperInfo_PPB_Flash_12_0.real_iface;
-  return iface->GetProxyForURL(instance, url);
-}
-
-static __attribute__((pnaclcall))
-int32_t Pnacl_M17_PPB_Flash_Navigate(PP_Resource request_info, const char* target, PP_Bool from_user_action) {
-  const struct PPB_Flash_12_0 *iface = Pnacl_WrapperInfo_PPB_Flash_12_0.real_iface;
-  return iface->Navigate(request_info, target, from_user_action);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M17_PPB_Flash_RunMessageLoop(PP_Instance instance) {
-  const struct PPB_Flash_12_0 *iface = Pnacl_WrapperInfo_PPB_Flash_12_0.real_iface;
-  iface->RunMessageLoop(instance);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M17_PPB_Flash_QuitMessageLoop(PP_Instance instance) {
-  const struct PPB_Flash_12_0 *iface = Pnacl_WrapperInfo_PPB_Flash_12_0.real_iface;
-  iface->QuitMessageLoop(instance);
-}
-
-static __attribute__((pnaclcall))
-double Pnacl_M17_PPB_Flash_GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
-  const struct PPB_Flash_12_0 *iface = Pnacl_WrapperInfo_PPB_Flash_12_0.real_iface;
-  return iface->GetLocalTimeZoneOffset(instance, t);
-}
-
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M17_PPB_Flash_GetCommandLineArgs(PP_Module module) {
-  const struct PPB_Flash_12_0 *iface = Pnacl_WrapperInfo_PPB_Flash_12_0.real_iface;
-  return iface->GetCommandLineArgs(module);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M17_PPB_Flash_PreloadFontWin(const void* logfontw) {
-  const struct PPB_Flash_12_0 *iface = Pnacl_WrapperInfo_PPB_Flash_12_0.real_iface;
-  iface->PreloadFontWin(logfontw);
-}
-
-/* End wrapper methods for PPB_Flash_12_0 */
-
-/* Begin wrapper methods for PPB_Flash_12_1 */
-
-static __attribute__((pnaclcall))
-void Pnacl_M19_PPB_Flash_SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
-  const struct PPB_Flash_12_1 *iface = Pnacl_WrapperInfo_PPB_Flash_12_1.real_iface;
-  iface->SetInstanceAlwaysOnTop(instance, on_top);
-}
-
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_FontDescription_Dev* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
-  const struct PPB_Flash_12_1 *iface = Pnacl_WrapperInfo_PPB_Flash_12_1.real_iface;
-  return iface->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances);
-}
-
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M19_PPB_Flash_GetProxyForURL(PP_Instance instance, const char* url) {
-  const struct PPB_Flash_12_1 *iface = Pnacl_WrapperInfo_PPB_Flash_12_1.real_iface;
-  return iface->GetProxyForURL(instance, url);
-}
-
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_Flash_Navigate(PP_Resource request_info, const char* target, PP_Bool from_user_action) {
-  const struct PPB_Flash_12_1 *iface = Pnacl_WrapperInfo_PPB_Flash_12_1.real_iface;
-  return iface->Navigate(request_info, target, from_user_action);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M19_PPB_Flash_RunMessageLoop(PP_Instance instance) {
-  const struct PPB_Flash_12_1 *iface = Pnacl_WrapperInfo_PPB_Flash_12_1.real_iface;
-  iface->RunMessageLoop(instance);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M19_PPB_Flash_QuitMessageLoop(PP_Instance instance) {
-  const struct PPB_Flash_12_1 *iface = Pnacl_WrapperInfo_PPB_Flash_12_1.real_iface;
-  iface->QuitMessageLoop(instance);
-}
-
-static __attribute__((pnaclcall))
-double Pnacl_M19_PPB_Flash_GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
-  const struct PPB_Flash_12_1 *iface = Pnacl_WrapperInfo_PPB_Flash_12_1.real_iface;
-  return iface->GetLocalTimeZoneOffset(instance, t);
-}
-
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M19_PPB_Flash_GetCommandLineArgs(PP_Module module) {
-  const struct PPB_Flash_12_1 *iface = Pnacl_WrapperInfo_PPB_Flash_12_1.real_iface;
-  return iface->GetCommandLineArgs(module);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M19_PPB_Flash_PreloadFontWin(const void* logfontw) {
-  const struct PPB_Flash_12_1 *iface = Pnacl_WrapperInfo_PPB_Flash_12_1.real_iface;
-  iface->PreloadFontWin(logfontw);
-}
-
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_Flash_IsRectTopmost(PP_Instance instance, const struct PP_Rect* rect) {
-  const struct PPB_Flash_12_1 *iface = Pnacl_WrapperInfo_PPB_Flash_12_1.real_iface;
-  return iface->IsRectTopmost(instance, rect);
-}
-
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_Flash_InvokePrinting(PP_Instance instance) {
-  const struct PPB_Flash_12_1 *iface = Pnacl_WrapperInfo_PPB_Flash_12_1.real_iface;
-  return iface->InvokePrinting(instance);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M19_PPB_Flash_UpdateActivity(PP_Instance instance) {
-  const struct PPB_Flash_12_1 *iface = Pnacl_WrapperInfo_PPB_Flash_12_1.real_iface;
-  iface->UpdateActivity(instance);
-}
-
-/* End wrapper methods for PPB_Flash_12_1 */
-
-/* Begin wrapper methods for PPB_Flash_12_2 */
-
-static __attribute__((pnaclcall))
-void Pnacl_M20_0_PPB_Flash_SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
-  const struct PPB_Flash_12_2 *iface = Pnacl_WrapperInfo_PPB_Flash_12_2.real_iface;
-  iface->SetInstanceAlwaysOnTop(instance, on_top);
-}
-
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M20_0_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_FontDescription_Dev* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
-  const struct PPB_Flash_12_2 *iface = Pnacl_WrapperInfo_PPB_Flash_12_2.real_iface;
-  return iface->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances);
-}
-
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M20_0_PPB_Flash_GetProxyForURL(PP_Instance instance, const char* url) {
-  const struct PPB_Flash_12_2 *iface = Pnacl_WrapperInfo_PPB_Flash_12_2.real_iface;
-  return iface->GetProxyForURL(instance, url);
-}
-
-static __attribute__((pnaclcall))
-int32_t Pnacl_M20_0_PPB_Flash_Navigate(PP_Resource request_info, const char* target, PP_Bool from_user_action) {
-  const struct PPB_Flash_12_2 *iface = Pnacl_WrapperInfo_PPB_Flash_12_2.real_iface;
-  return iface->Navigate(request_info, target, from_user_action);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M20_0_PPB_Flash_RunMessageLoop(PP_Instance instance) {
-  const struct PPB_Flash_12_2 *iface = Pnacl_WrapperInfo_PPB_Flash_12_2.real_iface;
-  iface->RunMessageLoop(instance);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M20_0_PPB_Flash_QuitMessageLoop(PP_Instance instance) {
-  const struct PPB_Flash_12_2 *iface = Pnacl_WrapperInfo_PPB_Flash_12_2.real_iface;
-  iface->QuitMessageLoop(instance);
-}
-
-static __attribute__((pnaclcall))
-double Pnacl_M20_0_PPB_Flash_GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
-  const struct PPB_Flash_12_2 *iface = Pnacl_WrapperInfo_PPB_Flash_12_2.real_iface;
-  return iface->GetLocalTimeZoneOffset(instance, t);
-}
-
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M20_0_PPB_Flash_GetCommandLineArgs(PP_Module module) {
-  const struct PPB_Flash_12_2 *iface = Pnacl_WrapperInfo_PPB_Flash_12_2.real_iface;
-  return iface->GetCommandLineArgs(module);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M20_0_PPB_Flash_PreloadFontWin(const void* logfontw) {
-  const struct PPB_Flash_12_2 *iface = Pnacl_WrapperInfo_PPB_Flash_12_2.real_iface;
-  iface->PreloadFontWin(logfontw);
-}
-
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M20_0_PPB_Flash_IsRectTopmost(PP_Instance instance, const struct PP_Rect* rect) {
-  const struct PPB_Flash_12_2 *iface = Pnacl_WrapperInfo_PPB_Flash_12_2.real_iface;
-  return iface->IsRectTopmost(instance, rect);
-}
-
-static __attribute__((pnaclcall))
-int32_t Pnacl_M20_0_PPB_Flash_InvokePrinting(PP_Instance instance) {
-  const struct PPB_Flash_12_2 *iface = Pnacl_WrapperInfo_PPB_Flash_12_2.real_iface;
-  return iface->InvokePrinting(instance);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M20_0_PPB_Flash_UpdateActivity(PP_Instance instance) {
-  const struct PPB_Flash_12_2 *iface = Pnacl_WrapperInfo_PPB_Flash_12_2.real_iface;
-  iface->UpdateActivity(instance);
-}
-
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M20_0_PPB_Flash_GetDeviceID(PP_Instance instance) {
-  const struct PPB_Flash_12_2 *iface = Pnacl_WrapperInfo_PPB_Flash_12_2.real_iface;
-  return iface->GetDeviceID(instance);
-}
-
-/* End wrapper methods for PPB_Flash_12_2 */
-
-/* Begin wrapper methods for PPB_Flash_12_3 */
-
-static __attribute__((pnaclcall))
-void Pnacl_M20_1_PPB_Flash_SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
-  const struct PPB_Flash_12_3 *iface = Pnacl_WrapperInfo_PPB_Flash_12_3.real_iface;
-  iface->SetInstanceAlwaysOnTop(instance, on_top);
-}
-
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M20_1_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_FontDescription_Dev* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
-  const struct PPB_Flash_12_3 *iface = Pnacl_WrapperInfo_PPB_Flash_12_3.real_iface;
-  return iface->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances);
-}
-
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M20_1_PPB_Flash_GetProxyForURL(PP_Instance instance, const char* url) {
-  const struct PPB_Flash_12_3 *iface = Pnacl_WrapperInfo_PPB_Flash_12_3.real_iface;
-  return iface->GetProxyForURL(instance, url);
-}
-
-static __attribute__((pnaclcall))
-int32_t Pnacl_M20_1_PPB_Flash_Navigate(PP_Resource request_info, const char* target, PP_Bool from_user_action) {
-  const struct PPB_Flash_12_3 *iface = Pnacl_WrapperInfo_PPB_Flash_12_3.real_iface;
-  return iface->Navigate(request_info, target, from_user_action);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M20_1_PPB_Flash_RunMessageLoop(PP_Instance instance) {
-  const struct PPB_Flash_12_3 *iface = Pnacl_WrapperInfo_PPB_Flash_12_3.real_iface;
-  iface->RunMessageLoop(instance);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M20_1_PPB_Flash_QuitMessageLoop(PP_Instance instance) {
-  const struct PPB_Flash_12_3 *iface = Pnacl_WrapperInfo_PPB_Flash_12_3.real_iface;
-  iface->QuitMessageLoop(instance);
-}
-
-static __attribute__((pnaclcall))
-double Pnacl_M20_1_PPB_Flash_GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
-  const struct PPB_Flash_12_3 *iface = Pnacl_WrapperInfo_PPB_Flash_12_3.real_iface;
-  return iface->GetLocalTimeZoneOffset(instance, t);
-}
-
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M20_1_PPB_Flash_GetCommandLineArgs(PP_Module module) {
-  const struct PPB_Flash_12_3 *iface = Pnacl_WrapperInfo_PPB_Flash_12_3.real_iface;
-  return iface->GetCommandLineArgs(module);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M20_1_PPB_Flash_PreloadFontWin(const void* logfontw) {
-  const struct PPB_Flash_12_3 *iface = Pnacl_WrapperInfo_PPB_Flash_12_3.real_iface;
-  iface->PreloadFontWin(logfontw);
-}
-
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M20_1_PPB_Flash_IsRectTopmost(PP_Instance instance, const struct PP_Rect* rect) {
-  const struct PPB_Flash_12_3 *iface = Pnacl_WrapperInfo_PPB_Flash_12_3.real_iface;
-  return iface->IsRectTopmost(instance, rect);
-}
-
-static __attribute__((pnaclcall))
-int32_t Pnacl_M20_1_PPB_Flash_InvokePrinting(PP_Instance instance) {
-  const struct PPB_Flash_12_3 *iface = Pnacl_WrapperInfo_PPB_Flash_12_3.real_iface;
-  return iface->InvokePrinting(instance);
-}
-
-static __attribute__((pnaclcall))
-void Pnacl_M20_1_PPB_Flash_UpdateActivity(PP_Instance instance) {
-  const struct PPB_Flash_12_3 *iface = Pnacl_WrapperInfo_PPB_Flash_12_3.real_iface;
-  iface->UpdateActivity(instance);
-}
-
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M20_1_PPB_Flash_GetDeviceID(PP_Instance instance) {
-  const struct PPB_Flash_12_3 *iface = Pnacl_WrapperInfo_PPB_Flash_12_3.real_iface;
-  return iface->GetDeviceID(instance);
-}
-
-static __attribute__((pnaclcall))
-int32_t Pnacl_M20_1_PPB_Flash_GetSettingInt(PP_Instance instance, PP_FlashSetting setting) {
-  const struct PPB_Flash_12_3 *iface = Pnacl_WrapperInfo_PPB_Flash_12_3.real_iface;
-  return iface->GetSettingInt(instance, setting);
-}
-
-/* End wrapper methods for PPB_Flash_12_3 */
-
 /* Begin wrapper methods for PPB_Flash_12_4 */
 
 static __attribute__((pnaclcall))
@@ -2315,7 +2448,7 @@
 }
 
 static __attribute__((pnaclcall))
-PP_Bool Pnacl_M21_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_FontDescription_Dev* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
+PP_Bool Pnacl_M21_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
   const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
   return iface->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances);
 }
@@ -2409,7 +2542,7 @@
 }
 
 static __attribute__((pnaclcall))
-PP_Bool Pnacl_M22_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_FontDescription_Dev* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
+PP_Bool Pnacl_M22_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
   const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
   return iface->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances);
 }
@@ -2503,109 +2636,185 @@
 /* Begin wrapper methods for PPB_Flash_12_6 */
 
 static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_Flash_SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
+void Pnacl_M24_0_PPB_Flash_SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   iface->SetInstanceAlwaysOnTop(instance, on_top);
 }
 
 static __attribute__((pnaclcall))
-PP_Bool Pnacl_M24_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_FontDescription_Dev* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
+PP_Bool Pnacl_M24_0_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   return iface->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances);
 }
 
 static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M24_PPB_Flash_GetProxyForURL(PP_Instance instance, const char* url) {
+struct PP_Var Pnacl_M24_0_PPB_Flash_GetProxyForURL(PP_Instance instance, const char* url) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   return iface->GetProxyForURL(instance, url);
 }
 
 static __attribute__((pnaclcall))
-int32_t Pnacl_M24_PPB_Flash_Navigate(PP_Resource request_info, const char* target, PP_Bool from_user_action) {
+int32_t Pnacl_M24_0_PPB_Flash_Navigate(PP_Resource request_info, const char* target, PP_Bool from_user_action) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   return iface->Navigate(request_info, target, from_user_action);
 }
 
 static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_Flash_RunMessageLoop(PP_Instance instance) {
+void Pnacl_M24_0_PPB_Flash_RunMessageLoop(PP_Instance instance) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   iface->RunMessageLoop(instance);
 }
 
 static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_Flash_QuitMessageLoop(PP_Instance instance) {
+void Pnacl_M24_0_PPB_Flash_QuitMessageLoop(PP_Instance instance) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   iface->QuitMessageLoop(instance);
 }
 
 static __attribute__((pnaclcall))
-double Pnacl_M24_PPB_Flash_GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
+double Pnacl_M24_0_PPB_Flash_GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   return iface->GetLocalTimeZoneOffset(instance, t);
 }
 
 static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M24_PPB_Flash_GetCommandLineArgs(PP_Module module) {
+struct PP_Var Pnacl_M24_0_PPB_Flash_GetCommandLineArgs(PP_Module module) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   return iface->GetCommandLineArgs(module);
 }
 
 static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_Flash_PreloadFontWin(const void* logfontw) {
+void Pnacl_M24_0_PPB_Flash_PreloadFontWin(const void* logfontw) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   iface->PreloadFontWin(logfontw);
 }
 
 static __attribute__((pnaclcall))
-PP_Bool Pnacl_M24_PPB_Flash_IsRectTopmost(PP_Instance instance, const struct PP_Rect* rect) {
+PP_Bool Pnacl_M24_0_PPB_Flash_IsRectTopmost(PP_Instance instance, const struct PP_Rect* rect) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   return iface->IsRectTopmost(instance, rect);
 }
 
 static __attribute__((pnaclcall))
-int32_t Pnacl_M24_PPB_Flash_InvokePrinting(PP_Instance instance) {
+int32_t Pnacl_M24_0_PPB_Flash_InvokePrinting(PP_Instance instance) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   return iface->InvokePrinting(instance);
 }
 
 static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_Flash_UpdateActivity(PP_Instance instance) {
+void Pnacl_M24_0_PPB_Flash_UpdateActivity(PP_Instance instance) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   iface->UpdateActivity(instance);
 }
 
 static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M24_PPB_Flash_GetDeviceID(PP_Instance instance) {
+struct PP_Var Pnacl_M24_0_PPB_Flash_GetDeviceID(PP_Instance instance) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   return iface->GetDeviceID(instance);
 }
 
 static __attribute__((pnaclcall))
-int32_t Pnacl_M24_PPB_Flash_GetSettingInt(PP_Instance instance, PP_FlashSetting setting) {
+int32_t Pnacl_M24_0_PPB_Flash_GetSettingInt(PP_Instance instance, PP_FlashSetting setting) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   return iface->GetSettingInt(instance, setting);
 }
 
 static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M24_PPB_Flash_GetSetting(PP_Instance instance, PP_FlashSetting setting) {
+struct PP_Var Pnacl_M24_0_PPB_Flash_GetSetting(PP_Instance instance, PP_FlashSetting setting) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   return iface->GetSetting(instance, setting);
 }
 
 static __attribute__((pnaclcall))
-PP_Bool Pnacl_M24_PPB_Flash_SetCrashData(PP_Instance instance, PP_FlashCrashKey key, struct PP_Var value) {
+PP_Bool Pnacl_M24_0_PPB_Flash_SetCrashData(PP_Instance instance, PP_FlashCrashKey key, struct PP_Var value) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   return iface->SetCrashData(instance, key, value);
 }
 
 static __attribute__((pnaclcall))
-int32_t Pnacl_M24_PPB_Flash_EnumerateVideoCaptureDevices(PP_Instance instance, PP_Resource video_capture, struct PP_ArrayOutput devices) {
+int32_t Pnacl_M24_0_PPB_Flash_EnumerateVideoCaptureDevices(PP_Instance instance, PP_Resource video_capture, struct PP_ArrayOutput devices) {
   const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
   return iface->EnumerateVideoCaptureDevices(instance, video_capture, devices);
 }
 
 /* End wrapper methods for PPB_Flash_12_6 */
 
+/* Begin wrapper methods for PPB_Flash_13_0 */
+
+static __attribute__((pnaclcall))
+void Pnacl_M24_1_PPB_Flash_SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
+  const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
+  iface->SetInstanceAlwaysOnTop(instance, on_top);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M24_1_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
+  const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
+  return iface->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances);
+}
+
+static __attribute__((pnaclcall))
+struct PP_Var Pnacl_M24_1_PPB_Flash_GetProxyForURL(PP_Instance instance, const char* url) {
+  const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
+  return iface->GetProxyForURL(instance, url);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M24_1_PPB_Flash_Navigate(PP_Resource request_info, const char* target, PP_Bool from_user_action) {
+  const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
+  return iface->Navigate(request_info, target, from_user_action);
+}
+
+static __attribute__((pnaclcall))
+double Pnacl_M24_1_PPB_Flash_GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
+  const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
+  return iface->GetLocalTimeZoneOffset(instance, t);
+}
+
+static __attribute__((pnaclcall))
+struct PP_Var Pnacl_M24_1_PPB_Flash_GetCommandLineArgs(PP_Module module) {
+  const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
+  return iface->GetCommandLineArgs(module);
+}
+
+static __attribute__((pnaclcall))
+void Pnacl_M24_1_PPB_Flash_PreloadFontWin(const void* logfontw) {
+  const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
+  iface->PreloadFontWin(logfontw);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M24_1_PPB_Flash_IsRectTopmost(PP_Instance instance, const struct PP_Rect* rect) {
+  const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
+  return iface->IsRectTopmost(instance, rect);
+}
+
+static __attribute__((pnaclcall))
+void Pnacl_M24_1_PPB_Flash_UpdateActivity(PP_Instance instance) {
+  const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
+  iface->UpdateActivity(instance);
+}
+
+static __attribute__((pnaclcall))
+struct PP_Var Pnacl_M24_1_PPB_Flash_GetSetting(PP_Instance instance, PP_FlashSetting setting) {
+  const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
+  return iface->GetSetting(instance, setting);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M24_1_PPB_Flash_SetCrashData(PP_Instance instance, PP_FlashCrashKey key, struct PP_Var value) {
+  const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
+  return iface->SetCrashData(instance, key, value);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M24_1_PPB_Flash_EnumerateVideoCaptureDevices(PP_Instance instance, PP_Resource video_capture, struct PP_ArrayOutput devices) {
+  const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
+  return iface->EnumerateVideoCaptureDevices(instance, video_capture, devices);
+}
+
+/* End wrapper methods for PPB_Flash_13_0 */
+
 /* Begin wrapper methods for PPB_Flash_Clipboard_4_0 */
 
 static __attribute__((pnaclcall))
@@ -2678,6 +2887,28 @@
 
 /* Not generating wrapper methods for PPB_FlashFullscreen_1_0 */
 
+/* Begin wrapper methods for PPB_Flash_Menu_0_2 */
+
+static __attribute__((pnaclcall))
+PP_Resource Pnacl_M14_PPB_Flash_Menu_Create(PP_Instance instance_id, const struct PP_Flash_Menu* menu_data) {
+  const struct PPB_Flash_Menu_0_2 *iface = Pnacl_WrapperInfo_PPB_Flash_Menu_0_2.real_iface;
+  return iface->Create(instance_id, menu_data);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M14_PPB_Flash_Menu_IsFlashMenu(PP_Resource resource_id) {
+  const struct PPB_Flash_Menu_0_2 *iface = Pnacl_WrapperInfo_PPB_Flash_Menu_0_2.real_iface;
+  return iface->IsFlashMenu(resource_id);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M14_PPB_Flash_Menu_Show(PP_Resource menu_id, const struct PP_Point* location, int32_t* selected_id, struct PP_CompletionCallback callback) {
+  const struct PPB_Flash_Menu_0_2 *iface = Pnacl_WrapperInfo_PPB_Flash_Menu_0_2.real_iface;
+  return iface->Show(menu_id, location, selected_id, callback);
+}
+
+/* End wrapper methods for PPB_Flash_Menu_0_2 */
+
 /* Not generating wrapper methods for PPB_Flash_MessageLoop_0_1 */
 
 /* Not generating wrapper methods for PPB_Flash_Print_1_0 */
@@ -2746,6 +2977,8 @@
 
 /* End wrapper methods for PPB_Instance_Private_0_1 */
 
+/* Not generating wrapper methods for PPB_NaCl_Private_1_0 */
+
 /* Begin wrapper methods for PPB_NetAddress_Private_0_1 */
 
 static __attribute__((pnaclcall))
@@ -3146,6 +3379,88 @@
 
 /* End wrapper methods for PPB_TCPSocket_Private_0_4 */
 
+/* Begin wrapper methods for PPB_TCPSocket_Private_0_5 */
+
+static __attribute__((pnaclcall))
+PP_Resource Pnacl_M27_PPB_TCPSocket_Private_Create(PP_Instance instance) {
+  const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
+  return iface->Create(instance);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M27_PPB_TCPSocket_Private_IsTCPSocket(PP_Resource resource) {
+  const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
+  return iface->IsTCPSocket(resource);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M27_PPB_TCPSocket_Private_Connect(PP_Resource tcp_socket, const char* host, uint16_t port, struct PP_CompletionCallback callback) {
+  const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
+  return iface->Connect(tcp_socket, host, port, callback);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M27_PPB_TCPSocket_Private_ConnectWithNetAddress(PP_Resource tcp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) {
+  const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
+  return iface->ConnectWithNetAddress(tcp_socket, addr, callback);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M27_PPB_TCPSocket_Private_GetLocalAddress(PP_Resource tcp_socket, struct PP_NetAddress_Private* local_addr) {
+  const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
+  return iface->GetLocalAddress(tcp_socket, local_addr);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M27_PPB_TCPSocket_Private_GetRemoteAddress(PP_Resource tcp_socket, struct PP_NetAddress_Private* remote_addr) {
+  const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
+  return iface->GetRemoteAddress(tcp_socket, remote_addr);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M27_PPB_TCPSocket_Private_SSLHandshake(PP_Resource tcp_socket, const char* server_name, uint16_t server_port, struct PP_CompletionCallback callback) {
+  const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
+  return iface->SSLHandshake(tcp_socket, server_name, server_port, callback);
+}
+
+static __attribute__((pnaclcall))
+PP_Resource Pnacl_M27_PPB_TCPSocket_Private_GetServerCertificate(PP_Resource tcp_socket) {
+  const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
+  return iface->GetServerCertificate(tcp_socket);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M27_PPB_TCPSocket_Private_AddChainBuildingCertificate(PP_Resource tcp_socket, PP_Resource certificate, PP_Bool is_trusted) {
+  const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
+  return iface->AddChainBuildingCertificate(tcp_socket, certificate, is_trusted);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M27_PPB_TCPSocket_Private_Read(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) {
+  const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
+  return iface->Read(tcp_socket, buffer, bytes_to_read, callback);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M27_PPB_TCPSocket_Private_Write(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) {
+  const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
+  return iface->Write(tcp_socket, buffer, bytes_to_write, callback);
+}
+
+static __attribute__((pnaclcall))
+void Pnacl_M27_PPB_TCPSocket_Private_Disconnect(PP_Resource tcp_socket) {
+  const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
+  iface->Disconnect(tcp_socket);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M27_PPB_TCPSocket_Private_SetOption(PP_Resource tcp_socket, PP_TCPSocketOption_Private name, struct PP_Var value, struct PP_CompletionCallback callback) {
+  const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
+  return iface->SetOption(tcp_socket, name, value, callback);
+}
+
+/* End wrapper methods for PPB_TCPSocket_Private_0_5 */
+
 /* Begin wrapper methods for PPB_UDPSocket_Private_0_2 */
 
 static __attribute__((pnaclcall))
@@ -3426,19 +3741,74 @@
 
 /* End wrapper methods for PPP_Instance_Private_0_1 */
 
+/* Begin wrapper methods for PPB_Ext_Alarms_Dev_0_1 */
+
+static __attribute__((pnaclcall))
+void Pnacl_M27_PPB_Ext_Alarms_Dev_Create(PP_Instance instance, struct PP_Var name, PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info) {
+  const struct PPB_Ext_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1.real_iface;
+  iface->Create(instance, name, alarm_info);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M27_PPB_Ext_Alarms_Dev_Get(PP_Instance instance, struct PP_Var name, PP_Ext_Alarms_Alarm_Dev* alarm, struct PP_CompletionCallback callback) {
+  const struct PPB_Ext_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1.real_iface;
+  return iface->Get(instance, name, alarm, callback);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M27_PPB_Ext_Alarms_Dev_GetAll(PP_Instance instance, PP_Ext_Alarms_Alarm_Dev_Array* alarms, struct PP_CompletionCallback callback) {
+  const struct PPB_Ext_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1.real_iface;
+  return iface->GetAll(instance, alarms, callback);
+}
+
+static __attribute__((pnaclcall))
+void Pnacl_M27_PPB_Ext_Alarms_Dev_Clear(PP_Instance instance, struct PP_Var name) {
+  const struct PPB_Ext_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1.real_iface;
+  iface->Clear(instance, name);
+}
+
+static __attribute__((pnaclcall))
+void Pnacl_M27_PPB_Ext_Alarms_Dev_ClearAll(PP_Instance instance) {
+  const struct PPB_Ext_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1.real_iface;
+  iface->ClearAll(instance);
+}
+
+/* End wrapper methods for PPB_Ext_Alarms_Dev_0_1 */
+
+/* Begin wrapper methods for PPB_Ext_Events_Dev_0_1 */
+
+static __attribute__((pnaclcall))
+uint32_t Pnacl_M27_PPB_Ext_Events_Dev_AddListener(PP_Instance instance, struct PP_Ext_EventListener listener) {
+  const struct PPB_Ext_Events_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Events_Dev_0_1.real_iface;
+  return iface->AddListener(instance, listener);
+}
+
+static __attribute__((pnaclcall))
+void Pnacl_M27_PPB_Ext_Events_Dev_RemoveListener(PP_Instance instance, uint32_t listener_id) {
+  const struct PPB_Ext_Events_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Events_Dev_0_1.real_iface;
+  iface->RemoveListener(instance, listener_id);
+}
+
+/* End wrapper methods for PPB_Ext_Events_Dev_0_1 */
+
 /* Not generating wrapper interface for PPB_Audio_1_0 */
 
 /* Not generating wrapper interface for PPB_AudioConfig_1_0 */
 
 /* Not generating wrapper interface for PPB_AudioConfig_1_1 */
 
+struct PPB_Console_1_0 Pnacl_Wrappers_PPB_Console_1_0 = {
+    .Log = (void (*)(PP_Instance instance, PP_LogLevel level, struct PP_Var value))&Pnacl_M25_PPB_Console_Log,
+    .LogWithSource = (void (*)(PP_Instance instance, PP_LogLevel level, struct PP_Var source, struct PP_Var value))&Pnacl_M25_PPB_Console_LogWithSource
+};
+
 struct PPB_Core_1_0 Pnacl_Wrappers_PPB_Core_1_0 = {
     .AddRefResource = (void (*)(PP_Resource resource))&Pnacl_M14_PPB_Core_AddRefResource,
     .ReleaseResource = (void (*)(PP_Resource resource))&Pnacl_M14_PPB_Core_ReleaseResource,
-    .GetTime = (PP_Time (*)())&Pnacl_M14_PPB_Core_GetTime,
-    .GetTimeTicks = (PP_TimeTicks (*)())&Pnacl_M14_PPB_Core_GetTimeTicks,
+    .GetTime = (PP_Time (*)(void))&Pnacl_M14_PPB_Core_GetTime,
+    .GetTimeTicks = (PP_TimeTicks (*)(void))&Pnacl_M14_PPB_Core_GetTimeTicks,
     .CallOnMainThread = (void (*)(int32_t delay_in_milliseconds, struct PP_CompletionCallback callback, int32_t result))&Pnacl_M14_PPB_Core_CallOnMainThread,
-    .IsMainThread = (PP_Bool (*)())&Pnacl_M14_PPB_Core_IsMainThread
+    .IsMainThread = (PP_Bool (*)(void))&Pnacl_M14_PPB_Core_IsMainThread
 };
 
 struct PPB_FileIO_1_0 Pnacl_Wrappers_PPB_FileIO_1_0 = {
@@ -3454,6 +3824,20 @@
     .Close = (void (*)(PP_Resource file_io))&Pnacl_M14_PPB_FileIO_Close
 };
 
+struct PPB_FileIO_1_1 Pnacl_Wrappers_PPB_FileIO_1_1 = {
+    .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M25_PPB_FileIO_Create,
+    .IsFileIO = (PP_Bool (*)(PP_Resource resource))&Pnacl_M25_PPB_FileIO_IsFileIO,
+    .Open = (int32_t (*)(PP_Resource file_io, PP_Resource file_ref, int32_t open_flags, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_FileIO_Open,
+    .Query = (int32_t (*)(PP_Resource file_io, struct PP_FileInfo* info, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_FileIO_Query,
+    .Touch = (int32_t (*)(PP_Resource file_io, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_FileIO_Touch,
+    .Read = (int32_t (*)(PP_Resource file_io, int64_t offset, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_FileIO_Read,
+    .Write = (int32_t (*)(PP_Resource file_io, int64_t offset, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_FileIO_Write,
+    .SetLength = (int32_t (*)(PP_Resource file_io, int64_t length, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_FileIO_SetLength,
+    .Flush = (int32_t (*)(PP_Resource file_io, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_FileIO_Flush,
+    .Close = (void (*)(PP_Resource file_io))&Pnacl_M25_PPB_FileIO_Close,
+    .ReadToArray = (int32_t (*)(PP_Resource file_io, int64_t offset, int32_t max_read_length, struct PP_ArrayOutput* output, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_FileIO_ReadToArray
+};
+
 struct PPB_FileRef_1_0 Pnacl_Wrappers_PPB_FileRef_1_0 = {
     .Create = (PP_Resource (*)(PP_Resource file_system, const char* path))&Pnacl_M14_PPB_FileRef_Create,
     .IsFileRef = (PP_Bool (*)(PP_Resource resource))&Pnacl_M14_PPB_FileRef_IsFileRef,
@@ -3544,15 +3928,18 @@
     .GetTouchById = (struct PP_TouchPoint (*)(PP_Resource resource, PP_TouchListType list, uint32_t touch_id))&Pnacl_M13_PPB_TouchInputEvent_GetTouchById
 };
 
-struct PPB_Instance_0_5 Pnacl_Wrappers_PPB_Instance_0_5 = {
-    .GetWindowObject = (struct PP_Var (*)(PP_Instance instance))&Pnacl_M13_PPB_Instance_GetWindowObject,
-    .GetOwnerElementObject = (struct PP_Var (*)(PP_Instance instance))&Pnacl_M13_PPB_Instance_GetOwnerElementObject,
-    .BindGraphics = (PP_Bool (*)(PP_Instance instance, PP_Resource device))&Pnacl_M13_PPB_Instance_BindGraphics,
-    .IsFullFrame = (PP_Bool (*)(PP_Instance instance))&Pnacl_M13_PPB_Instance_IsFullFrame
-};
-
 /* Not generating wrapper interface for PPB_Instance_1_0 */
 
+struct PPB_MessageLoop_1_0 Pnacl_Wrappers_PPB_MessageLoop_1_0 = {
+    .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M25_PPB_MessageLoop_Create,
+    .GetForMainThread = (PP_Resource (*)(void))&Pnacl_M25_PPB_MessageLoop_GetForMainThread,
+    .GetCurrent = (PP_Resource (*)(void))&Pnacl_M25_PPB_MessageLoop_GetCurrent,
+    .AttachToCurrentThread = (int32_t (*)(PP_Resource message_loop))&Pnacl_M25_PPB_MessageLoop_AttachToCurrentThread,
+    .Run = (int32_t (*)(PP_Resource message_loop))&Pnacl_M25_PPB_MessageLoop_Run,
+    .PostWork = (int32_t (*)(PP_Resource message_loop, struct PP_CompletionCallback callback, int64_t delay_ms))&Pnacl_M25_PPB_MessageLoop_PostWork,
+    .PostQuit = (int32_t (*)(PP_Resource message_loop, PP_Bool should_destroy))&Pnacl_M25_PPB_MessageLoop_PostQuit
+};
+
 struct PPB_Messaging_1_0 Pnacl_Wrappers_PPB_Messaging_1_0 = {
     .PostMessage = (void (*)(PP_Instance instance, struct PP_Var message))&Pnacl_M14_PPB_Messaging_PostMessage
 };
@@ -3659,6 +4046,14 @@
     .GetHandle = (int32_t (*)(PP_Resource broker, int32_t* handle))&Pnacl_M14_PPB_BrokerTrusted_GetHandle
 };
 
+struct PPB_BrokerTrusted_0_3 Pnacl_Wrappers_PPB_BrokerTrusted_0_3 = {
+    .CreateTrusted = (PP_Resource (*)(PP_Instance instance))&Pnacl_M25_PPB_BrokerTrusted_CreateTrusted,
+    .IsBrokerTrusted = (PP_Bool (*)(PP_Resource resource))&Pnacl_M25_PPB_BrokerTrusted_IsBrokerTrusted,
+    .Connect = (int32_t (*)(PP_Resource broker, struct PP_CompletionCallback connect_callback))&Pnacl_M25_PPB_BrokerTrusted_Connect,
+    .GetHandle = (int32_t (*)(PP_Resource broker, int32_t* handle))&Pnacl_M25_PPB_BrokerTrusted_GetHandle,
+    .IsAllowed = (PP_Bool (*)(PP_Resource broker))&Pnacl_M25_PPB_BrokerTrusted_IsAllowed
+};
+
 struct PPB_BrowserFont_Trusted_1_0 Pnacl_Wrappers_PPB_BrowserFont_Trusted_1_0 = {
     .GetFontFamilies = (struct PP_Var (*)(PP_Instance instance))&Pnacl_M19_PPB_BrowserFont_Trusted_GetFontFamilies,
     .Create = (PP_Resource (*)(PP_Instance instance, const struct PP_BrowserFont_Trusted_Description* description))&Pnacl_M19_PPB_BrowserFont_Trusted_Create,
@@ -3692,6 +4087,19 @@
     .WillSetLength = (int32_t (*)(PP_Resource file_io, int64_t length, struct PP_CompletionCallback callback))&Pnacl_M14_PPB_FileIOTrusted_WillSetLength
 };
 
+struct PPB_Graphics3DTrusted_1_0 Pnacl_Wrappers_PPB_Graphics3DTrusted_1_0 = {
+    .CreateRaw = (PP_Resource (*)(PP_Instance instance_id, PP_Resource share_context, const int32_t attrib_list[]))&Pnacl_M16_PPB_Graphics3DTrusted_CreateRaw,
+    .InitCommandBuffer = (PP_Bool (*)(PP_Resource context_id))&Pnacl_M16_PPB_Graphics3DTrusted_InitCommandBuffer,
+    .SetGetBuffer = (PP_Bool (*)(PP_Resource context, int32_t transfer_buffer_id))&Pnacl_M16_PPB_Graphics3DTrusted_SetGetBuffer,
+    .GetState = (struct PP_Graphics3DTrustedState (*)(PP_Resource context))&Pnacl_M16_PPB_Graphics3DTrusted_GetState,
+    .CreateTransferBuffer = (int32_t (*)(PP_Resource context, uint32_t size))&Pnacl_M16_PPB_Graphics3DTrusted_CreateTransferBuffer,
+    .DestroyTransferBuffer = (PP_Bool (*)(PP_Resource context, int32_t id))&Pnacl_M16_PPB_Graphics3DTrusted_DestroyTransferBuffer,
+    .GetTransferBuffer = (PP_Bool (*)(PP_Resource context, int32_t id, int* shm_handle, uint32_t* shm_size))&Pnacl_M16_PPB_Graphics3DTrusted_GetTransferBuffer,
+    .Flush = (PP_Bool (*)(PP_Resource context, int32_t put_offset))&Pnacl_M16_PPB_Graphics3DTrusted_Flush,
+    .FlushSync = (struct PP_Graphics3DTrustedState (*)(PP_Resource context, int32_t put_offset))&Pnacl_M16_PPB_Graphics3DTrusted_FlushSync,
+    .FlushSyncFast = (struct PP_Graphics3DTrustedState (*)(PP_Resource context, int32_t put_offset, int32_t last_known_get))&Pnacl_M16_PPB_Graphics3DTrusted_FlushSyncFast
+};
+
 /* Not generating wrapper interface for PPB_ImageDataTrusted_0_4 */
 
 /* Not generating wrapper interface for PPB_URLLoaderTrusted_0_3 */
@@ -3707,13 +4115,20 @@
     .Close = (void (*)(PP_Resource audio_input))&Pnacl_M19_PPB_AudioInput_Dev_Close
 };
 
-/* Not generating wrapper interface for PPB_Buffer_Dev_0_4 */
-
-struct PPB_Console_Dev_0_1 Pnacl_Wrappers_PPB_Console_Dev_0_1 = {
-    .Log = (void (*)(PP_Instance instance, PP_LogLevel_Dev level, struct PP_Var value))&Pnacl_M14_PPB_Console_Dev_Log,
-    .LogWithSource = (void (*)(PP_Instance instance, PP_LogLevel_Dev level, struct PP_Var source, struct PP_Var value))&Pnacl_M14_PPB_Console_Dev_LogWithSource
+struct PPB_AudioInput_Dev_0_3 Pnacl_Wrappers_PPB_AudioInput_Dev_0_3 = {
+    .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M25_PPB_AudioInput_Dev_Create,
+    .IsAudioInput = (PP_Bool (*)(PP_Resource resource))&Pnacl_M25_PPB_AudioInput_Dev_IsAudioInput,
+    .EnumerateDevices = (int32_t (*)(PP_Resource audio_input, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_AudioInput_Dev_EnumerateDevices,
+    .MonitorDeviceChange = (int32_t (*)(PP_Resource audio_input, PP_MonitorDeviceChangeCallback callback, void* user_data))&Pnacl_M25_PPB_AudioInput_Dev_MonitorDeviceChange,
+    .Open = (int32_t (*)(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback audio_input_callback, void* user_data, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_AudioInput_Dev_Open,
+    .GetCurrentConfig = (PP_Resource (*)(PP_Resource audio_input))&Pnacl_M25_PPB_AudioInput_Dev_GetCurrentConfig,
+    .StartCapture = (PP_Bool (*)(PP_Resource audio_input))&Pnacl_M25_PPB_AudioInput_Dev_StartCapture,
+    .StopCapture = (PP_Bool (*)(PP_Resource audio_input))&Pnacl_M25_PPB_AudioInput_Dev_StopCapture,
+    .Close = (void (*)(PP_Resource audio_input))&Pnacl_M25_PPB_AudioInput_Dev_Close
 };
 
+/* Not generating wrapper interface for PPB_Buffer_Dev_0_4 */
+
 /* Not generating wrapper interface for PPB_Crypto_Dev_0_1 */
 
 /* Not generating wrapper interface for PPB_CursorControl_Dev_0_4 */
@@ -3724,6 +4139,12 @@
     .GetName = (struct PP_Var (*)(PP_Resource device_ref))&Pnacl_M18_PPB_DeviceRef_Dev_GetName
 };
 
+struct PPB_DirectoryReader_Dev_0_6 Pnacl_Wrappers_PPB_DirectoryReader_Dev_0_6 = {
+    .Create = (PP_Resource (*)(PP_Resource directory_ref))&Pnacl_M27_PPB_DirectoryReader_Dev_Create,
+    .IsDirectoryReader = (PP_Bool (*)(PP_Resource resource))&Pnacl_M27_PPB_DirectoryReader_Dev_IsDirectoryReader,
+    .ReadEntries = (int32_t (*)(PP_Resource directory_reader, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M27_PPB_DirectoryReader_Dev_ReadEntries
+};
+
 struct PPB_FileChooser_Dev_0_5 Pnacl_Wrappers_PPB_FileChooser_Dev_0_5 = {
     .Create = (PP_Resource (*)(PP_Instance instance, PP_FileChooserMode_Dev mode, struct PP_Var accept_types))&Pnacl_M16_PPB_FileChooser_Dev_Create,
     .IsFileChooser = (PP_Bool (*)(PP_Resource resource))&Pnacl_M16_PPB_FileChooser_Dev_IsFileChooser,
@@ -3775,16 +4196,6 @@
 
 /* Not generating wrapper interface for PPB_Memory_Dev_0_1 */
 
-struct PPB_MessageLoop_Dev_0_1 Pnacl_Wrappers_PPB_MessageLoop_Dev_0_1 = {
-    .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M18_PPB_MessageLoop_Dev_Create,
-    .GetForMainThread = (PP_Resource (*)())&Pnacl_M18_PPB_MessageLoop_Dev_GetForMainThread,
-    .GetCurrent = (PP_Resource (*)())&Pnacl_M18_PPB_MessageLoop_Dev_GetCurrent,
-    .AttachToCurrentThread = (int32_t (*)(PP_Resource message_loop))&Pnacl_M18_PPB_MessageLoop_Dev_AttachToCurrentThread,
-    .Run = (int32_t (*)(PP_Resource message_loop))&Pnacl_M18_PPB_MessageLoop_Dev_Run,
-    .PostWork = (int32_t (*)(PP_Resource message_loop, struct PP_CompletionCallback callback, int64_t delay_ms))&Pnacl_M18_PPB_MessageLoop_Dev_PostWork,
-    .PostQuit = (int32_t (*)(PP_Resource message_loop, PP_Bool should_destroy))&Pnacl_M18_PPB_MessageLoop_Dev_PostQuit
-};
-
 /* Not generating wrapper interface for PPB_Printing_Dev_0_6 */
 
 struct PPB_Printing_Dev_0_7 Pnacl_Wrappers_PPB_Printing_Dev_0_7 = {
@@ -3805,7 +4216,7 @@
     .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M17_PPB_Testing_Dev_RunMessageLoop,
     .QuitMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M17_PPB_Testing_Dev_QuitMessageLoop,
     .GetLiveObjectsForInstance = (uint32_t (*)(PP_Instance instance))&Pnacl_M17_PPB_Testing_Dev_GetLiveObjectsForInstance,
-    .IsOutOfProcess = (PP_Bool (*)())&Pnacl_M17_PPB_Testing_Dev_IsOutOfProcess,
+    .IsOutOfProcess = (PP_Bool (*)(void))&Pnacl_M17_PPB_Testing_Dev_IsOutOfProcess,
     .SimulateInputEvent = (void (*)(PP_Instance instance, PP_Resource input_event))&Pnacl_M17_PPB_Testing_Dev_SimulateInputEvent,
     .GetDocumentURL = (struct PP_Var (*)(PP_Instance instance, struct PP_URLComponents_Dev* components))&Pnacl_M17_PPB_Testing_Dev_GetDocumentURL
 };
@@ -3815,7 +4226,7 @@
     .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M18_PPB_Testing_Dev_RunMessageLoop,
     .QuitMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M18_PPB_Testing_Dev_QuitMessageLoop,
     .GetLiveObjectsForInstance = (uint32_t (*)(PP_Instance instance))&Pnacl_M18_PPB_Testing_Dev_GetLiveObjectsForInstance,
-    .IsOutOfProcess = (PP_Bool (*)())&Pnacl_M18_PPB_Testing_Dev_IsOutOfProcess,
+    .IsOutOfProcess = (PP_Bool (*)(void))&Pnacl_M18_PPB_Testing_Dev_IsOutOfProcess,
     .SimulateInputEvent = (void (*)(PP_Instance instance, PP_Resource input_event))&Pnacl_M18_PPB_Testing_Dev_SimulateInputEvent,
     .GetDocumentURL = (struct PP_Var (*)(PP_Instance instance, struct PP_URLComponents_Dev* components))&Pnacl_M18_PPB_Testing_Dev_GetDocumentURL,
     .GetLiveVars = (uint32_t (*)(struct PP_Var live_vars[], uint32_t array_size))&Pnacl_M18_PPB_Testing_Dev_GetLiveVars
@@ -3825,6 +4236,17 @@
 
 /* Not generating wrapper interface for PPB_TextInput_Dev_0_2 */
 
+/* Not generating wrapper interface for PPB_Trace_Event_Dev_0_1 */
+
+struct PPB_TrueTypeFont_Dev_0_1 Pnacl_Wrappers_PPB_TrueTypeFont_Dev_0_1 = {
+    .GetFontFamilies = (int32_t (*)(PP_Instance instance, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M26_PPB_TrueTypeFont_Dev_GetFontFamilies,
+    .Create = (PP_Resource (*)(PP_Instance instance, const struct PP_TrueTypeFontDesc_Dev* desc))&Pnacl_M26_PPB_TrueTypeFont_Dev_Create,
+    .IsFont = (PP_Bool (*)(PP_Resource resource))&Pnacl_M26_PPB_TrueTypeFont_Dev_IsFont,
+    .Describe = (int32_t (*)(PP_Resource font, struct PP_TrueTypeFontDesc_Dev* desc, struct PP_CompletionCallback callback))&Pnacl_M26_PPB_TrueTypeFont_Dev_Describe,
+    .GetTableTags = (int32_t (*)(PP_Resource font, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M26_PPB_TrueTypeFont_Dev_GetTableTags,
+    .GetTable = (int32_t (*)(PP_Resource font, uint32_t table, int32_t offset, int32_t max_data_length, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M26_PPB_TrueTypeFont_Dev_GetTable
+};
+
 struct PPB_URLUtil_Dev_0_6 Pnacl_Wrappers_PPB_URLUtil_Dev_0_6 = {
     .Canonicalize = (struct PP_Var (*)(struct PP_Var url, struct PP_URLComponents_Dev* components))&Pnacl_M17_PPB_URLUtil_Dev_Canonicalize,
     .ResolveRelativeToURL = (struct PP_Var (*)(struct PP_Var base_url, struct PP_Var relative_string, struct PP_URLComponents_Dev* components))&Pnacl_M17_PPB_URLUtil_Dev_ResolveRelativeToURL,
@@ -3836,7 +4258,22 @@
     .GetPluginInstanceURL = (struct PP_Var (*)(PP_Instance instance, struct PP_URLComponents_Dev* components))&Pnacl_M17_PPB_URLUtil_Dev_GetPluginInstanceURL
 };
 
-/* Not generating wrapper interface for PPB_VideoCapture_Dev_0_1 */
+struct PPB_VarArray_Dev_0_1 Pnacl_Wrappers_PPB_VarArray_Dev_0_1 = {
+    .Create = (struct PP_Var (*)(void))&Pnacl_M27_PPB_VarArray_Dev_Create,
+    .Get = (struct PP_Var (*)(struct PP_Var array, uint32_t index))&Pnacl_M27_PPB_VarArray_Dev_Get,
+    .Set = (PP_Bool (*)(struct PP_Var array, uint32_t index, struct PP_Var value))&Pnacl_M27_PPB_VarArray_Dev_Set,
+    .GetLength = (uint32_t (*)(struct PP_Var array))&Pnacl_M27_PPB_VarArray_Dev_GetLength,
+    .SetLength = (PP_Bool (*)(struct PP_Var array, uint32_t length))&Pnacl_M27_PPB_VarArray_Dev_SetLength
+};
+
+struct PPB_VarDictionary_Dev_0_1 Pnacl_Wrappers_PPB_VarDictionary_Dev_0_1 = {
+    .Create = (struct PP_Var (*)(void))&Pnacl_M27_PPB_VarDictionary_Dev_Create,
+    .Get = (struct PP_Var (*)(struct PP_Var dict, struct PP_Var key))&Pnacl_M27_PPB_VarDictionary_Dev_Get,
+    .Set = (PP_Bool (*)(struct PP_Var dict, struct PP_Var key, struct PP_Var value))&Pnacl_M27_PPB_VarDictionary_Dev_Set,
+    .Delete = (void (*)(struct PP_Var dict, struct PP_Var key))&Pnacl_M27_PPB_VarDictionary_Dev_Delete,
+    .HasKey = (PP_Bool (*)(struct PP_Var dict, struct PP_Var key))&Pnacl_M27_PPB_VarDictionary_Dev_HasKey,
+    .GetKeys = (struct PP_Var (*)(struct PP_Var dict))&Pnacl_M27_PPB_VarDictionary_Dev_GetKeys
+};
 
 struct PPB_VideoCapture_Dev_0_2 Pnacl_Wrappers_PPB_VideoCapture_Dev_0_2 = {
     .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M19_PPB_VideoCapture_Dev_Create,
@@ -3849,6 +4286,18 @@
     .Close = (void (*)(PP_Resource video_capture))&Pnacl_M19_PPB_VideoCapture_Dev_Close
 };
 
+struct PPB_VideoCapture_Dev_0_3 Pnacl_Wrappers_PPB_VideoCapture_Dev_0_3 = {
+    .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M25_PPB_VideoCapture_Dev_Create,
+    .IsVideoCapture = (PP_Bool (*)(PP_Resource video_capture))&Pnacl_M25_PPB_VideoCapture_Dev_IsVideoCapture,
+    .EnumerateDevices = (int32_t (*)(PP_Resource video_capture, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_VideoCapture_Dev_EnumerateDevices,
+    .MonitorDeviceChange = (int32_t (*)(PP_Resource video_capture, PP_MonitorDeviceChangeCallback callback, void* user_data))&Pnacl_M25_PPB_VideoCapture_Dev_MonitorDeviceChange,
+    .Open = (int32_t (*)(PP_Resource video_capture, PP_Resource device_ref, const struct PP_VideoCaptureDeviceInfo_Dev* requested_info, uint32_t buffer_count, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_VideoCapture_Dev_Open,
+    .StartCapture = (int32_t (*)(PP_Resource video_capture))&Pnacl_M25_PPB_VideoCapture_Dev_StartCapture,
+    .ReuseBuffer = (int32_t (*)(PP_Resource video_capture, uint32_t buffer))&Pnacl_M25_PPB_VideoCapture_Dev_ReuseBuffer,
+    .StopCapture = (int32_t (*)(PP_Resource video_capture))&Pnacl_M25_PPB_VideoCapture_Dev_StopCapture,
+    .Close = (void (*)(PP_Resource video_capture))&Pnacl_M25_PPB_VideoCapture_Dev_Close
+};
+
 struct PPB_VideoDecoder_Dev_0_16 Pnacl_Wrappers_PPB_VideoDecoder_Dev_0_16 = {
     .Create = (PP_Resource (*)(PP_Instance instance, PP_Resource context, PP_VideoDecoder_Profile profile))&Pnacl_M14_PPB_VideoDecoder_Dev_Create,
     .IsVideoDecoder = (PP_Bool (*)(PP_Resource resource))&Pnacl_M14_PPB_VideoDecoder_Dev_IsVideoDecoder,
@@ -3872,6 +4321,14 @@
 
 /* Not generating wrapper interface for PPP_Printing_Dev_0_6 */
 
+/* Not generating wrapper interface for PPP_Scrollbar_Dev_0_2 */
+
+/* Not generating wrapper interface for PPP_Scrollbar_Dev_0_3 */
+
+struct PPP_Selection_Dev_0_3 Pnacl_Wrappers_PPP_Selection_Dev_0_3 = {
+    .GetSelectedText = (struct PP_Var (*)(PP_Instance instance, PP_Bool html))&Pnacl_M13_PPP_Selection_Dev_GetSelectedText
+};
+
 /* Not generating wrapper interface for PPP_TextInput_Dev_0_1 */
 
 /* Not generating wrapper interface for PPP_VideoCapture_Dev_0_1 */
@@ -3889,7 +4346,7 @@
 struct PPB_ContentDecryptor_Private_0_6 Pnacl_Wrappers_PPB_ContentDecryptor_Private_0_6 = {
     .NeedKey = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, struct PP_Var init_data))&Pnacl_M24_PPB_ContentDecryptor_Private_NeedKey,
     .KeyAdded = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id))&Pnacl_M24_PPB_ContentDecryptor_Private_KeyAdded,
-    .KeyMessage = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, PP_Resource message, struct PP_Var default_url))&Pnacl_M24_PPB_ContentDecryptor_Private_KeyMessage,
+    .KeyMessage = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, struct PP_Var message, struct PP_Var default_url))&Pnacl_M24_PPB_ContentDecryptor_Private_KeyMessage,
     .KeyError = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, int32_t media_error, int32_t system_code))&Pnacl_M24_PPB_ContentDecryptor_Private_KeyError,
     .DeliverBlock = (void (*)(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo* decrypted_block_info))&Pnacl_M24_PPB_ContentDecryptor_Private_DeliverBlock,
     .DecoderInitializeDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success))&Pnacl_M24_PPB_ContentDecryptor_Private_DecoderInitializeDone,
@@ -3903,69 +4360,9 @@
     .GetAbsolutePath = (struct PP_Var (*)(PP_Resource file_ref))&Pnacl_M15_PPB_FileRefPrivate_GetAbsolutePath
 };
 
-struct PPB_Flash_12_0 Pnacl_Wrappers_PPB_Flash_12_0 = {
-    .SetInstanceAlwaysOnTop = (void (*)(PP_Instance instance, PP_Bool on_top))&Pnacl_M17_PPB_Flash_SetInstanceAlwaysOnTop,
-    .DrawGlyphs = (PP_Bool (*)(PP_Instance instance, PP_Resource pp_image_data, const struct PP_FontDescription_Dev* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]))&Pnacl_M17_PPB_Flash_DrawGlyphs,
-    .GetProxyForURL = (struct PP_Var (*)(PP_Instance instance, const char* url))&Pnacl_M17_PPB_Flash_GetProxyForURL,
-    .Navigate = (int32_t (*)(PP_Resource request_info, const char* target, PP_Bool from_user_action))&Pnacl_M17_PPB_Flash_Navigate,
-    .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M17_PPB_Flash_RunMessageLoop,
-    .QuitMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M17_PPB_Flash_QuitMessageLoop,
-    .GetLocalTimeZoneOffset = (double (*)(PP_Instance instance, PP_Time t))&Pnacl_M17_PPB_Flash_GetLocalTimeZoneOffset,
-    .GetCommandLineArgs = (struct PP_Var (*)(PP_Module module))&Pnacl_M17_PPB_Flash_GetCommandLineArgs,
-    .PreloadFontWin = (void (*)(const void* logfontw))&Pnacl_M17_PPB_Flash_PreloadFontWin
-};
-
-struct PPB_Flash_12_1 Pnacl_Wrappers_PPB_Flash_12_1 = {
-    .SetInstanceAlwaysOnTop = (void (*)(PP_Instance instance, PP_Bool on_top))&Pnacl_M19_PPB_Flash_SetInstanceAlwaysOnTop,
-    .DrawGlyphs = (PP_Bool (*)(PP_Instance instance, PP_Resource pp_image_data, const struct PP_FontDescription_Dev* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]))&Pnacl_M19_PPB_Flash_DrawGlyphs,
-    .GetProxyForURL = (struct PP_Var (*)(PP_Instance instance, const char* url))&Pnacl_M19_PPB_Flash_GetProxyForURL,
-    .Navigate = (int32_t (*)(PP_Resource request_info, const char* target, PP_Bool from_user_action))&Pnacl_M19_PPB_Flash_Navigate,
-    .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M19_PPB_Flash_RunMessageLoop,
-    .QuitMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M19_PPB_Flash_QuitMessageLoop,
-    .GetLocalTimeZoneOffset = (double (*)(PP_Instance instance, PP_Time t))&Pnacl_M19_PPB_Flash_GetLocalTimeZoneOffset,
-    .GetCommandLineArgs = (struct PP_Var (*)(PP_Module module))&Pnacl_M19_PPB_Flash_GetCommandLineArgs,
-    .PreloadFontWin = (void (*)(const void* logfontw))&Pnacl_M19_PPB_Flash_PreloadFontWin,
-    .IsRectTopmost = (PP_Bool (*)(PP_Instance instance, const struct PP_Rect* rect))&Pnacl_M19_PPB_Flash_IsRectTopmost,
-    .InvokePrinting = (int32_t (*)(PP_Instance instance))&Pnacl_M19_PPB_Flash_InvokePrinting,
-    .UpdateActivity = (void (*)(PP_Instance instance))&Pnacl_M19_PPB_Flash_UpdateActivity
-};
-
-struct PPB_Flash_12_2 Pnacl_Wrappers_PPB_Flash_12_2 = {
-    .SetInstanceAlwaysOnTop = (void (*)(PP_Instance instance, PP_Bool on_top))&Pnacl_M20_0_PPB_Flash_SetInstanceAlwaysOnTop,
-    .DrawGlyphs = (PP_Bool (*)(PP_Instance instance, PP_Resource pp_image_data, const struct PP_FontDescription_Dev* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]))&Pnacl_M20_0_PPB_Flash_DrawGlyphs,
-    .GetProxyForURL = (struct PP_Var (*)(PP_Instance instance, const char* url))&Pnacl_M20_0_PPB_Flash_GetProxyForURL,
-    .Navigate = (int32_t (*)(PP_Resource request_info, const char* target, PP_Bool from_user_action))&Pnacl_M20_0_PPB_Flash_Navigate,
-    .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M20_0_PPB_Flash_RunMessageLoop,
-    .QuitMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M20_0_PPB_Flash_QuitMessageLoop,
-    .GetLocalTimeZoneOffset = (double (*)(PP_Instance instance, PP_Time t))&Pnacl_M20_0_PPB_Flash_GetLocalTimeZoneOffset,
-    .GetCommandLineArgs = (struct PP_Var (*)(PP_Module module))&Pnacl_M20_0_PPB_Flash_GetCommandLineArgs,
-    .PreloadFontWin = (void (*)(const void* logfontw))&Pnacl_M20_0_PPB_Flash_PreloadFontWin,
-    .IsRectTopmost = (PP_Bool (*)(PP_Instance instance, const struct PP_Rect* rect))&Pnacl_M20_0_PPB_Flash_IsRectTopmost,
-    .InvokePrinting = (int32_t (*)(PP_Instance instance))&Pnacl_M20_0_PPB_Flash_InvokePrinting,
-    .UpdateActivity = (void (*)(PP_Instance instance))&Pnacl_M20_0_PPB_Flash_UpdateActivity,
-    .GetDeviceID = (struct PP_Var (*)(PP_Instance instance))&Pnacl_M20_0_PPB_Flash_GetDeviceID
-};
-
-struct PPB_Flash_12_3 Pnacl_Wrappers_PPB_Flash_12_3 = {
-    .SetInstanceAlwaysOnTop = (void (*)(PP_Instance instance, PP_Bool on_top))&Pnacl_M20_1_PPB_Flash_SetInstanceAlwaysOnTop,
-    .DrawGlyphs = (PP_Bool (*)(PP_Instance instance, PP_Resource pp_image_data, const struct PP_FontDescription_Dev* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]))&Pnacl_M20_1_PPB_Flash_DrawGlyphs,
-    .GetProxyForURL = (struct PP_Var (*)(PP_Instance instance, const char* url))&Pnacl_M20_1_PPB_Flash_GetProxyForURL,
-    .Navigate = (int32_t (*)(PP_Resource request_info, const char* target, PP_Bool from_user_action))&Pnacl_M20_1_PPB_Flash_Navigate,
-    .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M20_1_PPB_Flash_RunMessageLoop,
-    .QuitMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M20_1_PPB_Flash_QuitMessageLoop,
-    .GetLocalTimeZoneOffset = (double (*)(PP_Instance instance, PP_Time t))&Pnacl_M20_1_PPB_Flash_GetLocalTimeZoneOffset,
-    .GetCommandLineArgs = (struct PP_Var (*)(PP_Module module))&Pnacl_M20_1_PPB_Flash_GetCommandLineArgs,
-    .PreloadFontWin = (void (*)(const void* logfontw))&Pnacl_M20_1_PPB_Flash_PreloadFontWin,
-    .IsRectTopmost = (PP_Bool (*)(PP_Instance instance, const struct PP_Rect* rect))&Pnacl_M20_1_PPB_Flash_IsRectTopmost,
-    .InvokePrinting = (int32_t (*)(PP_Instance instance))&Pnacl_M20_1_PPB_Flash_InvokePrinting,
-    .UpdateActivity = (void (*)(PP_Instance instance))&Pnacl_M20_1_PPB_Flash_UpdateActivity,
-    .GetDeviceID = (struct PP_Var (*)(PP_Instance instance))&Pnacl_M20_1_PPB_Flash_GetDeviceID,
-    .GetSettingInt = (int32_t (*)(PP_Instance instance, PP_FlashSetting setting))&Pnacl_M20_1_PPB_Flash_GetSettingInt
-};
-
 struct PPB_Flash_12_4 Pnacl_Wrappers_PPB_Flash_12_4 = {
     .SetInstanceAlwaysOnTop = (void (*)(PP_Instance instance, PP_Bool on_top))&Pnacl_M21_PPB_Flash_SetInstanceAlwaysOnTop,
-    .DrawGlyphs = (PP_Bool (*)(PP_Instance instance, PP_Resource pp_image_data, const struct PP_FontDescription_Dev* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]))&Pnacl_M21_PPB_Flash_DrawGlyphs,
+    .DrawGlyphs = (PP_Bool (*)(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]))&Pnacl_M21_PPB_Flash_DrawGlyphs,
     .GetProxyForURL = (struct PP_Var (*)(PP_Instance instance, const char* url))&Pnacl_M21_PPB_Flash_GetProxyForURL,
     .Navigate = (int32_t (*)(PP_Resource request_info, const char* target, PP_Bool from_user_action))&Pnacl_M21_PPB_Flash_Navigate,
     .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M21_PPB_Flash_RunMessageLoop,
@@ -3983,7 +4380,7 @@
 
 struct PPB_Flash_12_5 Pnacl_Wrappers_PPB_Flash_12_5 = {
     .SetInstanceAlwaysOnTop = (void (*)(PP_Instance instance, PP_Bool on_top))&Pnacl_M22_PPB_Flash_SetInstanceAlwaysOnTop,
-    .DrawGlyphs = (PP_Bool (*)(PP_Instance instance, PP_Resource pp_image_data, const struct PP_FontDescription_Dev* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]))&Pnacl_M22_PPB_Flash_DrawGlyphs,
+    .DrawGlyphs = (PP_Bool (*)(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]))&Pnacl_M22_PPB_Flash_DrawGlyphs,
     .GetProxyForURL = (struct PP_Var (*)(PP_Instance instance, const char* url))&Pnacl_M22_PPB_Flash_GetProxyForURL,
     .Navigate = (int32_t (*)(PP_Resource request_info, const char* target, PP_Bool from_user_action))&Pnacl_M22_PPB_Flash_Navigate,
     .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M22_PPB_Flash_RunMessageLoop,
@@ -4001,23 +4398,38 @@
 };
 
 struct PPB_Flash_12_6 Pnacl_Wrappers_PPB_Flash_12_6 = {
-    .SetInstanceAlwaysOnTop = (void (*)(PP_Instance instance, PP_Bool on_top))&Pnacl_M24_PPB_Flash_SetInstanceAlwaysOnTop,
-    .DrawGlyphs = (PP_Bool (*)(PP_Instance instance, PP_Resource pp_image_data, const struct PP_FontDescription_Dev* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]))&Pnacl_M24_PPB_Flash_DrawGlyphs,
-    .GetProxyForURL = (struct PP_Var (*)(PP_Instance instance, const char* url))&Pnacl_M24_PPB_Flash_GetProxyForURL,
-    .Navigate = (int32_t (*)(PP_Resource request_info, const char* target, PP_Bool from_user_action))&Pnacl_M24_PPB_Flash_Navigate,
-    .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M24_PPB_Flash_RunMessageLoop,
-    .QuitMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M24_PPB_Flash_QuitMessageLoop,
-    .GetLocalTimeZoneOffset = (double (*)(PP_Instance instance, PP_Time t))&Pnacl_M24_PPB_Flash_GetLocalTimeZoneOffset,
-    .GetCommandLineArgs = (struct PP_Var (*)(PP_Module module))&Pnacl_M24_PPB_Flash_GetCommandLineArgs,
-    .PreloadFontWin = (void (*)(const void* logfontw))&Pnacl_M24_PPB_Flash_PreloadFontWin,
-    .IsRectTopmost = (PP_Bool (*)(PP_Instance instance, const struct PP_Rect* rect))&Pnacl_M24_PPB_Flash_IsRectTopmost,
-    .InvokePrinting = (int32_t (*)(PP_Instance instance))&Pnacl_M24_PPB_Flash_InvokePrinting,
-    .UpdateActivity = (void (*)(PP_Instance instance))&Pnacl_M24_PPB_Flash_UpdateActivity,
-    .GetDeviceID = (struct PP_Var (*)(PP_Instance instance))&Pnacl_M24_PPB_Flash_GetDeviceID,
-    .GetSettingInt = (int32_t (*)(PP_Instance instance, PP_FlashSetting setting))&Pnacl_M24_PPB_Flash_GetSettingInt,
-    .GetSetting = (struct PP_Var (*)(PP_Instance instance, PP_FlashSetting setting))&Pnacl_M24_PPB_Flash_GetSetting,
-    .SetCrashData = (PP_Bool (*)(PP_Instance instance, PP_FlashCrashKey key, struct PP_Var value))&Pnacl_M24_PPB_Flash_SetCrashData,
-    .EnumerateVideoCaptureDevices = (int32_t (*)(PP_Instance instance, PP_Resource video_capture, struct PP_ArrayOutput devices))&Pnacl_M24_PPB_Flash_EnumerateVideoCaptureDevices
+    .SetInstanceAlwaysOnTop = (void (*)(PP_Instance instance, PP_Bool on_top))&Pnacl_M24_0_PPB_Flash_SetInstanceAlwaysOnTop,
+    .DrawGlyphs = (PP_Bool (*)(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]))&Pnacl_M24_0_PPB_Flash_DrawGlyphs,
+    .GetProxyForURL = (struct PP_Var (*)(PP_Instance instance, const char* url))&Pnacl_M24_0_PPB_Flash_GetProxyForURL,
+    .Navigate = (int32_t (*)(PP_Resource request_info, const char* target, PP_Bool from_user_action))&Pnacl_M24_0_PPB_Flash_Navigate,
+    .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M24_0_PPB_Flash_RunMessageLoop,
+    .QuitMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M24_0_PPB_Flash_QuitMessageLoop,
+    .GetLocalTimeZoneOffset = (double (*)(PP_Instance instance, PP_Time t))&Pnacl_M24_0_PPB_Flash_GetLocalTimeZoneOffset,
+    .GetCommandLineArgs = (struct PP_Var (*)(PP_Module module))&Pnacl_M24_0_PPB_Flash_GetCommandLineArgs,
+    .PreloadFontWin = (void (*)(const void* logfontw))&Pnacl_M24_0_PPB_Flash_PreloadFontWin,
+    .IsRectTopmost = (PP_Bool (*)(PP_Instance instance, const struct PP_Rect* rect))&Pnacl_M24_0_PPB_Flash_IsRectTopmost,
+    .InvokePrinting = (int32_t (*)(PP_Instance instance))&Pnacl_M24_0_PPB_Flash_InvokePrinting,
+    .UpdateActivity = (void (*)(PP_Instance instance))&Pnacl_M24_0_PPB_Flash_UpdateActivity,
+    .GetDeviceID = (struct PP_Var (*)(PP_Instance instance))&Pnacl_M24_0_PPB_Flash_GetDeviceID,
+    .GetSettingInt = (int32_t (*)(PP_Instance instance, PP_FlashSetting setting))&Pnacl_M24_0_PPB_Flash_GetSettingInt,
+    .GetSetting = (struct PP_Var (*)(PP_Instance instance, PP_FlashSetting setting))&Pnacl_M24_0_PPB_Flash_GetSetting,
+    .SetCrashData = (PP_Bool (*)(PP_Instance instance, PP_FlashCrashKey key, struct PP_Var value))&Pnacl_M24_0_PPB_Flash_SetCrashData,
+    .EnumerateVideoCaptureDevices = (int32_t (*)(PP_Instance instance, PP_Resource video_capture, struct PP_ArrayOutput devices))&Pnacl_M24_0_PPB_Flash_EnumerateVideoCaptureDevices
+};
+
+struct PPB_Flash_13_0 Pnacl_Wrappers_PPB_Flash_13_0 = {
+    .SetInstanceAlwaysOnTop = (void (*)(PP_Instance instance, PP_Bool on_top))&Pnacl_M24_1_PPB_Flash_SetInstanceAlwaysOnTop,
+    .DrawGlyphs = (PP_Bool (*)(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]))&Pnacl_M24_1_PPB_Flash_DrawGlyphs,
+    .GetProxyForURL = (struct PP_Var (*)(PP_Instance instance, const char* url))&Pnacl_M24_1_PPB_Flash_GetProxyForURL,
+    .Navigate = (int32_t (*)(PP_Resource request_info, const char* target, PP_Bool from_user_action))&Pnacl_M24_1_PPB_Flash_Navigate,
+    .GetLocalTimeZoneOffset = (double (*)(PP_Instance instance, PP_Time t))&Pnacl_M24_1_PPB_Flash_GetLocalTimeZoneOffset,
+    .GetCommandLineArgs = (struct PP_Var (*)(PP_Module module))&Pnacl_M24_1_PPB_Flash_GetCommandLineArgs,
+    .PreloadFontWin = (void (*)(const void* logfontw))&Pnacl_M24_1_PPB_Flash_PreloadFontWin,
+    .IsRectTopmost = (PP_Bool (*)(PP_Instance instance, const struct PP_Rect* rect))&Pnacl_M24_1_PPB_Flash_IsRectTopmost,
+    .UpdateActivity = (void (*)(PP_Instance instance))&Pnacl_M24_1_PPB_Flash_UpdateActivity,
+    .GetSetting = (struct PP_Var (*)(PP_Instance instance, PP_FlashSetting setting))&Pnacl_M24_1_PPB_Flash_GetSetting,
+    .SetCrashData = (PP_Bool (*)(PP_Instance instance, PP_FlashCrashKey key, struct PP_Var value))&Pnacl_M24_1_PPB_Flash_SetCrashData,
+    .EnumerateVideoCaptureDevices = (int32_t (*)(PP_Instance instance, PP_Resource video_capture, struct PP_ArrayOutput devices))&Pnacl_M24_1_PPB_Flash_EnumerateVideoCaptureDevices
 };
 
 struct PPB_Flash_Clipboard_4_0 Pnacl_Wrappers_PPB_Flash_Clipboard_4_0 = {
@@ -4044,6 +4456,12 @@
 
 /* Not generating wrapper interface for PPB_FlashFullscreen_1_0 */
 
+struct PPB_Flash_Menu_0_2 Pnacl_Wrappers_PPB_Flash_Menu_0_2 = {
+    .Create = (PP_Resource (*)(PP_Instance instance_id, const struct PP_Flash_Menu* menu_data))&Pnacl_M14_PPB_Flash_Menu_Create,
+    .IsFlashMenu = (PP_Bool (*)(PP_Resource resource_id))&Pnacl_M14_PPB_Flash_Menu_IsFlashMenu,
+    .Show = (int32_t (*)(PP_Resource menu_id, const struct PP_Point* location, int32_t* selected_id, struct PP_CompletionCallback callback))&Pnacl_M14_PPB_Flash_Menu_Show
+};
+
 /* Not generating wrapper interface for PPB_Flash_MessageLoop_0_1 */
 
 /* Not generating wrapper interface for PPB_Flash_Print_1_0 */
@@ -4065,6 +4483,8 @@
     .ExecuteScript = (struct PP_Var (*)(PP_Instance instance, struct PP_Var script, struct PP_Var* exception))&Pnacl_M13_PPB_Instance_Private_ExecuteScript
 };
 
+/* Not generating wrapper interface for PPB_NaCl_Private_1_0 */
+
 struct PPB_NetAddress_Private_0_1 Pnacl_Wrappers_PPB_NetAddress_Private_0_1 = {
     .AreEqual = (PP_Bool (*)(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2))&Pnacl_M17_PPB_NetAddress_Private_AreEqual,
     .AreHostsEqual = (PP_Bool (*)(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2))&Pnacl_M17_PPB_NetAddress_Private_AreHostsEqual,
@@ -4152,6 +4572,22 @@
     .Disconnect = (void (*)(PP_Resource tcp_socket))&Pnacl_M20_PPB_TCPSocket_Private_Disconnect
 };
 
+struct PPB_TCPSocket_Private_0_5 Pnacl_Wrappers_PPB_TCPSocket_Private_0_5 = {
+    .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M27_PPB_TCPSocket_Private_Create,
+    .IsTCPSocket = (PP_Bool (*)(PP_Resource resource))&Pnacl_M27_PPB_TCPSocket_Private_IsTCPSocket,
+    .Connect = (int32_t (*)(PP_Resource tcp_socket, const char* host, uint16_t port, struct PP_CompletionCallback callback))&Pnacl_M27_PPB_TCPSocket_Private_Connect,
+    .ConnectWithNetAddress = (int32_t (*)(PP_Resource tcp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback))&Pnacl_M27_PPB_TCPSocket_Private_ConnectWithNetAddress,
+    .GetLocalAddress = (PP_Bool (*)(PP_Resource tcp_socket, struct PP_NetAddress_Private* local_addr))&Pnacl_M27_PPB_TCPSocket_Private_GetLocalAddress,
+    .GetRemoteAddress = (PP_Bool (*)(PP_Resource tcp_socket, struct PP_NetAddress_Private* remote_addr))&Pnacl_M27_PPB_TCPSocket_Private_GetRemoteAddress,
+    .SSLHandshake = (int32_t (*)(PP_Resource tcp_socket, const char* server_name, uint16_t server_port, struct PP_CompletionCallback callback))&Pnacl_M27_PPB_TCPSocket_Private_SSLHandshake,
+    .GetServerCertificate = (PP_Resource (*)(PP_Resource tcp_socket))&Pnacl_M27_PPB_TCPSocket_Private_GetServerCertificate,
+    .AddChainBuildingCertificate = (PP_Bool (*)(PP_Resource tcp_socket, PP_Resource certificate, PP_Bool is_trusted))&Pnacl_M27_PPB_TCPSocket_Private_AddChainBuildingCertificate,
+    .Read = (int32_t (*)(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback))&Pnacl_M27_PPB_TCPSocket_Private_Read,
+    .Write = (int32_t (*)(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback))&Pnacl_M27_PPB_TCPSocket_Private_Write,
+    .Disconnect = (void (*)(PP_Resource tcp_socket))&Pnacl_M27_PPB_TCPSocket_Private_Disconnect,
+    .SetOption = (int32_t (*)(PP_Resource tcp_socket, PP_TCPSocketOption_Private name, struct PP_Var value, struct PP_CompletionCallback callback))&Pnacl_M27_PPB_TCPSocket_Private_SetOption
+};
+
 struct PPB_UDPSocket_Private_0_2 Pnacl_Wrappers_PPB_UDPSocket_Private_0_2 = {
     .Create = (PP_Resource (*)(PP_Instance instance_id))&Pnacl_M17_PPB_UDPSocket_Private_Create,
     .IsUDPSocket = (PP_Bool (*)(PP_Resource resource_id))&Pnacl_M17_PPB_UDPSocket_Private_IsUDPSocket,
@@ -4220,6 +4656,19 @@
     .GetInstanceObject = (struct PP_Var (*)(PP_Instance instance))&Pnacl_M18_PPP_Instance_Private_GetInstanceObject
 };
 
+struct PPB_Ext_Alarms_Dev_0_1 Pnacl_Wrappers_PPB_Ext_Alarms_Dev_0_1 = {
+    .Create = (void (*)(PP_Instance instance, struct PP_Var name, PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info))&Pnacl_M27_PPB_Ext_Alarms_Dev_Create,
+    .Get = (int32_t (*)(PP_Instance instance, struct PP_Var name, PP_Ext_Alarms_Alarm_Dev* alarm, struct PP_CompletionCallback callback))&Pnacl_M27_PPB_Ext_Alarms_Dev_Get,
+    .GetAll = (int32_t (*)(PP_Instance instance, PP_Ext_Alarms_Alarm_Dev_Array* alarms, struct PP_CompletionCallback callback))&Pnacl_M27_PPB_Ext_Alarms_Dev_GetAll,
+    .Clear = (void (*)(PP_Instance instance, struct PP_Var name))&Pnacl_M27_PPB_Ext_Alarms_Dev_Clear,
+    .ClearAll = (void (*)(PP_Instance instance))&Pnacl_M27_PPB_Ext_Alarms_Dev_ClearAll
+};
+
+struct PPB_Ext_Events_Dev_0_1 Pnacl_Wrappers_PPB_Ext_Events_Dev_0_1 = {
+    .AddListener = (uint32_t (*)(PP_Instance instance, struct PP_Ext_EventListener listener))&Pnacl_M27_PPB_Ext_Events_Dev_AddListener,
+    .RemoveListener = (void (*)(PP_Instance instance, uint32_t listener_id))&Pnacl_M27_PPB_Ext_Events_Dev_RemoveListener
+};
+
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Audio_1_0 = {
   .iface_macro = PPB_AUDIO_INTERFACE_1_0,
   .wrapped_iface = NULL /* Still need slot for real_iface */,
@@ -4238,6 +4687,12 @@
   .real_iface = NULL
 };
 
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Console_1_0 = {
+  .iface_macro = PPB_CONSOLE_INTERFACE_1_0,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Console_1_0,
+  .real_iface = NULL
+};
+
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Core_1_0 = {
   .iface_macro = PPB_CORE_INTERFACE_1_0,
   .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Core_1_0,
@@ -4250,6 +4705,12 @@
   .real_iface = NULL
 };
 
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_1_1 = {
+  .iface_macro = PPB_FILEIO_INTERFACE_1_1,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileIO_1_1,
+  .real_iface = NULL
+};
+
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRef_1_0 = {
   .iface_macro = PPB_FILEREF_INTERFACE_1_0,
   .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileRef_1_0,
@@ -4328,18 +4789,18 @@
   .real_iface = NULL
 };
 
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Instance_0_5 = {
-  .iface_macro = PPB_INSTANCE_INTERFACE_0_5,
-  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Instance_0_5,
-  .real_iface = NULL
-};
-
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Instance_1_0 = {
   .iface_macro = PPB_INSTANCE_INTERFACE_1_0,
   .wrapped_iface = NULL /* Still need slot for real_iface */,
   .real_iface = NULL
 };
 
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MessageLoop_1_0 = {
+  .iface_macro = PPB_MESSAGELOOP_INTERFACE_1_0,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_MessageLoop_1_0,
+  .real_iface = NULL
+};
+
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Messaging_1_0 = {
   .iface_macro = PPB_MESSAGING_INTERFACE_1_0,
   .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Messaging_1_0,
@@ -4454,6 +4915,12 @@
   .real_iface = NULL
 };
 
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3 = {
+  .iface_macro = PPB_BROKER_TRUSTED_INTERFACE_0_3,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_BrokerTrusted_0_3,
+  .real_iface = NULL
+};
+
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_BrowserFont_Trusted_1_0 = {
   .iface_macro = PPB_BROWSERFONT_TRUSTED_INTERFACE_1_0,
   .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_BrowserFont_Trusted_1_0,
@@ -4490,6 +4957,12 @@
   .real_iface = NULL
 };
 
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0 = {
+  .iface_macro = PPB_GRAPHICS_3D_TRUSTED_INTERFACE_1_0,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Graphics3DTrusted_1_0,
+  .real_iface = NULL
+};
+
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ImageDataTrusted_0_4 = {
   .iface_macro = PPB_IMAGEDATA_TRUSTED_INTERFACE_0_4,
   .wrapped_iface = NULL /* Still need slot for real_iface */,
@@ -4508,15 +4981,15 @@
   .real_iface = NULL
 };
 
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Buffer_Dev_0_4 = {
-  .iface_macro = PPB_BUFFER_DEV_INTERFACE_0_4,
-  .wrapped_iface = NULL /* Still need slot for real_iface */,
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3 = {
+  .iface_macro = PPB_AUDIO_INPUT_DEV_INTERFACE_0_3,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_AudioInput_Dev_0_3,
   .real_iface = NULL
 };
 
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Console_Dev_0_1 = {
-  .iface_macro = PPB_CONSOLE_DEV_INTERFACE_0_1,
-  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Console_Dev_0_1,
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Buffer_Dev_0_4 = {
+  .iface_macro = PPB_BUFFER_DEV_INTERFACE_0_4,
+  .wrapped_iface = NULL /* Still need slot for real_iface */,
   .real_iface = NULL
 };
 
@@ -4538,6 +5011,12 @@
   .real_iface = NULL
 };
 
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_DirectoryReader_Dev_0_6 = {
+  .iface_macro = PPB_DIRECTORYREADER_DEV_INTERFACE_0_6,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_DirectoryReader_Dev_0_6,
+  .real_iface = NULL
+};
+
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_5 = {
   .iface_macro = PPB_FILECHOOSER_DEV_INTERFACE_0_5,
   .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileChooser_Dev_0_5,
@@ -4592,12 +5071,6 @@
   .real_iface = NULL
 };
 
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MessageLoop_Dev_0_1 = {
-  .iface_macro = PPB_MESSAGELOOP_DEV_INTERFACE_0_1,
-  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_MessageLoop_Dev_0_1,
-  .real_iface = NULL
-};
-
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Printing_Dev_0_6 = {
   .iface_macro = PPB_PRINTING_DEV_INTERFACE_0_6,
   .wrapped_iface = NULL /* Still need slot for real_iface */,
@@ -4658,15 +5131,33 @@
   .real_iface = NULL
 };
 
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Trace_Event_Dev_0_1 = {
+  .iface_macro = PPB_TRACE_EVENT_DEV_INTERFACE_0_1,
+  .wrapped_iface = NULL /* Still need slot for real_iface */,
+  .real_iface = NULL
+};
+
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1 = {
+  .iface_macro = PPB_TRUETYPEFONT_DEV_INTERFACE_0_1,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_TrueTypeFont_Dev_0_1,
+  .real_iface = NULL
+};
+
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6 = {
   .iface_macro = PPB_URLUTIL_DEV_INTERFACE_0_6,
   .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_URLUtil_Dev_0_6,
   .real_iface = NULL
 };
 
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_1 = {
-  .iface_macro = PPB_VIDEOCAPTURE_DEV_INTERFACE_0_1,
-  .wrapped_iface = NULL /* Still need slot for real_iface */,
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1 = {
+  .iface_macro = PPB_VAR_ARRAY_DEV_INTERFACE_0_1,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VarArray_Dev_0_1,
+  .real_iface = NULL
+};
+
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1 = {
+  .iface_macro = PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VarDictionary_Dev_0_1,
   .real_iface = NULL
 };
 
@@ -4676,6 +5167,12 @@
   .real_iface = NULL
 };
 
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3 = {
+  .iface_macro = PPB_VIDEOCAPTURE_DEV_INTERFACE_0_3,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VideoCapture_Dev_0_3,
+  .real_iface = NULL
+};
+
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16 = {
   .iface_macro = PPB_VIDEODECODER_DEV_INTERFACE_0_16,
   .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VideoDecoder_Dev_0_16,
@@ -4718,6 +5215,24 @@
   .real_iface = NULL
 };
 
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Scrollbar_Dev_0_2 = {
+  .iface_macro = PPP_SCROLLBAR_DEV_INTERFACE_0_2,
+  .wrapped_iface = NULL /* Still need slot for real_iface */,
+  .real_iface = NULL
+};
+
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Scrollbar_Dev_0_3 = {
+  .iface_macro = PPP_SCROLLBAR_DEV_INTERFACE_0_3,
+  .wrapped_iface = NULL /* Still need slot for real_iface */,
+  .real_iface = NULL
+};
+
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Selection_Dev_0_3 = {
+  .iface_macro = PPP_SELECTION_DEV_INTERFACE_0_3,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPP_Selection_Dev_0_3,
+  .real_iface = NULL
+};
+
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_TextInput_Dev_0_1 = {
   .iface_macro = PPP_TEXTINPUT_DEV_INTERFACE_0_1,
   .wrapped_iface = NULL /* Still need slot for real_iface */,
@@ -4772,30 +5287,6 @@
   .real_iface = NULL
 };
 
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_0 = {
-  .iface_macro = PPB_FLASH_INTERFACE_12_0,
-  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Flash_12_0,
-  .real_iface = NULL
-};
-
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_1 = {
-  .iface_macro = PPB_FLASH_INTERFACE_12_1,
-  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Flash_12_1,
-  .real_iface = NULL
-};
-
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_2 = {
-  .iface_macro = PPB_FLASH_INTERFACE_12_2,
-  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Flash_12_2,
-  .real_iface = NULL
-};
-
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_3 = {
-  .iface_macro = PPB_FLASH_INTERFACE_12_3,
-  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Flash_12_3,
-  .real_iface = NULL
-};
-
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_4 = {
   .iface_macro = PPB_FLASH_INTERFACE_12_4,
   .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Flash_12_4,
@@ -4814,6 +5305,12 @@
   .real_iface = NULL
 };
 
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_13_0 = {
+  .iface_macro = PPB_FLASH_INTERFACE_13_0,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Flash_13_0,
+  .real_iface = NULL
+};
+
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Clipboard_4_0 = {
   .iface_macro = PPB_FLASH_CLIPBOARD_INTERFACE_4_0,
   .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Flash_Clipboard_4_0,
@@ -4850,6 +5347,12 @@
   .real_iface = NULL
 };
 
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Menu_0_2 = {
+  .iface_macro = PPB_FLASH_MENU_INTERFACE_0_2,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Flash_Menu_0_2,
+  .real_iface = NULL
+};
+
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_MessageLoop_0_1 = {
   .iface_macro = PPB_FLASH_MESSAGELOOP_INTERFACE_0_1,
   .wrapped_iface = NULL /* Still need slot for real_iface */,
@@ -4880,6 +5383,12 @@
   .real_iface = NULL
 };
 
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NaCl_Private_1_0 = {
+  .iface_macro = PPB_NACL_PRIVATE_INTERFACE_1_0,
+  .wrapped_iface = NULL /* Still need slot for real_iface */,
+  .real_iface = NULL
+};
+
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Private_0_1 = {
   .iface_macro = PPB_NETADDRESS_PRIVATE_INTERFACE_0_1,
   .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_NetAddress_Private_0_1,
@@ -4934,6 +5443,12 @@
   .real_iface = NULL
 };
 
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5 = {
+  .iface_macro = PPB_TCPSOCKET_PRIVATE_INTERFACE_0_5,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_TCPSocket_Private_0_5,
+  .real_iface = NULL
+};
+
 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2 = {
   .iface_macro = PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2,
   .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_UDPSocket_Private_0_2,
@@ -4994,12 +5509,26 @@
   .real_iface = NULL
 };
 
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1 = {
+  .iface_macro = PPB_EXT_ALARMS_DEV_INTERFACE_0_1,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Ext_Alarms_Dev_0_1,
+  .real_iface = NULL
+};
+
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_Events_Dev_0_1 = {
+  .iface_macro = PPB_EXT_EVENTS_DEV_INTERFACE_0_1,
+  .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Ext_Events_Dev_0_1,
+  .real_iface = NULL
+};
+
 static struct __PnaclWrapperInfo *s_ppb_wrappers[] = {
   &Pnacl_WrapperInfo_PPB_Audio_1_0,
   &Pnacl_WrapperInfo_PPB_AudioConfig_1_0,
   &Pnacl_WrapperInfo_PPB_AudioConfig_1_1,
+  &Pnacl_WrapperInfo_PPB_Console_1_0,
   &Pnacl_WrapperInfo_PPB_Core_1_0,
   &Pnacl_WrapperInfo_PPB_FileIO_1_0,
+  &Pnacl_WrapperInfo_PPB_FileIO_1_1,
   &Pnacl_WrapperInfo_PPB_FileRef_1_0,
   &Pnacl_WrapperInfo_PPB_FileSystem_1_0,
   &Pnacl_WrapperInfo_PPB_Fullscreen_1_0,
@@ -5013,8 +5542,8 @@
   &Pnacl_WrapperInfo_PPB_WheelInputEvent_1_0,
   &Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_0,
   &Pnacl_WrapperInfo_PPB_TouchInputEvent_1_0,
-  &Pnacl_WrapperInfo_PPB_Instance_0_5,
   &Pnacl_WrapperInfo_PPB_Instance_1_0,
+  &Pnacl_WrapperInfo_PPB_MessageLoop_1_0,
   &Pnacl_WrapperInfo_PPB_Messaging_1_0,
   &Pnacl_WrapperInfo_PPB_MouseCursor_1_0,
   &Pnacl_WrapperInfo_PPB_MouseLock_1_0,
@@ -5028,20 +5557,23 @@
   &Pnacl_WrapperInfo_PPB_WebSocket_1_0,
   &Pnacl_WrapperInfo_PPB_AudioTrusted_0_6,
   &Pnacl_WrapperInfo_PPB_BrokerTrusted_0_2,
+  &Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3,
   &Pnacl_WrapperInfo_PPB_BrowserFont_Trusted_1_0,
   &Pnacl_WrapperInfo_PPB_BufferTrusted_0_1,
   &Pnacl_WrapperInfo_PPB_CharSet_Trusted_1_0,
   &Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_5,
   &Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_6,
   &Pnacl_WrapperInfo_PPB_FileIOTrusted_0_4,
+  &Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0,
   &Pnacl_WrapperInfo_PPB_ImageDataTrusted_0_4,
   &Pnacl_WrapperInfo_PPB_URLLoaderTrusted_0_3,
   &Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2,
+  &Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3,
   &Pnacl_WrapperInfo_PPB_Buffer_Dev_0_4,
-  &Pnacl_WrapperInfo_PPB_Console_Dev_0_1,
   &Pnacl_WrapperInfo_PPB_Crypto_Dev_0_1,
   &Pnacl_WrapperInfo_PPB_CursorControl_Dev_0_4,
   &Pnacl_WrapperInfo_PPB_DeviceRef_Dev_0_1,
+  &Pnacl_WrapperInfo_PPB_DirectoryReader_Dev_0_6,
   &Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_5,
   &Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_6,
   &Pnacl_WrapperInfo_PPB_Find_Dev_0_3,
@@ -5051,7 +5583,6 @@
   &Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2,
   &Pnacl_WrapperInfo_PPB_KeyboardInputEvent_Dev_0_1,
   &Pnacl_WrapperInfo_PPB_Memory_Dev_0_1,
-  &Pnacl_WrapperInfo_PPB_MessageLoop_Dev_0_1,
   &Pnacl_WrapperInfo_PPB_Printing_Dev_0_6,
   &Pnacl_WrapperInfo_PPB_Printing_Dev_0_7,
   &Pnacl_WrapperInfo_PPB_ResourceArray_Dev_0_1,
@@ -5062,9 +5593,13 @@
   &Pnacl_WrapperInfo_PPB_Testing_Dev_0_91,
   &Pnacl_WrapperInfo_PPB_TextInput_Dev_0_1,
   &Pnacl_WrapperInfo_PPB_TextInput_Dev_0_2,
+  &Pnacl_WrapperInfo_PPB_Trace_Event_Dev_0_1,
+  &Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1,
   &Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6,
-  &Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_1,
+  &Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1,
+  &Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1,
   &Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2,
+  &Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3,
   &Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16,
   &Pnacl_WrapperInfo_PPB_View_Dev_0_1,
   &Pnacl_WrapperInfo_PPB_Widget_Dev_0_3,
@@ -5072,24 +5607,23 @@
   &Pnacl_WrapperInfo_PPB_Zoom_Dev_0_2,
   &Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6,
   &Pnacl_WrapperInfo_PPB_FileRefPrivate_0_1,
-  &Pnacl_WrapperInfo_PPB_Flash_12_0,
-  &Pnacl_WrapperInfo_PPB_Flash_12_1,
-  &Pnacl_WrapperInfo_PPB_Flash_12_2,
-  &Pnacl_WrapperInfo_PPB_Flash_12_3,
   &Pnacl_WrapperInfo_PPB_Flash_12_4,
   &Pnacl_WrapperInfo_PPB_Flash_12_5,
   &Pnacl_WrapperInfo_PPB_Flash_12_6,
+  &Pnacl_WrapperInfo_PPB_Flash_13_0,
   &Pnacl_WrapperInfo_PPB_Flash_Clipboard_4_0,
   &Pnacl_WrapperInfo_PPB_Flash_Clipboard_5_0,
   &Pnacl_WrapperInfo_PPB_Flash_DeviceID_1_0,
   &Pnacl_WrapperInfo_PPB_Flash_FontFile_0_1,
   &Pnacl_WrapperInfo_PPB_FlashFullscreen_0_1,
   &Pnacl_WrapperInfo_PPB_FlashFullscreen_1_0,
+  &Pnacl_WrapperInfo_PPB_Flash_Menu_0_2,
   &Pnacl_WrapperInfo_PPB_Flash_MessageLoop_0_1,
   &Pnacl_WrapperInfo_PPB_Flash_Print_1_0,
   &Pnacl_WrapperInfo_PPB_GpuBlacklist_Private_0_2,
   &Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1,
   &Pnacl_WrapperInfo_PPB_Instance_Private_0_1,
+  &Pnacl_WrapperInfo_PPB_NaCl_Private_1_0,
   &Pnacl_WrapperInfo_PPB_NetAddress_Private_0_1,
   &Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0,
   &Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1,
@@ -5099,11 +5633,14 @@
   &Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0_1,
   &Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3,
   &Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4,
+  &Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5,
   &Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2,
   &Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3,
   &Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4,
   &Pnacl_WrapperInfo_PPB_UMA_Private_0_1,
   &Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1,
+  &Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1,
+  &Pnacl_WrapperInfo_PPB_Ext_Events_Dev_0_1,
   NULL
 };
 
@@ -5116,6 +5653,9 @@
   &Pnacl_WrapperInfo_PPP_MouseLock_1_0,
   &Pnacl_WrapperInfo_PPP_NetworkState_Dev_0_1,
   &Pnacl_WrapperInfo_PPP_Printing_Dev_0_6,
+  &Pnacl_WrapperInfo_PPP_Scrollbar_Dev_0_2,
+  &Pnacl_WrapperInfo_PPP_Scrollbar_Dev_0_3,
+  &Pnacl_WrapperInfo_PPP_Selection_Dev_0_3,
   &Pnacl_WrapperInfo_PPP_TextInput_Dev_0_1,
   &Pnacl_WrapperInfo_PPP_VideoCapture_Dev_0_1,
   &Pnacl_WrapperInfo_PPP_VideoDecoder_Dev_0_9,
diff --git a/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_component_crx_gen.py b/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_component_crx_gen.py
index b0f0838..30409a8 100755
--- a/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_component_crx_gen.py
+++ b/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_component_crx_gen.py
@@ -3,18 +3,19 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-"""
-   This script packages the PNaCl translator files as a Chrome Extension (crx),
-   which can be used as a straight-forward CRX, or used with the Chrome
-   incremental installer (component updater).
+"""This script packages the PNaCl translator files as:
+   (1) a Chrome Extension (crx), which can be used as a straight-forward CRX,
+   or used with the Chrome incremental installer (component updater)
+   (2) a Chrome Extension as a zip for uploading to the CWS.
+   (3) layout files for a normal Chrome installer.
 
    This script depends on and pulls in the translator nexes and libraries
-   from the toolchain directory (so that must be downloaded first), fills
-   in the CRX manifest files, and zips and signs the CRXes using
-   chrome (which must also be downloaded first), etc.
+   from the toolchain directory (so that must be downloaded first) and
+   it depends on the pnacl_irt_shim.
 """
 
 import glob
+import logging
 import optparse
 import os
 import platform
@@ -39,16 +40,20 @@
 # This is based on the machine "building" this extension.
 # We also used this to identify the arch-specific different versions of
 # this extension.
-def GetBuildArch():
-  arch = platform.machine()
-  if arch in ('x86_64', 'amd64'):
+
+def CanonicalArch(arch):
+  if arch in ('x86_64', 'x86-64', 'x64', 'amd64'):
     return 'x86-64'
   # TODO(jvoung): be more specific about the arm architecture version?
-  if arch.startswith('armv7'):
+  if arch in ('arm', 'armv7'):
     return 'arm'
-  x86_32_re = re.compile('^i.86$')
-  if x86_32_re.search(arch) or arch == 'x86_32' or arch == 'x86':
+  if re.match('^i.86$', arch) or arch in ('x86_32', 'x86-32', 'ia32', 'x86'):
     return 'x86-32'
+  return None
+
+def GetBuildArch():
+  arch = platform.machine()
+  return CanonicalArch(arch)
 
 BUILD_ARCH = GetBuildArch()
 ARCHES = ['x86-32', 'x86-64', 'arm']
@@ -108,6 +113,22 @@
   return platform
 BUILD_PLATFORM = GetBuildPlatform()
 
+
+def DetermineInstallerArches(target_arch):
+  arch = CanonicalArch(target_arch)
+  if not IsValidArch(arch):
+    raise Exception('Unknown target_arch %s' % target_arch)
+  # On windows, we need x86-32 and x86-64 (assuming non-windows RT).
+  if BUILD_PLATFORM == 'windows':
+    if arch.startswith('x86'):
+      return ['x86-32', 'x86-64']
+    else:
+      raise Exception('Unknown target_arch on windows w/ target_arch == %s' %
+                      target_arch)
+  else:
+    return [arch]
+
+
 class CRXGen(object):
   """ Generate a CRX file. Can generate a fresh CRX and private key, or
   create a version of new CRX with the same AppID, using an existing
@@ -187,8 +208,11 @@
                                              web_accessible,
                                              all_host_permissions,
                                              manifest_key)
+    # For now, make the ABI version the same as pnacl-version...
+    # It should probably be separate though.
     PnaclPackaging.GeneratePnaclInfo(target_dir, version, arch)
 
+
   @staticmethod
   def GenerateExtensionManifest(target_dir, version,
                                 web_accessible, all_host_permissions,
@@ -210,12 +234,21 @@
     output_fd.close()
 
   @staticmethod
-  def GeneratePnaclInfo(target_dir, version, arch):
+  def GeneratePnaclInfo(target_dir, version, arch, is_installer=False):
     pnacl_template_fd = open(PnaclPackaging.pnacl_template, 'r')
     pnacl_template = pnacl_template_fd.read()
     pnacl_template_fd.close()
-    output_fd = open(J(target_dir, PnaclPackaging.pnacl_json), 'w')
-    # For now, make the ABI version the same as pnacl-version.
+    if is_installer:
+      out_name = J(target_dir, UseWhitelistedChars(PnaclPackaging.pnacl_json,
+                                                   None))
+    else:
+      out_name = J(target_dir, PnaclPackaging.pnacl_json)
+    output_fd = open(out_name, 'w')
+    if isinstance(arch, list):
+      # FIXME: Handle a list of arches, not just a wildcard "all".
+      # Alternatively, perhaps we shouldn't bother checking what arch is
+      # installed and assume the installer does the right thing.
+      arch = 'all'
     output_fd.write(pnacl_template % { "abi-version" : version,
                                        "arch" : arch, })
     output_fd.close()
@@ -268,7 +301,7 @@
 ######################################################################
 
 def StepBanner(short_desc, long_desc):
-  print "**** %s\t%s" % (short_desc, long_desc)
+  logging.info("**** %s\t%s", short_desc, long_desc)
 
 
 def Clean():
@@ -277,7 +310,9 @@
   if os.path.isdir(out_dir):
     shutil.rmtree(out_dir)
   else:
-    print 'Clean skipped -- no previous output directory!'
+    logging.info('Clean skipped -- no previous output directory!')
+
+######################################################################
 
 
 def ZipDirectory(base_dir, zipfile):
@@ -329,11 +364,12 @@
   shutil.copy2(J(tempdir, 'dummy_extension.pem'),
                PnaclDirs.OutputDir())
   shutil.rmtree(tempdir)
-  print ('\n<<< Fresh key is now in %s/dummy_extension.pem >>>\n' %
-         PnaclDirs.OutputDir())
+  logging.info('\n<<< Fresh key is now in %s/dummy_extension.pem >>>\n' %
+               PnaclDirs.OutputDir())
 
 
-def BuildArchCRXForComponentUpdater(version_quad, arch, lib_overrides, options):
+def BuildArchCRXForComponentUpdater(version_quad, arch, lib_overrides,
+                                    options):
   """ Build an architecture specific version for the chrome component
   install (an actual CRX, vs a zip file).  Though this is a CRX,
   it is not used as a chrome extension as the CWS and unpacked version.
@@ -355,16 +391,9 @@
   # Also copy files from the list of overrides.
   if arch in lib_overrides:
     for override in lib_overrides[arch]:
-      print 'Copying override %s to %s' % (override, target_dir)
+      logging.info('Copying override %s to %s' % (override, target_dir))
       shutil.copy2(override, target_dir)
 
-  # Filter out native libraries related to glibc.
-  patterns = ['*nonshared.a', '*.so', '*.so.*']
-  for pat in patterns:
-    for f in glob.glob(J(target_dir, pat)):
-      print 'Filtering out glibc file: %s' % f
-      os.remove(f)
-
   # Skip the CRX generation if we are only building the unpacked version
   # for commandline testing.
   if options.unpacked_only:
@@ -434,13 +463,15 @@
                                    PnaclPackaging.WEBSTORE_PUBLIC_KEY)
 
 
-def BuildAll(version_quad, lib_overrides, options):
-  """ Package the pnacl components 3 ways.
+def BuildExtensionStyle(version_quad, lib_overrides, options):
+  """ Package the pnacl components 3 ways, all of which are
+  chrome-extension-like.
+
   1) Arch-specific CRXes that can be queried by Omaha.
   2) A zip containing all arch files for the Chrome Webstore.
   3) An unpacked extension with all arch files for offline testing.
   """
-  StepBanner("BUILD_ALL", "Packaging for version: %s" % version_quad)
+  StepBanner("BUILD_ALL", "Packaging extension for version: %s" % version_quad)
   for arch in ARCHES:
     BuildArchCRXForComponentUpdater(version_quad, arch, lib_overrides, options)
   LayoutAllDir(version_quad)
@@ -448,6 +479,81 @@
     BuildCWSZip(version_quad)
   BuildUnpacked(version_quad)
 
+######################################################################
+
+def UseWhitelistedChars(orig_basename, arch):
+  """ Make the filename match the pattern expected by pnacl_file_host.
+
+  Currently, this assumes there is prefix "pnacl_public_" and
+  that the allowed chars are in the set [a-zA-Z0-9_].
+  """
+  if arch:
+    target_basename = 'pnacl_public_%s_%s' % (arch, orig_basename)
+  else:
+    target_basename = 'pnacl_public_%s' % orig_basename
+  result = re.sub(r'[^a-zA-Z0-9_]', '_', target_basename)
+  logging.info('UseWhitelistedChars using: %s' % result)
+  return result
+
+def CopyFlattenDirsAndPrefix(src_dir, arch, dest_dir):
+  """ Copy files from src_dir to dest_dir.
+
+  When copying, also rename the files such that they match the white-listing
+  pattern in chrome/browser/nacl_host/pnacl_file_host.cc.
+  """
+  for (root, dirs, files) in os.walk(src_dir, followlinks=True):
+    for f in files:
+      # Assume a flat directory.
+      assert (f == os.path.basename(f))
+      full_name = J(root, f)
+      target_name = UseWhitelistedChars(f, arch)
+      shutil.copy2(full_name, J(dest_dir, target_name))
+
+
+def BuildArchForInstaller(version_quad, arch, lib_overrides, options):
+  """ Build an architecture specific version for the chrome installer.
+  """
+  target_dir = PnaclDirs.OutputDir()
+
+  StepBanner('BUILD INSTALLER',
+             'Packaging for arch %s in %s' % (arch, target_dir))
+
+  # Copy llc.nexe and ld.nexe, but with some renaming and directory flattening.
+  CopyFlattenDirsAndPrefix(PnaclDirs.SandboxedCompilerDir(arch),
+                           arch,
+                           target_dir)
+
+  # Copy native libraries, also with renaming and directory flattening.
+  CopyFlattenDirsAndPrefix(PnaclDirs.LibDir(arch), arch, target_dir)
+
+  # Also copy files from the list of overrides.
+  # This needs the arch tagged onto the name too, like the other files.
+  if arch in lib_overrides:
+    for override in lib_overrides[arch]:
+      override_base = os.path.basename(override)
+      target_name = UseWhitelistedChars(override_base, arch)
+      shutil.copy2(override, J(target_dir, target_name))
+
+
+def BuildInstallerStyle(version_quad, lib_overrides, options):
+  """ Package the pnacl component for use within the chrome installer
+  infrastructure.  These files need to be named in a special way
+  so that white-listing of files is easy.
+  """
+  StepBanner("BUILD_ALL", "Packaging installer for version: %s" % version_quad)
+  arches = DetermineInstallerArches(options.installer_only)
+  for arch in arches:
+    BuildArchForInstaller(version_quad, arch, lib_overrides, options)
+  # Generate pnacl info manifest.
+  # Hack around the fact that there may be more than one arch, on Windows.
+  if len(arches) == 1:
+    arches = arches[0]
+  PnaclPackaging.GeneratePnaclInfo(PnaclDirs.OutputDir(), version_quad,
+                                   arches, is_installer=True)
+
+
+######################################################################
+
 
 def Main():
   usage = 'usage: %prog [options] version_arg'
@@ -460,6 +566,9 @@
   parser.add_option('-u', '--unpacked_only', action='store_true',
                     dest='unpacked_only', default=False,
                     help='Only generate the unpacked version')
+  parser.add_option('-i', '--installer_only',
+                    dest='installer_only', default=None,
+                    help='Only generate the chrome installer version for arch')
   parser.add_option('-d', '--dest', dest='dest',
                     help='The destination root for laying out the extension')
   parser.add_option('-p', '--priv_key',
@@ -475,8 +584,17 @@
                     help='Generate a fresh private key, and exit.')
   parser.add_option('-C', '--chrome_path', dest='chrome_path',
                     help='Location of chrome.')
+  parser.add_option('-v', '--verbose', dest='verbose', default=False,
+                    action='store_true',
+                    help='Print verbose debug messages.')
 
   (options, args) = parser.parse_args()
+  if options.verbose:
+    logging.getLogger().setLevel(logging.DEBUG)
+  else:
+    logging.getLogger().setLevel(logging.ERROR)
+  logging.info('pnacl_component_crx_gen w/ options %s and args %s\n'
+               % (options, args))
 
   # Set destination directory before doing any cleaning, etc.
   if options.dest:
@@ -492,6 +610,7 @@
   lib_overrides = {}
   for o in options.lib_overrides:
     arch, override_lib = o.split(',')
+    arch = CanonicalArch(arch)
     if not IsValidArch(arch):
       raise Exception('Unknown arch for -L: %s (from %s)' % (arch, o))
     if not os.path.isfile(override_lib):
@@ -510,7 +629,10 @@
     print 'Invalid version format: %s\n' % version_quad
     return 1
 
-  BuildAll(version_quad, lib_overrides, options)
+  if options.installer_only:
+    BuildInstallerStyle(version_quad, lib_overrides, options)
+  else:
+    BuildExtensionStyle(version_quad, lib_overrides, options)
   return 0
 
 
diff --git a/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp b/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp
new file mode 100644
index 0000000..d73a29f
--- /dev/null
+++ b/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp
@@ -0,0 +1,153 @@
+# 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.
+
+{
+  # re: untrusted.gypi -- Though this doesn't really use build_nexe.py or
+  # anything, it depends on untrusted nexes from the toolchain and for the shim.
+  'includes': [
+    '../../../../../build/common_untrusted.gypi',
+  ],
+  'targets': [
+  {
+    'target_name': 'pnacl_support_extension',
+    'type': 'none',
+    'conditions': [
+      ['disable_nacl==0 and disable_nacl_untrusted==0', {
+        'dependencies': [
+          '../../../../../ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim',
+          '../../../../../native_client/tools.gyp:prep_toolchain',
+        ],
+        'sources': [
+          'pnacl_info_template.json',
+        ],
+        # We could use 'copies', but we want to rename the files
+        # in a white-listed way first.  Thus use a script.
+        'actions': [
+          {
+            'action_name': 'generate_pnacl_support_extension',
+            'inputs': [
+              'pnacl_component_crx_gen.py',
+              # A stamp file representing the contents of pnacl_translator.
+              '<(DEPTH)/native_client/toolchain/pnacl_translator/SOURCE_SHA1',
+            ],
+            'conditions': [
+                # On windows we need both ia32 and x64.
+                ['OS=="win"', {
+                    'outputs': [
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_pnacl_json',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_crtbegin_o',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_crtbeginS_o',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_ld_nexe',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_libcrt_platform_a',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_libgcc_a',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_libgcc_eh_a',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_libpnacl_irt_shim_a',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_llc_nexe',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_crtbegin_o',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_crtbeginS_o',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_ld_nexe',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_libcrt_platform_a',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_libgcc_a',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_libgcc_eh_a',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_libpnacl_irt_shim_a',
+                      '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_llc_nexe',
+                    ],
+                    'inputs': [
+                      '<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_translate/lib-x86-32/libpnacl_irt_shim.a',
+                      '<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_translate/lib-x86-64/libpnacl_irt_shim.a',
+                    ],
+                    'variables': {
+                      'lib_overrides': [
+                        # Use the two freshly generated shims.
+                        '--lib_override=ia32,<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_translate/lib-x86-32/libpnacl_irt_shim.a',
+                        '--lib_override=x64,<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_translate/lib-x86-64/libpnacl_irt_shim.a',
+                      ],
+                    },
+                }],
+                # Non-windows installers only need the matching architecture.
+                ['OS!="win"', {
+                   'conditions': [
+                      ['target_arch=="arm"', {
+                        'outputs': [
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_pnacl_json',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_arm_crtbegin_o',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_arm_crtbeginS_o',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_arm_ld_nexe',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_arm_libcrt_platform_a',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_arm_libgcc_a',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_arm_libgcc_eh_a',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_arm_libpnacl_irt_shim_a',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_arm_llc_nexe',
+                        ],
+                        'inputs': [
+                          '<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_translate/lib-arm/libpnacl_irt_shim.a',
+                        ],
+                        'variables': {
+                          'lib_overrides': [
+                            # Use the freshly generated shim.
+                            '--lib_override=arm,<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_translate/lib-arm/libpnacl_irt_shim.a',
+                          ],
+                        },
+                      }],
+                      ['target_arch=="ia32"', {
+                        'outputs': [
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_pnacl_json',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_crtbegin_o',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_crtbeginS_o',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_ld_nexe',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_libcrt_platform_a',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_libgcc_a',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_libgcc_eh_a',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_libpnacl_irt_shim_a',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_llc_nexe',
+                        ],
+                        'inputs': [
+                          '<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_translate/lib-x86-32/libpnacl_irt_shim.a',
+                        ],
+                        'variables': {
+                          'lib_overrides': [
+                            # Use the freshly generated shim.
+                            '--lib_override=ia32,<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_translate/lib-x86-32/libpnacl_irt_shim.a',
+                          ],
+                        },
+                      }],
+                      ['target_arch=="x64"', {
+                        'outputs': [
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_pnacl_json',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_crtbegin_o',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_crtbeginS_o',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_ld_nexe',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_libcrt_platform_a',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_libgcc_a',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_libgcc_eh_a',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_libpnacl_irt_shim_a',
+                          '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_llc_nexe',
+                        ],
+                        'inputs': [
+                          '<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_translate/lib-x86-64/libpnacl_irt_shim.a',
+                        ],
+                        'variables': {
+                          'lib_overrides': [
+                            # Use the freshly generated shim.
+                            '--lib_override=x64,<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_translate/lib-x86-64/libpnacl_irt_shim.a',
+                          ],
+                        },
+                      }],
+                  ],
+               }],
+            ],
+            'action': [
+              'python', 'pnacl_component_crx_gen.py',
+              '--dest=<(PRODUCT_DIR)/pnacl',
+              '<@(lib_overrides)',
+              '--installer_only=<(target_arch)',
+              # ABI Version Number.
+              '0.0.0.1',
+            ],
+          },
+        ],
+      }],
+    ],
+  }],
+}
diff --git a/ppapi/native_client/tests/breakpad_crash_test/browser_process_crash.html b/ppapi/native_client/tests/breakpad_crash_test/browser_process_crash.html
new file mode 100644
index 0000000..4aa913f
--- /dev/null
+++ b/ppapi/native_client/tests/breakpad_crash_test/browser_process_crash.html
@@ -0,0 +1,37 @@
+<!--
+  Copyright (c) 2013 The Chromium Authors. All rights reserved.
+  Use of this source code is governed by a BSD-style license that can be
+  found in the LICENSE file.
+-->
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+  <head>
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="-1" />
+    <script type="text/javascript" src="nacltest.js"></script>
+    <title>Browser Process Crash Test</title>
+  </head>
+
+  <body>
+    <h1>Browser Process Crash Test</h1>
+
+<script type="text/javascript">
+
+var tester = new Tester();
+
+// We don't normally expect any of this code to run, because we are
+// testing a browser process crash.  If we reach here, the
+// "--crash-test" option does not work.
+
+tester.addTest('browser_process_crash', function(status) {
+  status.fail('Browser was supposed to crash, not reach here');
+});
+
+tester.run();
+
+</script>
+
+  </body>
+</html>
diff --git a/ppapi/native_client/tests/breakpad_crash_test/crash_dump_tester.py b/ppapi/native_client/tests/breakpad_crash_test/crash_dump_tester.py
index 4f79fbf..63d67f1 100755
--- a/ppapi/native_client/tests/breakpad_crash_test/crash_dump_tester.py
+++ b/ppapi/native_client/tests/breakpad_crash_test/crash_dump_tester.py
@@ -37,34 +37,94 @@
   return dump_info
 
 
-def StartCrashService(browser_path, dumps_dir, windows_pipe_name, win64):
+def StartCrashService(browser_path, dumps_dir, windows_pipe_name,
+                      cleanup_funcs, crash_service_exe):
+  # Find crash_service.exe relative to chrome.exe.  This is a bit icky.
+  browser_dir = os.path.dirname(browser_path)
+  proc = subprocess.Popen([os.path.join(browser_dir, crash_service_exe),
+                           '--v=1',  # Verbose output for debugging failures
+                           '--dumps-dir=%s' % dumps_dir,
+                           '--pipe-name=%s' % windows_pipe_name])
+
+  def Cleanup():
+    # Note that if the process has already exited, this will raise
+    # an 'Access is denied' WindowsError exception, but
+    # crash_service.exe is not supposed to do this and such
+    # behaviour should make the test fail.
+    proc.terminate()
+    status = proc.wait()
+    sys.stdout.write('crash_dump_tester: %s exited with status %s\n'
+                     % (crash_service_exe, status))
+
+  cleanup_funcs.append(Cleanup)
+
+
+def ListPathsInDir(dir_path):
+  if os.path.exists(dir_path):
+    return [os.path.join(dir_path, name)
+            for name in os.listdir(dir_path)]
+  else:
+    return []
+
+
+def GetDumpFiles(dumps_dirs):
+  all_files = [filename
+               for dumps_dir in dumps_dirs
+               for filename in ListPathsInDir(dumps_dir)]
+  sys.stdout.write('crash_dump_tester: Found %i files\n' % len(all_files))
+  for dump_file in all_files:
+    sys.stdout.write('  %s (size %i)\n'
+                     % (dump_file, os.stat(dump_file).st_size))
+  return [dump_file for dump_file in all_files
+          if dump_file.endswith('.dmp')]
+
+
+def Main(cleanup_funcs):
+  parser = browser_tester.BuildArgParser()
+  parser.add_option('--expected_crash_dumps', dest='expected_crash_dumps',
+                    type=int, default=0,
+                    help='The number of crash dumps that we should expect')
+  parser.add_option('--expected_process_type_for_crash',
+                    dest='expected_process_type_for_crash',
+                    type=str, default='nacl-loader',
+                    help='The type of Chromium process that we expect the '
+                    'crash dump to be for')
+  # Ideally we would just query the OS here to find out whether we are
+  # running x86-32 or x86-64 Windows, but Python's win32api module
+  # does not contain a wrapper for GetNativeSystemInfo(), which is
+  # what NaCl uses to check this, or for IsWow64Process(), which is
+  # what Chromium uses.  Instead, we just rely on the build system to
+  # tell us.
+  parser.add_option('--win64', dest='win64', action='store_true',
+                    help='Pass this if we are running tests for x86-64 Windows')
+  options, args = parser.parse_args()
+
+  temp_dir = tempfile.mkdtemp(prefix='nacl_crash_dump_tester_')
+  def CleanUpTempDir():
+    browsertester.browserlauncher.RemoveDirectory(temp_dir)
+  cleanup_funcs.append(CleanUpTempDir)
+
+  # To get a guaranteed unique pipe name, use the base name of the
+  # directory we just created.
+  windows_pipe_name = r'\\.\pipe\%s_crash_service' % os.path.basename(temp_dir)
+
+  # This environment variable enables Breakpad crash dumping in
+  # non-official builds of Chromium.
+  os.environ['CHROME_HEADLESS'] = '1'
   if sys.platform == 'win32':
-    # Find crash_service.exe relative to chrome.exe.  This is a bit icky.
-    browser_dir = os.path.dirname(browser_path)
-    # Ideally we would just query the OS here to find out whether we
-    # are running x86-32 or x86-64 Windows, but Python's win32api
-    # module does not contain a wrapper for GetNativeSystemInfo(),
-    # which is what NaCl uses to check this, or for IsWow64Process(),
-    # which is what Chromium uses.  Instead, we just rely on the build
-    # system to tell us.  Furthermore, on an x86-64 Windows system we
-    # could launch both versions of crash_service, in order to check
-    # that they do not interfere, but for simplicity we do not.
-    if win64:
-      executable_name = 'crash_service64.exe'
-    else:
-      executable_name = 'crash_service.exe'
-    proc = subprocess.Popen([os.path.join(browser_dir, executable_name),
-                             '--dumps-dir=%s' % dumps_dir,
-                             '--pipe-name=%s' % windows_pipe_name])
-    def Cleanup():
-      # Note that if the process has already exited, this will raise
-      # an 'Access is denied' WindowsError exception, but
-      # crash_service.exe is not supposed to do this and such
-      # behaviour should make the test fail.
-      proc.terminate()
-      status = proc.wait()
-      sys.stdout.write('crash_dump_tester: '
-                       'crash_service.exe exited with status %s\n' % status)
+    dumps_dir = temp_dir
+    # Override the default (global) Windows pipe name that Chromium will
+    # use for out-of-process crash reporting.
+    os.environ['CHROME_BREAKPAD_PIPE_NAME'] = windows_pipe_name
+    # Launch the x86-32 crash service so that we can handle crashes in
+    # the browser process.
+    StartCrashService(options.browser_path, dumps_dir, windows_pipe_name,
+                      cleanup_funcs, 'crash_service.exe')
+    if options.win64:
+      # Launch the x86-64 crash service so that we can handle crashes
+      # in the NaCl loader process (nacl64.exe).
+      StartCrashService(options.browser_path, dumps_dir, windows_pipe_name,
+                        cleanup_funcs, 'crash_service64.exe')
     # We add a delay because there is probably a race condition:
     # crash_service.exe might not have finished doing
     # CreateNamedPipe() before NaCl does a crash dump and tries to
@@ -72,64 +132,48 @@
     # TODO(mseaborn): We could change crash_service.exe to report when
     # it has successfully created the named pipe.
     time.sleep(1)
-  else:
-    def Cleanup():
-      pass
-  return Cleanup
-
-
-def GetDumpFiles(dumps_dir):
-  all_files = [os.path.join(dumps_dir, dump_file)
-               for dump_file in os.listdir(dumps_dir)]
-  sys.stdout.write('crash_dump_tester: Found %i files\n' % len(all_files))
-  for dump_file in all_files:
-    sys.stdout.write('  %s\n' % dump_file)
-  return [dump_file for dump_file in all_files
-          if dump_file.endswith('.dmp')]
-
-
-def Main():
-  parser = browser_tester.BuildArgParser()
-  parser.add_option('--expected_crash_dumps', dest='expected_crash_dumps',
-                    type=int, default=0,
-                    help='The number of crash dumps that we should expect')
-  parser.add_option('--win64', dest='win64', action='store_true',
-                    help='Pass this if we are running tests for x86-64 Windows')
-  options, args = parser.parse_args()
-
-  dumps_dir = tempfile.mkdtemp(prefix='nacl_crash_dump_tester_')
-  # To get a guaranteed unique pipe name, use the base name of the
-  # directory we just created.
-  windows_pipe_name = r'\\.\pipe\%s_crash_service' % os.path.basename(dumps_dir)
-
-  # This environment variable enables Breakpad crash dumping in
-  # non-official builds of Chromium.
-  os.environ['CHROME_HEADLESS'] = '1'
-  if sys.platform == 'win32':
-    # Override the default (global) Windows pipe name that Chromium will
-    # use for out-of-process crash reporting.
-    os.environ['CHROME_BREAKPAD_PIPE_NAME'] = windows_pipe_name
   elif sys.platform == 'darwin':
+    dumps_dir = temp_dir
     os.environ['BREAKPAD_DUMP_LOCATION'] = dumps_dir
+  elif sys.platform.startswith('linux'):
+    # The "--user-data-dir" option is not effective for the Breakpad
+    # setup in Linux Chromium, because Breakpad is initialized before
+    # "--user-data-dir" is read.  So we set HOME to redirect the crash
+    # dumps to a temporary directory.
+    home_dir = temp_dir
+    os.environ['HOME'] = home_dir
+    options.enable_crash_reporter = True
 
-  cleanup_func = StartCrashService(options.browser_path, dumps_dir,
-                                   windows_pipe_name, options.win64)
-  try:
-    result = browser_tester.Run(options.url, options)
-  finally:
-    cleanup_func()
+  result = browser_tester.Run(options.url, options)
 
-  dmp_files = GetDumpFiles(dumps_dir)
+  # Find crash dump results.
+  if sys.platform.startswith('linux'):
+    # Look in "~/.config/*/Crash Reports".  This will find crash
+    # reports under ~/.config/chromium or ~/.config/google-chrome, or
+    # under other subdirectories in case the branding is changed.
+    dumps_dirs = [os.path.join(path, 'Crash Reports')
+                  for path in ListPathsInDir(os.path.join(home_dir, '.config'))]
+  else:
+    dumps_dirs = [dumps_dir]
+  dmp_files = GetDumpFiles(dumps_dirs)
+
   failed = False
   msg = ('crash_dump_tester: ERROR: Got %i crash dumps but expected %i\n' %
          (len(dmp_files), options.expected_crash_dumps))
   if len(dmp_files) != options.expected_crash_dumps:
     sys.stdout.write(msg)
     failed = True
-  # On Windows, the crash dumps should come in pairs of a .dmp and
-  # .txt file.
-  if sys.platform == 'win32':
-    for dump_file in dmp_files:
+
+  for dump_file in dmp_files:
+    # Sanity check: Make sure dumping did not fail after opening the file.
+    msg = 'crash_dump_tester: ERROR: Dump file is empty\n'
+    if os.stat(dump_file).st_size == 0:
+      sys.stdout.write(msg)
+      failed = True
+
+    # On Windows, the crash dumps should come in pairs of a .dmp and
+    # .txt file.
+    if sys.platform == 'win32':
       second_file = dump_file[:-4] + '.txt'
       msg = ('crash_dump_tester: ERROR: File %r is missing a corresponding '
              '%r file\n' % (dump_file, second_file))
@@ -140,9 +184,9 @@
       # Check that the crash dump comes from the NaCl process.
       dump_info = ReadDumpTxtFile(second_file)
       if 'ptype' in dump_info:
-        msg = ('crash_dump_tester: ERROR: Unexpected ptype value: %r\n'
-               % dump_info['ptype'])
-        if dump_info['ptype'] != 'nacl-loader':
+        msg = ('crash_dump_tester: ERROR: Unexpected ptype value: %r != %r\n'
+               % (dump_info['ptype'], options.expected_process_type_for_crash))
+        if dump_info['ptype'] != options.expected_process_type_for_crash:
           sys.stdout.write(msg)
           failed = True
       else:
@@ -158,9 +202,17 @@
   else:
     sys.stdout.write('crash_dump_tester: PASSED\n')
 
-  browsertester.browserlauncher.RemoveDirectory(dumps_dir)
   return result
 
 
+def MainWrapper():
+  cleanup_funcs = []
+  try:
+    return Main(cleanup_funcs)
+  finally:
+    for func in cleanup_funcs:
+      func()
+
+
 if __name__ == '__main__':
-  sys.exit(Main())
+  sys.exit(MainWrapper())
diff --git a/ppapi/native_client/tests/breakpad_crash_test/nacl.scons b/ppapi/native_client/tests/breakpad_crash_test/nacl.scons
index 710b00a..b982eb0 100644
--- a/ppapi/native_client/tests/breakpad_crash_test/nacl.scons
+++ b/ppapi/native_client/tests/breakpad_crash_test/nacl.scons
@@ -3,6 +3,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import os
+
 Import('env')
 
 if env.Bit('host_windows') or env.Bit('host_mac'):
@@ -21,6 +23,31 @@
   return env.File('${STAGING_DIR}/%s${PROGSUFFIX}' %
                   env.ProgramNameForNmf(name))
 
+
+# This tests that crashes in Chromium's browser process successfully
+# produce crash dumps via Breakpad.
+node = env.PPAPIBrowserTester(
+    'breakpad_browser_process_crash_test.out',
+    python_tester_script=env.File('crash_dump_tester.py'),
+    browser_flags=['--crash-test'], # Tell the browser process to crash.
+    url='browser_process_crash.html',
+    nmf_names=[],
+    files=[env.File('browser_process_crash.html')],
+    args=platform_args + ['--expect_browser_process_crash',
+                          '--expected_crash_dumps=1',
+                          '--expected_process_type=browser'])
+
+# The test is disabled because it is flaky on Linux and Mac.
+# See: https://code.google.com/p/chromium/issues/detail?id=175023
+# Additionally, the test affects crash stats on Mac because it uploads
+# crash dumps on the bots for the Chrome official build.
+# See: https://code.google.com/p/chromium/issues/detail?id=129402
+env.AddNodeToTestSuite(
+    node, ['chrome_browser_tests'], 'run_breakpad_browser_process_crash_test',
+    is_broken=(env.PPAPIBrowserTesterIsBroken() or
+               env.Bit('host_linux') or env.Bit('host_mac') or
+               env.Bit('running_on_valgrind')))
+
 # This crash in trusted code should produce a crash dump.
 crash_test_url = 'trusted_crash_in_startup.html'
 if env.Bit('pnacl_generate_pexe'):
@@ -34,16 +61,13 @@
            env.File('trusted_crash_in_startup.html')],
     osenv='NACL_CRASH_TEST=1',
     args=platform_args + ['--expected_crash_dumps=%i' % expected_crash_dumps])
-# This test fails with the IPC proxy on Mac and Linux.
-# http://crbug.com/160089
+
 env.AddNodeToTestSuite(
     node,
     ['chrome_browser_tests'],
     'run_breakpad_trusted_crash_in_startup_test',
     is_broken=env.PPAPIBrowserTesterIsBroken() or
-               env.Bit('running_on_valgrind') or
-               env.Bit('host_mac') or
-               env.Bit('host_linux'))
+               env.Bit('running_on_valgrind'))
 
 # This tests a crash that occurs inside a syscall handler.
 # Ultimately this should be recognised as a crash caused by untrusted code.
diff --git a/ppapi/native_client/tests/breakpad_crash_test/trusted_crash_in_startup.html b/ppapi/native_client/tests/breakpad_crash_test/trusted_crash_in_startup.html
index 70b2f46..509f437 100644
--- a/ppapi/native_client/tests/breakpad_crash_test/trusted_crash_in_startup.html
+++ b/ppapi/native_client/tests/breakpad_crash_test/trusted_crash_in_startup.html
@@ -37,19 +37,22 @@
   }), true);
 
   div.addEventListener('error', status.wrap(function(event) {
-    var expected_error;
+    var error = embed.lastError;
+    status.log('Received error: ' + error);
     // This error occurs only because NACL_CRASH_TEST is set.  We would
     // not normally expect to get this error in the browser.
     // For PNaCl, the crash will occur while starting the compiler process.
     var test_args = getTestArguments({ 'is_pnacl': 'false' });
     if (test_args['is_pnacl'] != 'false') {
-      expected_error = ('NaCl module load failed: PnaclCoordinator: ' +
-                        'Compile process could not be created');
+      var expected_error = ('NaCl module load failed: PnaclCoordinator: ' +
+                            'Compile process could not be created');
       status.assert(begins_with(embed.lastError, expected_error));
     } else {
-      expected_error = ('NaCl module load failed: ServiceRuntime: ' +
-                        'command channel creation failed');
-      status.assertEqual(embed.lastError, expected_error);
+      var expected_error_prefix = 'NaCl module load failed: ServiceRuntime: ';
+      var suffix1 = 'command channel creation failed';
+      var suffix2 = 'failed to start';
+      status.assert(error == expected_error_prefix + suffix1 ||
+                    error == expected_error_prefix + suffix2);
     }
     status.pass();
   }), true);
diff --git a/ppapi/native_client/tests/nacl_browser/inbrowser_test_runner/nacl.scons b/ppapi/native_client/tests/nacl_browser/inbrowser_test_runner/nacl.scons
index 60ae804..33ed844 100644
--- a/ppapi/native_client/tests/nacl_browser/inbrowser_test_runner/nacl.scons
+++ b/ppapi/native_client/tests/nacl_browser/inbrowser_test_runner/nacl.scons
@@ -50,7 +50,10 @@
   env.AddNodeToTestSuite(node, ['chrome_browser_tests'], test_name,
                          disable_irt_suffix=True,
                          is_broken=env.PPAPIBrowserTesterIsBroken() or
-                                   env.Bit('running_on_valgrind'))
+                                   env.Bit('running_on_valgrind') or
+  # inbrowser_test_runner_parallel is flaky on 32 bit windows
+  # (maybe http://code.google.com/p/chromium/issues/detail?id=120355 ?)
+                                   parallel)
 
 if not env.Bit('tests_use_irt'):
   Return()
diff --git a/ppapi/native_client/tests/nacl_browser/inbrowser_test_runner/test_runner_ppapi.c b/ppapi/native_client/tests/nacl_browser/inbrowser_test_runner/test_runner_ppapi.c
index 8db514a..93a133b 100644
--- a/ppapi/native_client/tests/nacl_browser/inbrowser_test_runner/test_runner_ppapi.c
+++ b/ppapi/native_client/tests/nacl_browser/inbrowser_test_runner/test_runner_ppapi.c
@@ -49,7 +49,7 @@
   }
 }
 
-int TestRunningInBrowser() {
+int TestRunningInBrowser(void) {
   return 1;
 }
 
@@ -144,7 +144,7 @@
   return PP_OK;
 }
 
-void PPP_ShutdownModule() {
+void PPP_ShutdownModule(void) {
 }
 
 const void *PPP_GetInterface(const char *interface_name) {
diff --git a/ppapi/native_client/tests/nacl_browser/manifest_file/pm_pre_init_manifest_file_test.html b/ppapi/native_client/tests/nacl_browser/manifest_file/pm_pre_init_manifest_file_test.html
index 5b54140..1e24e03 100644
--- a/ppapi/native_client/tests/nacl_browser/manifest_file/pm_pre_init_manifest_file_test.html
+++ b/ppapi/native_client/tests/nacl_browser/manifest_file/pm_pre_init_manifest_file_test.html
@@ -32,7 +32,10 @@
   tester.addAsyncTest('Test_00_ManifestData', function(status) {
     plugin.addEventListener('message', function(message_event) {
       this.removeEventListener('message', arguments.callee, false);
-      var golden = 'File Contents:\nTest File Content\nOpening non-existent file:\nGot descriptor -1, status 0\n';
+      // TODO(bsy): remove golden_old once NaCl DEPS rolls pass 10970
+      var golden_old = 'File Contents:\nTest File Content\nOpening non-existent file:\nGot descriptor -1, status 0\n';
+      // when there is a non-existent file, we expect errno of NACL_ABI_ENOENT
+      var golden = 'File Contents:\nTest File Content\nOpening non-existent file:\nGot descriptor -1, status 2\n';
       status.log('expecting golden: ' + golden);
       status.log('golden.length: ' + golden.length);
       status.log('message_event.data.length: ' + message_event.data.length);
@@ -47,7 +50,10 @@
           status.log('charcodes: ' + mchar.charCodeAt(0) + ' != ' + gchar.charCodeAt(0));
         }
       }
-      status.assertEqual(message_event.data, golden);
+      var accept_both = (message_event.data == golden) ||
+                        (message_event.data == golden_old);
+      status.assert(accept_both);
+      // status.assertEqual(message_event.data, golden);
       status.pass();
     }, false);
     plugin.postMessage('manifest_data');
diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_test.html b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_test.html
index 219d9e2..2627d87 100644
--- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_test.html
+++ b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_test.html
@@ -49,7 +49,8 @@
       tester,
       'nonexistent_pexe',
       'pnacl_bad_doesnotexist.nmf',
-      'NaCl module load failed: PnaclCoordinator: pexe load failed.');
+      'NaCl module load failed: PnaclCoordinator: ' +
+      'pexe load failed (pp_error=-2).');
 
   // 'nonexistent_pexe_only' loads a manifest, then tries to load a nonexistent
   // pexe, given only a pexe to choose from.
@@ -57,7 +58,8 @@
       tester,
       'nonexistent_pexe_only',
       'pnacl_bad_doesnotexist_pexe_only.nmf',
-      'NaCl module load failed: PnaclCoordinator: pexe load failed.');
+      'NaCl module load failed: PnaclCoordinator: ' +
+      'pexe load failed (pp_error=-2).');
 
   tester.addAsyncTest('Test clean directory',
     // All that should be left after all tests run is empty directories.
diff --git a/ppapi/native_client/tests/ppapi_browser/bad/nacl.scons b/ppapi/native_client/tests/ppapi_browser/bad/nacl.scons
index 7813443..340cea8 100644
--- a/ppapi/native_client/tests/ppapi_browser/bad/nacl.scons
+++ b/ppapi/native_client/tests/ppapi_browser/bad/nacl.scons
@@ -30,20 +30,22 @@
   'ppapi_bad_magic.nmf',
   'ppapi_bad_manifest_uses_nexes.nmf',
   'ppapi_bad_manifest_bad_files.nmf',
+  'ppapi_bad_manifest_nexe_arch.nmf',
   env.File('${SCONSTRUCT_DIR}/tools/browser_tester/browserdata/nacltest.js')
   ]
 ppapi_bad = env.Replicate('${STAGING_DIR}', ppapi_bad_files)
 
 nmf_names = []
 # Compile all nexes embedded into the above html
-# TODO(bbudge) Re-enable these as the IPC proxy gets equivalent error reporting.
+# TODO(bbudge) Re-enable tests as the IPC proxy gets equivalent error reporting
+# or delete them after the proxy switch if they're specific to SRPC.
 # http://crbug.com/160076
-for kind in [ #'ppp_initialize', 'ppp_initialize_crash',
-              #'no_ppp_instance', 'get_ppp_instance_crash',
+for kind in [ 'ppp_initialize', 'ppp_initialize_crash',
+              'no_ppp_instance', 'get_ppp_instance_crash',
               #'get_ppp_messaging_crash', 'get_ppp_printing_crash',
-              #'ppp_instance_didcreate', 'ppp_instance_didcreate_crash',
+              'ppp_instance_didcreate', 'ppp_instance_didcreate_crash',
               #'event_replay_crash'
-              ]:
+            ]:
   bad_nmf = 'ppapi_bad_%s' % kind
   bad_nexe = env.ProgramNameForNmf('ppapi_bad_%s' % kind)
   env.ComponentProgram(bad_nexe,
diff --git a/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad.html b/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad.html
index f1a9f4f..f568459 100644
--- a/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad.html
+++ b/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad.html
@@ -20,37 +20,51 @@
 <script type="text/javascript">
 //<![CDATA[
 
-function declareTests(tester) {
-  // PNaCl may have slightly different error messages (pexe instead of nexe).
-  var test_args = getTestArguments({'is_pnacl': '0'});
-  var could_not_load_nexe;
-  if (parseInt(test_args['is_pnacl'])) {
-    could_not_load_nexe = (
-      'NaCl module load failed: PnaclCoordinator: pexe load failed.');
+var prefix = 'NaCl module load failed: ';
+
+// PNaCl may have slightly different error messages (pexe instead of nexe).
+function couldNotAccessNexe(is_pnacl) {
+  if (!is_pnacl) {
+    return prefix + 'access to nexe url was denied.';
   } else {
-    could_not_load_nexe = 'NaCl module load failed: could not load nexe url.';
+    return prefix + 'PnaclCoordinator: pexe load failed (no access).';
   }
+}
+
+// PNaCl may have slightly different error messages (pexe instead of nexe).
+function couldNotLoadNexe(is_pnacl) {
+  if (!is_pnacl) {
+    return prefix + 'could not load nexe url.';
+  } else {
+    /* PP_ERROR_FAILED */
+    return prefix + 'PnaclCoordinator: pexe load failed (pp_error=-2).';
+  }
+}
+
+function declareTests(tester) {
+  var test_args = getTestArguments({'is_pnacl': '0'});
+  var is_pnacl = parseInt(test_args['is_pnacl']);
 
   // 'bad_magic' loads a manifest, then loads a nexe that tests as invalid.
   badLoadTest(
       tester,
       'bad_magic',
       'ppapi_bad_magic.nmf',
-      'NaCl module load failed: Too many program header entries in ELF file');
+      'NaCl module load failed: Bad ELF header magic number');
 
   // 'cross_origin' loads a manifest, then tries to load a cross-origin nexe.
   badLoadTest(
       tester,
       'cross_origin',
       'ppapi_bad_crossorigin.nmf',
-      could_not_load_nexe);
+      couldNotAccessNexe(is_pnacl));
 
   // 'cross_manifest' tries to load a cross-origin manifest.
   badLoadTest(
       tester,
       'cross_manifest',
       'http://www.google.com/crossorigin.manifest',
-      'NaCl module load failed: could not load manifest url.');
+      'NaCl module load failed: access to manifest url was denied.');
 
   // 'nonexistent_nexe' loads a manifest, then tries to load a nonexistent nexe,
   // given both a nexe and a portable program to choose from.
@@ -58,7 +72,7 @@
       tester,
       'nonexistent_nexe',
       'ppapi_bad_doesnotexist.nmf',
-      could_not_load_nexe);
+      couldNotLoadNexe(is_pnacl));
 
   // 'nonexistent_nexe_only' loads a manifest, then tries to load a nonexistent
   // nexe, given only a nexe to choose from.
@@ -94,14 +108,19 @@
       tester,
       'bad_manifest_bad_files',
       'ppapi_bad_manifest_bad_files.nmf',
-      'NaCl module load failed: manifest: file file.txt no version given for current arch and no portable version found.');
+      'NaCl module load failed: manifest: no version of file.txt given for current arch and no portable version found.');
+
+  // 'bad_manifest_nexe_arch' loads a manifest with no program entry for the
+  // user's architecture
+  badLoadTest(
+      tester,
+      'bad_manifest_nexe_arch',
+      'ppapi_bad_manifest_nexe_arch.nmf',
+      'NaCl module load failed: manifest: no version of program given for current arch and no portable version found.');
 
   //////////////////////////////////////
   // Initialization errors begin here //
   //////////////////////////////////////
-/* TODO(bbudge) Re-enable these tests when the IPC proxy reports similar errors.
-  http://crbug.com/160076
-
 
   // 'bad_ppp_initialize' loads a manifest, then loads a nexe that fails to
   // initialize PPAPI module
@@ -135,24 +154,6 @@
       'ppapi_bad_get_ppp_instance_crash.nmf',
       'NaCl module load failed: could not initialize module.');
 
-  // 'bad_get_ppp_messaging_crash' loads a manifest, then loads a nexe that
-  // crashes when getting the optional PPP_Messaging interface, which is done
-  // on init.
-  badLoadTest(
-      tester,
-      'bad_get_ppp_messaging_crash',
-      'ppapi_bad_get_ppp_messaging_crash.nmf',
-      'NaCl module load failed: could not initialize module.');
-
-  // 'bad_get_ppp_printing_crash' loads a manifest, then loads a nexe that
-  // crashes when getting the optional PPP_Printing interface, which is done
-  // right after creation, but before loadEnd is dispatched.
-  badLoadTest(
-      tester,
-      'bad_get_ppp_printing_crash',
-      'ppapi_bad_get_ppp_printing_crash.nmf',
-      'NaCl module load failed: instance crashed after creation.');
-
   // 'bad_ppp_instance_didcreate' loads a manifest, then loads a nexe that fails
   // to create the instance
   badLoadTest(
@@ -169,6 +170,8 @@
       'ppapi_bad_ppp_instance_didcreate_crash.nmf',
       'NaCl module load failed: could not create instance.');
 
+/* TODO(bbudge) Re-enable this test when the IPC proxy can report these errors.
+  http://crbug.com/160076
   // 'bad_event_replay_crash' loads a manifest, then loads a nexe and replays
   // the events that occured during loading causing the nexe to crash before
   // proxy start-up was completed.
diff --git a/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_manifest_nexe_arch.nmf b/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_manifest_nexe_arch.nmf
new file mode 100644
index 0000000..8ef44e9
--- /dev/null
+++ b/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_manifest_nexe_arch.nmf
@@ -0,0 +1,5 @@
+{
+  "program": {
+    "unknown_arch": {"url": "ppapi_bad_no_ppp_instance_x86-32.nexe"}
+  }
+}
diff --git a/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_ppp_initialize_crash.cc b/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_ppp_initialize_crash.cc
index 0eaa8dd..9ef3d16 100644
--- a/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_ppp_initialize_crash.cc
+++ b/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_ppp_initialize_crash.cc
@@ -8,6 +8,7 @@
 
 #include "native_client/src/shared/platform/nacl_check.h"
 #include "native_client/src/include/nacl_macros.h"
+#include "native_client/tests/ppapi_test_lib/test_interface.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_module.h"
@@ -19,7 +20,7 @@
 PP_EXPORT int32_t PPP_InitializeModule(PP_Module module_id,
                                        PPB_GetInterface get_browser_interface) {
   printf("PPP_InitializeModule\n");
-  CHECK(NULL == get_browser_interface(NULL));  // Crash!
+  CRASH;
 
   return PP_OK;
 }
diff --git a/ppapi/native_client/tests/ppapi_browser/progress_event_listener.js b/ppapi/native_client/tests/ppapi_browser/progress_event_listener.js
index 4892a5f..42d3fc6 100644
--- a/ppapi/native_client/tests/ppapi_browser/progress_event_listener.js
+++ b/ppapi/native_client/tests/ppapi_browser/progress_event_listener.js
@@ -47,6 +47,26 @@
     this_.currentState = event_type;
     this_.stateHistogram[this_.currentState]++;
   }
+
+  // True if an event with lengthComputable is ever triggered.
+  this.stateSawLengthComputable = false;
+  // The last event.total seen from an event with lengthComputable being true.
+  this.stateProgressTotal = -1;
+  // The last event.loaded seen from an event with lengthComputable being true.
+  this.stateProgressPrev = -1;
+  // Function to record progress stats.
+  this.recordProgress = function(event) {
+    // Can either record progress from a progress event with lengthComputable,
+    // or from a loadend event.
+    if (event.type == 'progress' && event.lengthComputable) {
+      this.stateSawLengthComputable = true;
+      this.stateProgressTotal = event.total;
+      this.stateProgressPrev = event.loaded;
+    } else if (event.type == 'loadend' && event.lengthComputable) {
+      this.stateProgressTotal = event.total;
+      this.stateProgressPrev = event.loaded;
+    }
+  }
 }
 
 // event_machines is a collection of EventStateMachines, one for each element
@@ -78,6 +98,8 @@
     var event_machine = lookupEventMachine(element_id);
     // Update the state of the machine.
     event_machine.transitionTo(e.type);
+    // Record progress information if possible.
+    event_machine.recordProgress(e);
   }
   // Add the listener for all of the ProgressEvent event types.
   body_element.addEventListener('loadstart', eventListener, true);
@@ -112,6 +134,24 @@
     // loaded and another when the .nexe is loaded.
     assert(eventMachine.stateHistogram['progress'] >= progressMinCount);
   });
+  tester.addTest('progress_samples_' + embedId, function() {
+    console.log('stateSawLengthComputable ' +
+        eventMachine.stateSawLengthComputable);
+    console.log('stateProgressPrev ' +
+        eventMachine.stateProgressPrev);
+    console.log('stateProgressTotal ' +
+        eventMachine.stateProgressTotal);
+
+    assert(eventMachine.stateSawLengthComputable);
+    // Progress events are not necessarily monotonic.  For glibc, each DSO
+    // will trigger a different series of progress events with different totals.
+    // For glibc, the final loadend progress event may even correspond to
+    // the very first load event, instead of corresponding to the last...
+    // So, all we check is that the latest values make some sense.
+    assert(eventMachine.stateProgressPrev > 0);
+    assert(eventMachine.stateProgressTotal > 0);
+    assert(eventMachine.stateProgressPrev <= eventMachine.stateProgressTotal);
+  });
   tester.addTest('error_count_' + embedId, function() {
     // Check that the right number of 'error' events were dispatched.
     assertEqual(eventMachine.stateHistogram['error'], errorCount);
diff --git a/ppapi/native_client/tools/browser_tester/browser_tester.py b/ppapi/native_client/tools/browser_tester/browser_tester.py
index 1617210..061a138 100755
--- a/ppapi/native_client/tools/browser_tester/browser_tester.py
+++ b/ppapi/native_client/tools/browser_tester/browser_tester.py
@@ -131,6 +131,14 @@
   parser.add_option('--nacl_exe_stderr', dest='nacl_exe_stderr',
                     type='string', default=None,
                     help='Redirect standard error of NaCl executable.')
+  parser.add_option('--expect_browser_process_crash',
+                    dest='expect_browser_process_crash',
+                    action='store_true',
+                    help='Do not signal a failure if the browser process '
+                    'crashes')
+  parser.add_option('--enable_crash_reporter', dest='enable_crash_reporter',
+                    action='store_true', default=False,
+                    help='Force crash reporting on.')
 
   return parser
 
@@ -251,6 +259,8 @@
   try:
     while server.test_in_progress or options.interactive:
       if not browser.IsRunning():
+        if options.expect_browser_process_crash:
+          break
         listener.ServerError('Browser process ended during test '
                              '(return code %r)' % browser.GetReturnCode())
         # If Chrome exits prematurely without making a single request to the
@@ -297,7 +307,13 @@
     except Exception:
       listener.ever_failed = 1
     browser.Cleanup()
-    server.server_close()
+    # We avoid calling server.server_close() here because it causes
+    # the HTTP server thread to exit uncleanly with an EBADF error,
+    # which adds noise to the logs (though it does not cause the test
+    # to fail).  server_close() does not attempt to tell the server
+    # loop to shut down before closing the socket FD it is
+    # select()ing.  Since we are about to exit, we don't really need
+    # to close the socket FD.
 
   if tool_failed:
     return 2
diff --git a/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py b/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py
index 0778077..44d38af 100755
--- a/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py
+++ b/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py
@@ -266,13 +266,24 @@
 
   def MakeCmd(self, url, port):
     cmd = [self.binary,
+            # Note that we do not use "--enable-logging" here because
+            # it actually turns off logging to the Buildbot logs on
+            # Windows (see http://crbug.com/169941).
             '--disable-web-resources',
             '--disable-preconnect',
+            # This is speculative, sync should not occur with a clean profile.
+            '--disable-sync',
+            # This prevents Chrome from making "hidden" network requests at
+            # startup.  These requests could be a source of non-determinism,
+            # and they also add noise to the netlogs.
+            '--dns-prefetch-disable',
             '--no-first-run',
             '--no-default-browser-check',
-            '--enable-logging',
             '--log-level=1',
             '--safebrowsing-disable-auto-update',
+            # Suppress metrics reporting.  This prevents misconfigured bots,
+            # people testing at their desktop, etc from poisoning the UMA data.
+            '--metrics-recording-only',
             # Chrome explicitly blacklists some ports as "unsafe" because
             # certain protocols use them.  Chrome gives an error like this:
             # Error 312 (net::ERR_UNSAFE_PORT): Unknown error
@@ -286,11 +297,6 @@
     if self.options.ppapi_plugin is None:
       cmd.append('--enable-nacl')
       disable_sandbox = False
-      # Sandboxing Chrome on Linux requires a SUIDed helper binary.  This
-      # binary may not be installed, so disable sandboxing to avoid the
-      # corner cases where it may fail.  This is a little scarry, because it
-      # means we are not testing NaCl inside the outer sandbox on Linux.
-      disable_sandbox |= PLATFORM == 'linux'
       # Chrome process can't access file within sandbox
       disable_sandbox |= self.options.nacl_exe_stdin is not None
       disable_sandbox |= self.options.nacl_exe_stdout is not None
@@ -305,6 +311,8 @@
       cmd.append('--load-extension=%s' %
                  ','.join(self.options.browser_extensions))
       cmd.append('--enable-experimental-extension-apis')
+    if self.options.enable_crash_reporter:
+      cmd.append('--enable-crash-reporter-for-testing')
     if self.options.tool == 'memcheck':
       cmd = ['src/third_party/valgrind/memcheck.sh',
              '-v',
diff --git a/ppapi/ppapi_c.target.mk b/ppapi/ppapi_c.target.linux-arm.mk
similarity index 87%
rename from ppapi/ppapi_c.target.mk
rename to ppapi/ppapi_c.target.linux-arm.mk
index f9eff90..9c4d194 100644
--- a/ppapi/ppapi_c.target.mk
+++ b/ppapi/ppapi_c.target.linux-arm.mk
@@ -27,6 +27,8 @@
 
 # Flags passed to both C and C++ files.
 MY_CFLAGS := \
+	-fstack-protector \
+	--param=ssp-buffer-size=4 \
 	-Werror \
 	-fno-exceptions \
 	-fno-strict-aliasing \
@@ -36,15 +38,9 @@
 	-fvisibility=hidden \
 	-pipe \
 	-fPIC \
-	-mthumb \
-	-march=armv7-a \
-	-mtune=cortex-a8 \
-	-mfloat-abi=softfp \
-	-mfpu=vfpv3-d16 \
 	-fno-tree-sra \
 	-fuse-ld=gold \
 	-Wno-psabi \
-	-mthumb-interwork \
 	-ffunction-sections \
 	-funwind-tables \
 	-g \
@@ -52,11 +48,10 @@
 	-fno-short-enums \
 	-finline-limit=64 \
 	-Wa,--noexecstack \
-	-Wno-error=extra \
-	-Wno-error=ignored-qualifiers \
-	-Wno-error=type-limits \
-	-Wno-error=non-virtual-dtor \
-	-Wno-error=sign-promo \
+	-U_FORTIFY_SOURCE \
+	-Wno-extra \
+	-Wno-ignored-qualifiers \
+	-Wno-type-limits \
 	-Os \
 	-g \
 	-fomit-frame-pointer \
@@ -66,7 +61,9 @@
 MY_CFLAGS_C :=
 
 MY_DEFS := \
+	'-DUSE_SKIA' \
 	'-D_FILE_OFFSET_BITS=64' \
+	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
@@ -76,15 +73,14 @@
 	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
-	'-DUSE_SKIA=1' \
+	'-DENABLE_LANGUAGE_DETECTION=1' \
 	'-D__STDC_CONSTANT_MACROS' \
 	'-D__STDC_FORMAT_MACROS' \
 	'-DANDROID' \
 	'-D__GNU_SOURCE=1' \
 	'-DUSE_STLPORT=1' \
 	'-D_STLP_USE_PTR_SPECIALIZATIONS=1' \
-	'-DCHROME_SYMBOLS_ID=""' \
-	'-DANDROID_UPSTREAM_BRINGUP=1' \
+	'-DCHROME_BUILD_ID=""' \
 	'-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
 	'-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \
 	'-D_DEBUG'
@@ -106,7 +102,9 @@
 	-fvisibility-inlines-hidden \
 	-Wsign-compare \
 	-Wno-abi \
-	-Wno-error=c++0x-compat
+	-Wno-error=c++0x-compat \
+	-Wno-non-virtual-dtor \
+	-Wno-sign-promo
 
 ### Rules for final target.
 # Add target alias to "gyp_all_modules" target.
diff --git a/ppapi/ppapi_c.target.mk b/ppapi/ppapi_c.target.linux-x86.mk
similarity index 85%
copy from ppapi/ppapi_c.target.mk
copy to ppapi/ppapi_c.target.linux-x86.mk
index f9eff90..d1b943d 100644
--- a/ppapi/ppapi_c.target.mk
+++ b/ppapi/ppapi_c.target.linux-x86.mk
@@ -27,6 +27,7 @@
 
 # Flags passed to both C and C++ files.
 MY_CFLAGS := \
+	--param=ssp-buffer-size=4 \
 	-Werror \
 	-fno-exceptions \
 	-fno-strict-aliasing \
@@ -36,27 +37,22 @@
 	-fvisibility=hidden \
 	-pipe \
 	-fPIC \
-	-mthumb \
-	-march=armv7-a \
-	-mtune=cortex-a8 \
-	-mfloat-abi=softfp \
-	-mfpu=vfpv3-d16 \
-	-fno-tree-sra \
-	-fuse-ld=gold \
-	-Wno-psabi \
-	-mthumb-interwork \
+	-m32 \
+	-mmmx \
+	-march=pentium4 \
+	-msse2 \
+	-mfpmath=sse \
 	-ffunction-sections \
 	-funwind-tables \
 	-g \
-	-fstack-protector \
 	-fno-short-enums \
 	-finline-limit=64 \
 	-Wa,--noexecstack \
-	-Wno-error=extra \
-	-Wno-error=ignored-qualifiers \
-	-Wno-error=type-limits \
-	-Wno-error=non-virtual-dtor \
-	-Wno-error=sign-promo \
+	-U_FORTIFY_SOURCE \
+	-Wno-extra \
+	-Wno-ignored-qualifiers \
+	-Wno-type-limits \
+	-fno-stack-protector \
 	-Os \
 	-g \
 	-fomit-frame-pointer \
@@ -66,7 +62,9 @@
 MY_CFLAGS_C :=
 
 MY_DEFS := \
+	'-DUSE_SKIA' \
 	'-D_FILE_OFFSET_BITS=64' \
+	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
@@ -76,15 +74,14 @@
 	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
-	'-DUSE_SKIA=1' \
+	'-DENABLE_LANGUAGE_DETECTION=1' \
 	'-D__STDC_CONSTANT_MACROS' \
 	'-D__STDC_FORMAT_MACROS' \
 	'-DANDROID' \
 	'-D__GNU_SOURCE=1' \
 	'-DUSE_STLPORT=1' \
 	'-D_STLP_USE_PTR_SPECIALIZATIONS=1' \
-	'-DCHROME_SYMBOLS_ID=""' \
-	'-DANDROID_UPSTREAM_BRINGUP=1' \
+	'-DCHROME_BUILD_ID=""' \
 	'-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
 	'-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \
 	'-D_DEBUG'
@@ -105,8 +102,9 @@
 	-fno-threadsafe-statics \
 	-fvisibility-inlines-hidden \
 	-Wsign-compare \
-	-Wno-abi \
-	-Wno-error=c++0x-compat
+	-Wno-error=c++0x-compat \
+	-Wno-non-virtual-dtor \
+	-Wno-sign-promo
 
 ### Rules for final target.
 # Add target alias to "gyp_all_modules" target.
diff --git a/ppapi/ppapi_cpp.gypi b/ppapi/ppapi_cpp.gypi
index 00bb8f0..1cf11d4 100644
--- a/ppapi/ppapi_cpp.gypi
+++ b/ppapi/ppapi_cpp.gypi
@@ -41,6 +41,9 @@
               'AdditionalOptions': ['/we4244'],  # implicit conversion, possible loss of data
             },
           },
+          'msvs_disabled_warnings': [
+            4267,
+          ],      
         }],
         ['OS=="linux"', {
           'cflags': ['-Wextra', '-pedantic'],
diff --git a/ppapi/ppapi_host.gypi b/ppapi/ppapi_host.gypi
index 8967e45..4031c77 100644
--- a/ppapi/ppapi_host.gypi
+++ b/ppapi/ppapi_host.gypi
@@ -27,11 +27,17 @@
         'host/host_message_context.h',
         'host/instance_message_filter.cc',
         'host/instance_message_filter.h',
+        'host/message_filter_host.cc',
+        'host/message_filter_host.h',
         'host/ppapi_host.cc',
         'host/ppapi_host.h',
         'host/ppapi_host_export.h',
         'host/resource_host.cc',
         'host/resource_host.h',
+        'host/resource_message_filter.cc',
+        'host/resource_message_filter.h',
+        'host/resource_message_handler.cc',
+        'host/resource_message_handler.h',
       ],
     },
   ],
diff --git a/ppapi/ppapi_host.target.mk b/ppapi/ppapi_host.target.mk
deleted file mode 100644
index 7886220..0000000
--- a/ppapi/ppapi_host.target.mk
+++ /dev/null
@@ -1,184 +0,0 @@
-# This file is generated by gyp; do not edit.
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-LOCAL_MODULE := ppapi_ppapi_host_gyp
-LOCAL_MODULE_SUFFIX := .a
-LOCAL_MODULE_TAGS := optional
-gyp_intermediate_dir := $(call local-intermediates-dir)
-gyp_shared_intermediate_dir := $(call intermediates-dir-for,GYP,shared)
-
-# Make sure our deps are built first.
-GYP_TARGET_DEPENDENCIES := \
-	$(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp \
-	$(call intermediates-dir-for,STATIC_LIBRARIES,skia_skia_gyp)/skia_skia_gyp.a
-
-GYP_GENERATED_OUTPUTS :=
-
-# Make sure our deps and generated files are built first.
-LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) $(GYP_GENERATED_OUTPUTS)
-
-LOCAL_CPP_EXTENSION := .cc
-LOCAL_GENERATED_SOURCES :=
-
-GYP_COPIED_SOURCE_ORIGIN_DIRS :=
-
-LOCAL_SRC_FILES := \
-	ppapi/host/host_message_context.cc \
-	ppapi/host/instance_message_filter.cc \
-	ppapi/host/ppapi_host.cc \
-	ppapi/host/resource_host.cc
-
-
-# Flags passed to both C and C++ files.
-MY_CFLAGS := \
-	-Werror \
-	-fno-exceptions \
-	-fno-strict-aliasing \
-	-Wall \
-	-Wno-unused-parameter \
-	-Wno-missing-field-initializers \
-	-fvisibility=hidden \
-	-pipe \
-	-fPIC \
-	-mthumb \
-	-march=armv7-a \
-	-mtune=cortex-a8 \
-	-mfloat-abi=softfp \
-	-mfpu=vfpv3-d16 \
-	-fno-tree-sra \
-	-fuse-ld=gold \
-	-Wno-psabi \
-	-mthumb-interwork \
-	-ffunction-sections \
-	-funwind-tables \
-	-g \
-	-fstack-protector \
-	-fno-short-enums \
-	-finline-limit=64 \
-	-Wa,--noexecstack \
-	-Wno-error=extra \
-	-Wno-error=ignored-qualifiers \
-	-Wno-error=type-limits \
-	-Wno-error=non-virtual-dtor \
-	-Wno-error=sign-promo \
-	-Os \
-	-g \
-	-fomit-frame-pointer \
-	-fdata-sections \
-	-ffunction-sections
-
-MY_CFLAGS_C :=
-
-MY_DEFS := \
-	'-D_FILE_OFFSET_BITS=64' \
-	'-DNO_TCMALLOC' \
-	'-DDISABLE_NACL' \
-	'-DCHROMIUM_BUILD' \
-	'-DUSE_LIBJPEG_TURBO=1' \
-	'-DUSE_PROPRIETARY_CODECS' \
-	'-DENABLE_PEPPER_THREADING' \
-	'-DENABLE_GPU=1' \
-	'-DUSE_OPENSSL=1' \
-	'-DENABLE_EGLIMAGE=1' \
-	'-DUSE_SKIA=1' \
-	'-DPPAPI_HOST_IMPLEMENTATION' \
-	'-DSK_BUILD_NO_IMAGE_ENCODE' \
-	'-DSK_DEFERRED_CANVAS_USES_GPIPE=1' \
-	'-DGR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"' \
-	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
-	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
-	'-DU_USING_ICU_NAMESPACE=0' \
-	'-DUSE_SYSTEM_ICU' \
-	'-D__STDC_CONSTANT_MACROS' \
-	'-D__STDC_FORMAT_MACROS' \
-	'-DANDROID' \
-	'-D__GNU_SOURCE=1' \
-	'-DUSE_STLPORT=1' \
-	'-D_STLP_USE_PTR_SPECIALIZATIONS=1' \
-	'-DCHROME_SYMBOLS_ID=""' \
-	'-DANDROID_UPSTREAM_BRINGUP=1' \
-	'-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
-	'-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \
-	'-D_DEBUG'
-
-LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS)
-
-# Include paths placed before CFLAGS/CPPFLAGS
-LOCAL_C_INCLUDES := \
-	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/third_party/khronos \
-	$(LOCAL_PATH)/third_party/WebKit/Source/Platform/chromium \
-	$(gyp_shared_intermediate_dir)/webcore_headers \
-	$(LOCAL_PATH)/skia/config \
-	$(LOCAL_PATH)/third_party/skia/src/core \
-	$(LOCAL_PATH)/third_party/skia/include/config \
-	$(LOCAL_PATH)/third_party/skia/include/core \
-	$(LOCAL_PATH)/third_party/skia/include/effects \
-	$(LOCAL_PATH)/third_party/skia/include/pdf \
-	$(LOCAL_PATH)/third_party/skia/include/gpu \
-	$(LOCAL_PATH)/third_party/skia/include/gpu/gl \
-	$(LOCAL_PATH)/third_party/skia/include/pipe \
-	$(LOCAL_PATH)/third_party/skia/include/ports \
-	$(LOCAL_PATH)/third_party/skia/include/utils \
-	$(LOCAL_PATH)/skia/ext \
-	$(LOCAL_PATH)/third_party/harfbuzz/contrib \
-	$(LOCAL_PATH)/third_party/harfbuzz/src \
-	$(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/common \
-	$(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/i18n \
-	$(LOCAL_PATH)/third_party/npapi \
-	$(LOCAL_PATH)/third_party/npapi/bindings \
-	$(LOCAL_PATH)/v8/include \
-	$(GYP_ABS_ANDROID_TOP_DIR)/frameworks/wilhelm/include \
-	$(GYP_ABS_ANDROID_TOP_DIR)/bionic \
-	$(GYP_ABS_ANDROID_TOP_DIR)/external/stlport/stlport
-
-LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES)
-
-# Flags passed to only C++ (and not C) files.
-LOCAL_CPPFLAGS := \
-	-fno-rtti \
-	-fno-threadsafe-statics \
-	-fvisibility-inlines-hidden \
-	-Wsign-compare \
-	-Wno-abi \
-	-Wno-error=c++0x-compat
-
-### Rules for final target.
-
-LOCAL_LDFLAGS := \
-	-Wl,-z,noexecstack \
-	-fPIC \
-	-Wl,-z,relro \
-	-Wl,-z,now \
-	-fuse-ld=gold \
-	-nostdlib \
-	-Wl,--no-undefined \
-	-Wl,--exclude-libs=ALL \
-	-Wl,--icf=safe \
-	-Wl,-O1 \
-	-Wl,--as-needed \
-	-Wl,--gc-sections
-
-
-LOCAL_STATIC_LIBRARIES := \
-	skia_skia_gyp
-
-# Enable grouping to fix circular references
-LOCAL_GROUP_STATIC_LIBRARIES := true
-
-LOCAL_SHARED_LIBRARIES := \
-	libstlport \
-	libdl
-
-# Add target alias to "gyp_all_modules" target.
-.PHONY: gyp_all_modules
-gyp_all_modules: ppapi_ppapi_host_gyp
-
-# Alias gyp target name.
-.PHONY: ppapi_host
-ppapi_host: ppapi_ppapi_host_gyp
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/ppapi/ppapi_internal.gyp b/ppapi/ppapi_internal.gyp
index 6b27526..dadddab 100644
--- a/ppapi/ppapi_internal.gyp
+++ b/ppapi/ppapi_internal.gyp
@@ -70,6 +70,8 @@
           },
         }],
       ],
+      # Disable c4267 warnings until we fix size_t to int truncations.
+      'msvs_disabled_warnings': [ 4267, ],
     },
   ],
   'conditions': [
@@ -110,6 +112,9 @@
             '../media/media.gyp:shared_memory_support',
             '../ipc/ipc.gyp:ipc',
             '../skia/skia.gyp:skia',
+            '../third_party/icu/icu.gyp:icuuc',
+            # TODO(ananta) : The WebKit dependency needs to move to a new target for NACL.
+            '<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit',
             '../ui/surface/surface.gyp:surface',
             'ppapi.gyp:ppapi_c',
             'ppapi_shared',
@@ -120,6 +125,8 @@
                 '..',
             ],
           },
+          # Disable c4267 warnings until we fix size_t to int truncations.
+          'msvs_disabled_warnings': [ 4267, ],
         },
       ],
     },
@@ -143,6 +150,9 @@
             '../media/media.gyp:shared_memory_support',
             '../ipc/ipc.gyp:ipc',
             '../skia/skia.gyp:skia',
+            '../third_party/icu/icu.gyp:icuuc',
+            # TODO(ananta) : The WebKit dependency needs to move to a new target for NACL.
+            '<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit',
             '../ui/surface/surface.gyp:surface',
             'ppapi.gyp:ppapi_c',
             'ppapi_shared',
@@ -152,6 +162,8 @@
                 '..',
             ],
           },
+          # Disable c4267 warnings until we fix size_t to int truncations.
+          'msvs_disabled_warnings': [ 4267, ],
         },
         {
           # In component build, this is just a phony target that makes sure
@@ -165,7 +177,7 @@
         },
       ],
     }],
-    ['disable_nacl!=1 and OS=="win"', {
+    ['disable_nacl!=1 and OS=="win" and target_arch=="ia32"', {
       # In windows builds, we also want to define some targets to build in
       # 64-bit mode for use by nacl64.exe (the NaCl helper process for 64-bit
       # Windows).
diff --git a/ppapi/ppapi_ipc.gypi b/ppapi/ppapi_ipc.gypi
index 8c23bf2..616d8e5 100644
--- a/ppapi/ppapi_ipc.gypi
+++ b/ppapi/ppapi_ipc.gypi
@@ -12,8 +12,8 @@
       # This part is shared between the targets defined below.
       ['ppapi_ipc_target==1', {
         'sources': [
-          'proxy/pepper_file_messages.cc',
-          'proxy/pepper_file_messages.h',
+          'proxy/handle_converter.cc',
+          'proxy/handle_converter.h',
           'proxy/ppapi_messages.cc',
           'proxy/ppapi_messages.h',
           'proxy/ppapi_param_traits.cc',
@@ -22,6 +22,8 @@
           'proxy/resource_message_params.h',
           'proxy/serialized_flash_menu.cc',
           'proxy/serialized_flash_menu.h',
+          'proxy/serialized_handle.cc',
+          'proxy/serialized_handle.h',
           'proxy/serialized_structs.cc',
           'proxy/serialized_structs.h',
           'proxy/serialized_var.cc',
diff --git a/ppapi/ppapi_ipc.target.mk b/ppapi/ppapi_ipc.target.mk
deleted file mode 100644
index 74a95a9..0000000
--- a/ppapi/ppapi_ipc.target.mk
+++ /dev/null
@@ -1,186 +0,0 @@
-# This file is generated by gyp; do not edit.
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-LOCAL_MODULE := ppapi_ppapi_ipc_gyp
-LOCAL_MODULE_SUFFIX := .a
-LOCAL_MODULE_TAGS := optional
-gyp_intermediate_dir := $(call local-intermediates-dir)
-gyp_shared_intermediate_dir := $(call intermediates-dir-for,GYP,shared)
-
-# Make sure our deps are built first.
-GYP_TARGET_DEPENDENCIES := \
-	$(call intermediates-dir-for,STATIC_LIBRARIES,skia_skia_gyp)/skia_skia_gyp.a \
-	$(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp
-
-GYP_GENERATED_OUTPUTS :=
-
-# Make sure our deps and generated files are built first.
-LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) $(GYP_GENERATED_OUTPUTS)
-
-LOCAL_CPP_EXTENSION := .cc
-LOCAL_GENERATED_SOURCES :=
-
-GYP_COPIED_SOURCE_ORIGIN_DIRS :=
-
-LOCAL_SRC_FILES := \
-	ppapi/proxy/pepper_file_messages.cc \
-	ppapi/proxy/ppapi_messages.cc \
-	ppapi/proxy/ppapi_param_traits.cc \
-	ppapi/proxy/resource_message_params.cc \
-	ppapi/proxy/serialized_flash_menu.cc \
-	ppapi/proxy/serialized_structs.cc \
-	ppapi/proxy/serialized_var.cc
-
-
-# Flags passed to both C and C++ files.
-MY_CFLAGS := \
-	-Werror \
-	-fno-exceptions \
-	-fno-strict-aliasing \
-	-Wall \
-	-Wno-unused-parameter \
-	-Wno-missing-field-initializers \
-	-fvisibility=hidden \
-	-pipe \
-	-fPIC \
-	-mthumb \
-	-march=armv7-a \
-	-mtune=cortex-a8 \
-	-mfloat-abi=softfp \
-	-mfpu=vfpv3-d16 \
-	-fno-tree-sra \
-	-fuse-ld=gold \
-	-Wno-psabi \
-	-mthumb-interwork \
-	-ffunction-sections \
-	-funwind-tables \
-	-g \
-	-fstack-protector \
-	-fno-short-enums \
-	-finline-limit=64 \
-	-Wa,--noexecstack \
-	-Wno-error=extra \
-	-Wno-error=ignored-qualifiers \
-	-Wno-error=type-limits \
-	-Wno-error=non-virtual-dtor \
-	-Wno-error=sign-promo \
-	-Os \
-	-g \
-	-fomit-frame-pointer \
-	-fdata-sections \
-	-ffunction-sections
-
-MY_CFLAGS_C :=
-
-MY_DEFS := \
-	'-D_FILE_OFFSET_BITS=64' \
-	'-DNO_TCMALLOC' \
-	'-DDISABLE_NACL' \
-	'-DCHROMIUM_BUILD' \
-	'-DUSE_LIBJPEG_TURBO=1' \
-	'-DUSE_PROPRIETARY_CODECS' \
-	'-DENABLE_PEPPER_THREADING' \
-	'-DENABLE_GPU=1' \
-	'-DUSE_OPENSSL=1' \
-	'-DENABLE_EGLIMAGE=1' \
-	'-DUSE_SKIA=1' \
-	'-DSK_BUILD_NO_IMAGE_ENCODE' \
-	'-DSK_DEFERRED_CANVAS_USES_GPIPE=1' \
-	'-DGR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"' \
-	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
-	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
-	'-DU_USING_ICU_NAMESPACE=0' \
-	'-DUSE_SYSTEM_ICU' \
-	'-D__STDC_CONSTANT_MACROS' \
-	'-D__STDC_FORMAT_MACROS' \
-	'-DANDROID' \
-	'-D__GNU_SOURCE=1' \
-	'-DUSE_STLPORT=1' \
-	'-D_STLP_USE_PTR_SPECIALIZATIONS=1' \
-	'-DCHROME_SYMBOLS_ID=""' \
-	'-DANDROID_UPSTREAM_BRINGUP=1' \
-	'-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
-	'-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \
-	'-D_DEBUG'
-
-LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS)
-
-# Include paths placed before CFLAGS/CPPFLAGS
-LOCAL_C_INCLUDES := \
-	$(LOCAL_PATH)/third_party/khronos \
-	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/skia/config \
-	$(LOCAL_PATH)/third_party/skia/src/core \
-	$(LOCAL_PATH)/third_party/skia/include/config \
-	$(LOCAL_PATH)/third_party/skia/include/core \
-	$(LOCAL_PATH)/third_party/skia/include/effects \
-	$(LOCAL_PATH)/third_party/skia/include/pdf \
-	$(LOCAL_PATH)/third_party/skia/include/gpu \
-	$(LOCAL_PATH)/third_party/skia/include/gpu/gl \
-	$(LOCAL_PATH)/third_party/skia/include/pipe \
-	$(LOCAL_PATH)/third_party/skia/include/ports \
-	$(LOCAL_PATH)/third_party/skia/include/utils \
-	$(LOCAL_PATH)/skia/ext \
-	$(LOCAL_PATH)/third_party/harfbuzz/contrib \
-	$(LOCAL_PATH)/third_party/harfbuzz/src \
-	$(LOCAL_PATH)/third_party/WebKit/Source/Platform/chromium \
-	$(gyp_shared_intermediate_dir)/webcore_headers \
-	$(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/common \
-	$(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/i18n \
-	$(LOCAL_PATH)/third_party/npapi \
-	$(LOCAL_PATH)/third_party/npapi/bindings \
-	$(LOCAL_PATH)/v8/include \
-	$(GYP_ABS_ANDROID_TOP_DIR)/frameworks/wilhelm/include \
-	$(GYP_ABS_ANDROID_TOP_DIR)/bionic \
-	$(GYP_ABS_ANDROID_TOP_DIR)/external/stlport/stlport
-
-LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES)
-
-# Flags passed to only C++ (and not C) files.
-LOCAL_CPPFLAGS := \
-	-fno-rtti \
-	-fno-threadsafe-statics \
-	-fvisibility-inlines-hidden \
-	-Wsign-compare \
-	-Wno-abi \
-	-Wno-error=c++0x-compat
-
-### Rules for final target.
-
-LOCAL_LDFLAGS := \
-	-Wl,-z,noexecstack \
-	-fPIC \
-	-Wl,-z,relro \
-	-Wl,-z,now \
-	-fuse-ld=gold \
-	-nostdlib \
-	-Wl,--no-undefined \
-	-Wl,--exclude-libs=ALL \
-	-Wl,--icf=safe \
-	-Wl,-O1 \
-	-Wl,--as-needed \
-	-Wl,--gc-sections
-
-
-LOCAL_STATIC_LIBRARIES := \
-	skia_skia_gyp
-
-# Enable grouping to fix circular references
-LOCAL_GROUP_STATIC_LIBRARIES := true
-
-LOCAL_SHARED_LIBRARIES := \
-	libstlport \
-	libdl
-
-# Add target alias to "gyp_all_modules" target.
-.PHONY: gyp_all_modules
-gyp_all_modules: ppapi_ppapi_ipc_gyp
-
-# Alias gyp target name.
-.PHONY: ppapi_ipc
-ppapi_ipc: ppapi_ppapi_ipc_gyp
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/ppapi/ppapi_ipc_untrusted.gyp b/ppapi/ppapi_ipc_untrusted.gyp
index 1f5c3c9..fd55a58 100644
--- a/ppapi/ppapi_ipc_untrusted.gyp
+++ b/ppapi/ppapi_ipc_untrusted.gyp
@@ -24,7 +24,6 @@
             'build_glibc': 0,
             'build_newlib': 1,
             'defines': [
-              'NACL_PPAPI_IPC_PROXY',
               # Enable threading for the untrusted side of the proxy.
               # TODO(bbudge) remove when this is the default.
               'ENABLE_PEPPER_THREADING',
@@ -39,6 +38,7 @@
             '../gpu/gpu_untrusted.gyp:gpu_ipc_untrusted',
             '../ipc/ipc_untrusted.gyp:ipc_untrusted',
             '../ppapi/ppapi_shared_untrusted.gyp:ppapi_shared_untrusted',
+            '../components/tracing_untrusted.gyp:tracing_untrusted',
           ],
         },
       ],
diff --git a/ppapi/ppapi_proxy.gypi b/ppapi/ppapi_proxy.gypi
index 9ad8a62..838bbc6 100644
--- a/ppapi/ppapi_proxy.gypi
+++ b/ppapi/ppapi_proxy.gypi
@@ -23,24 +23,46 @@
           'proxy/audio_input_resource.h',
           'proxy/broker_dispatcher.cc',
           'proxy/broker_dispatcher.h',
+          'proxy/broker_resource.cc',
+          'proxy/broker_resource.h',
+          'proxy/browser_font_resource_trusted.cc',
+          'proxy/browser_font_resource_trusted.h',
+          'proxy/browser_font_singleton_resource.cc',
+          'proxy/browser_font_singleton_resource.h',
           'proxy/connection.h',
+          'proxy/device_enumeration_resource_helper.cc',
+          'proxy/device_enumeration_resource_helper.h',
+          'proxy/directory_reader_resource.cc',
+          'proxy/directory_reader_resource.h',
           'proxy/dispatcher.cc',
           'proxy/dispatcher.h',
           'proxy/enter_proxy.h',
+          'proxy/graphics_2d_resource.cc',
+          'proxy/graphics_2d_resource.h',
           'proxy/file_chooser_resource.cc',
           'proxy/file_chooser_resource.h',
-          'proxy/flash_device_id_resource.cc',
-          'proxy/flash_device_id_resource.h',
-          'proxy/flash_font_file_resource.cc',
-          'proxy/flash_font_file_resource.h',
           'proxy/flash_clipboard_resource.cc',
           'proxy/flash_clipboard_resource.h',
+          'proxy/flash_device_id_resource.cc',
+          'proxy/flash_device_id_resource.h',
+          'proxy/flash_file_resource.cc',
+          'proxy/flash_file_resource.h',
+          'proxy/flash_font_file_resource.cc',
+          'proxy/flash_font_file_resource.h',
+          'proxy/flash_fullscreen_resource.cc',
+          'proxy/flash_fullscreen_resource.h',
+          'proxy/flash_menu_resource.cc',
+          'proxy/flash_menu_resource.h',
           'proxy/flash_resource.cc',
           'proxy/flash_resource.h',
+          'proxy/file_io_resource.cc',
+          'proxy/file_io_resource.h',
           'proxy/gamepad_resource.cc',
           'proxy/gamepad_resource.h',
           'proxy/host_dispatcher.cc',
           'proxy/host_dispatcher.h',
+          'proxy/host_resolver_private_resource.cc',
+          'proxy/host_resolver_private_resource.h',
           'proxy/host_var_serialization_rules.cc',
           'proxy/host_var_serialization_rules.h',
           'proxy/interface_list.cc',
@@ -66,6 +88,7 @@
           'proxy/plugin_var_tracker.h',
           'proxy/ppapi_command_buffer_proxy.h',
           'proxy/ppapi_command_buffer_proxy.cc',
+          'proxy/ppapi_messages.h',
           'proxy/ppapi_message_utils.h',
           'proxy/ppb_audio_proxy.cc',
           'proxy/ppb_audio_proxy.h',
@@ -75,24 +98,14 @@
           'proxy/ppb_buffer_proxy.h',
           'proxy/ppb_core_proxy.cc',
           'proxy/ppb_core_proxy.h',
-          'proxy/ppb_file_io_proxy.cc',
-          'proxy/ppb_file_io_proxy.h',
           'proxy/ppb_file_ref_proxy.cc',
           'proxy/ppb_file_ref_proxy.h',
           'proxy/ppb_file_system_proxy.cc',
           'proxy/ppb_file_system_proxy.h',
-          'proxy/ppb_flash_proxy.cc',
-          'proxy/ppb_flash_proxy.h',
-          'proxy/ppb_flash_menu_proxy.cc',
-          'proxy/ppb_flash_menu_proxy.h',
           'proxy/ppb_flash_message_loop_proxy.cc',
           'proxy/ppb_flash_message_loop_proxy.h',
-          'proxy/ppb_graphics_2d_proxy.cc',
-          'proxy/ppb_graphics_2d_proxy.h',
           'proxy/ppb_graphics_3d_proxy.cc',
           'proxy/ppb_graphics_3d_proxy.h',
-          'proxy/ppb_host_resolver_private_proxy.cc',
-          'proxy/ppb_host_resolver_private_proxy.h',
           'proxy/ppb_image_data_proxy.cc',
           'proxy/ppb_image_data_proxy.h',
           'proxy/ppb_instance_proxy.cc',
@@ -101,26 +114,16 @@
           'proxy/ppb_message_loop_proxy.h',
           'proxy/ppb_network_monitor_private_proxy.cc',
           'proxy/ppb_network_monitor_private_proxy.h',
-          'proxy/ppb_pdf_proxy.cc',
-          'proxy/ppb_pdf_proxy.h',
-          'proxy/ppb_talk_private_proxy.cc',
-          'proxy/ppb_talk_private_proxy.h',
           'proxy/ppb_tcp_server_socket_private_proxy.cc',
           'proxy/ppb_tcp_server_socket_private_proxy.h',
           'proxy/ppb_tcp_socket_private_proxy.cc',
           'proxy/ppb_tcp_socket_private_proxy.h',
           'proxy/ppb_testing_proxy.cc',
           'proxy/ppb_testing_proxy.h',
-          'proxy/ppb_udp_socket_private_proxy.cc',
-          'proxy/ppb_udp_socket_private_proxy.h',
           'proxy/ppb_url_loader_proxy.cc',
           'proxy/ppb_url_loader_proxy.h',
-          'proxy/ppb_url_response_info_proxy.cc',
-          'proxy/ppb_url_response_info_proxy.h',
           'proxy/ppb_var_deprecated_proxy.cc',
           'proxy/ppb_var_deprecated_proxy.h',
-          'proxy/ppb_video_capture_proxy.cc',
-          'proxy/ppb_video_capture_proxy.h',
           'proxy/ppb_video_decoder_proxy.cc',
           'proxy/ppb_video_decoder_proxy.h',
           'proxy/ppb_x509_certificate_private_proxy.cc',
@@ -160,9 +163,21 @@
           'proxy/proxy_object_var.h',
           'proxy/resource_creation_proxy.cc',
           'proxy/resource_creation_proxy.h',
+          'proxy/talk_resource.cc',
+          'proxy/talk_resource.h',
+          'proxy/truetype_font_resource.cc',
+          'proxy/truetype_font_resource.h',
+          'proxy/truetype_font_singleton_resource.cc',
+          'proxy/truetype_font_singleton_resource.h',
+          'proxy/udp_socket_private_resource.cc',
+          'proxy/udp_socket_private_resource.h',
           'proxy/url_request_info_resource.cc',
           'proxy/url_request_info_resource.h',
+          'proxy/url_response_info_resource.cc',
+          'proxy/url_response_info_resource.h',
           'proxy/var_serialization_rules.h',
+          'proxy/video_capture_resource.cc',
+          'proxy/video_capture_resource.h',
           'proxy/websocket_resource.cc',
           'proxy/websocket_resource.h',
         ],
@@ -177,14 +192,20 @@
             'sources!': [
               'proxy/audio_input_resource.cc',
               'proxy/broker_dispatcher.cc',
-              'proxy/flash_device_id_resource.cc',
-              'proxy/flash_font_file_resource.cc',
+              'proxy/browser_font_resource_trusted.cc',
+              'proxy/browser_font_singleton_resource.cc',
+              'proxy/device_enumeration_resource_helper.cc',
               'proxy/flash_clipboard_resource.cc',
+              'proxy/flash_device_id_resource.cc',
+              'proxy/flash_file_resource.cc',
+              'proxy/flash_font_file_resource.cc',
+              'proxy/flash_fullscreen_resource.cc',
+              'proxy/flash_menu_resource.cc',
               'proxy/flash_resource.cc',
+              'proxy/host_dispatcher.cc',
+              'proxy/host_var_serialization_rules.cc',
               'proxy/ppb_broker_proxy.cc',
               'proxy/ppb_buffer_proxy.cc',
-              'proxy/ppb_file_chooser_proxy.cc',
-              'proxy/ppb_flash_menu_proxy.cc',
               'proxy/ppb_flash_message_loop_proxy.cc',
               'proxy/ppb_flash_proxy.cc',
               'proxy/ppb_pdf_proxy.cc',
@@ -194,6 +215,9 @@
               'proxy/ppp_content_decryptor_private_proxy.cc',
               'proxy/ppp_instance_private_proxy.cc',
               'proxy/ppp_video_decoder_proxy.cc',
+              'proxy/serialized_flash_menu.cc',
+              'proxy/talk_resource.cc',
+              'proxy/video_capture_resource.cc',
             ],
           }],
         ],
diff --git a/ppapi/ppapi_proxy.target.mk b/ppapi/ppapi_proxy.target.mk
deleted file mode 100644
index bda30d5..0000000
--- a/ppapi/ppapi_proxy.target.mk
+++ /dev/null
@@ -1,250 +0,0 @@
-# This file is generated by gyp; do not edit.
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-LOCAL_MODULE := ppapi_ppapi_proxy_gyp
-LOCAL_MODULE_SUFFIX := .a
-LOCAL_MODULE_TAGS := optional
-gyp_intermediate_dir := $(call local-intermediates-dir)
-gyp_shared_intermediate_dir := $(call intermediates-dir-for,GYP,shared)
-
-# Make sure our deps are built first.
-GYP_TARGET_DEPENDENCIES := \
-	$(call intermediates-dir-for,STATIC_LIBRARIES,skia_skia_gyp)/skia_skia_gyp.a \
-	$(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp
-
-GYP_GENERATED_OUTPUTS :=
-
-# Make sure our deps and generated files are built first.
-LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) $(GYP_GENERATED_OUTPUTS)
-
-LOCAL_CPP_EXTENSION := .cc
-LOCAL_GENERATED_SOURCES :=
-
-GYP_COPIED_SOURCE_ORIGIN_DIRS :=
-
-LOCAL_SRC_FILES := \
-	ppapi/proxy/audio_input_resource.cc \
-	ppapi/proxy/broker_dispatcher.cc \
-	ppapi/proxy/dispatcher.cc \
-	ppapi/proxy/file_chooser_resource.cc \
-	ppapi/proxy/flash_device_id_resource.cc \
-	ppapi/proxy/flash_font_file_resource.cc \
-	ppapi/proxy/flash_clipboard_resource.cc \
-	ppapi/proxy/flash_resource.cc \
-	ppapi/proxy/gamepad_resource.cc \
-	ppapi/proxy/host_dispatcher.cc \
-	ppapi/proxy/host_var_serialization_rules.cc \
-	ppapi/proxy/interface_list.cc \
-	ppapi/proxy/interface_proxy.cc \
-	ppapi/proxy/plugin_array_buffer_var.cc \
-	ppapi/proxy/plugin_dispatcher.cc \
-	ppapi/proxy/plugin_globals.cc \
-	ppapi/proxy/plugin_message_filter.cc \
-	ppapi/proxy/plugin_resource.cc \
-	ppapi/proxy/plugin_resource_tracker.cc \
-	ppapi/proxy/plugin_var_serialization_rules.cc \
-	ppapi/proxy/plugin_var_tracker.cc \
-	ppapi/proxy/ppapi_command_buffer_proxy.cc \
-	ppapi/proxy/ppb_audio_proxy.cc \
-	ppapi/proxy/ppb_broker_proxy.cc \
-	ppapi/proxy/ppb_buffer_proxy.cc \
-	ppapi/proxy/ppb_core_proxy.cc \
-	ppapi/proxy/ppb_file_io_proxy.cc \
-	ppapi/proxy/ppb_file_ref_proxy.cc \
-	ppapi/proxy/ppb_file_system_proxy.cc \
-	ppapi/proxy/ppb_flash_proxy.cc \
-	ppapi/proxy/ppb_flash_menu_proxy.cc \
-	ppapi/proxy/ppb_flash_message_loop_proxy.cc \
-	ppapi/proxy/ppb_graphics_2d_proxy.cc \
-	ppapi/proxy/ppb_graphics_3d_proxy.cc \
-	ppapi/proxy/ppb_host_resolver_private_proxy.cc \
-	ppapi/proxy/ppb_image_data_proxy.cc \
-	ppapi/proxy/ppb_instance_proxy.cc \
-	ppapi/proxy/ppb_message_loop_proxy.cc \
-	ppapi/proxy/ppb_network_monitor_private_proxy.cc \
-	ppapi/proxy/ppb_pdf_proxy.cc \
-	ppapi/proxy/ppb_talk_private_proxy.cc \
-	ppapi/proxy/ppb_tcp_server_socket_private_proxy.cc \
-	ppapi/proxy/ppb_tcp_socket_private_proxy.cc \
-	ppapi/proxy/ppb_testing_proxy.cc \
-	ppapi/proxy/ppb_udp_socket_private_proxy.cc \
-	ppapi/proxy/ppb_url_loader_proxy.cc \
-	ppapi/proxy/ppb_url_response_info_proxy.cc \
-	ppapi/proxy/ppb_var_deprecated_proxy.cc \
-	ppapi/proxy/ppb_video_capture_proxy.cc \
-	ppapi/proxy/ppb_video_decoder_proxy.cc \
-	ppapi/proxy/ppb_x509_certificate_private_proxy.cc \
-	ppapi/proxy/ppp_class_proxy.cc \
-	ppapi/proxy/ppp_content_decryptor_private_proxy.cc \
-	ppapi/proxy/ppp_graphics_3d_proxy.cc \
-	ppapi/proxy/ppp_input_event_proxy.cc \
-	ppapi/proxy/ppp_instance_private_proxy.cc \
-	ppapi/proxy/ppp_instance_proxy.cc \
-	ppapi/proxy/ppp_messaging_proxy.cc \
-	ppapi/proxy/ppp_mouse_lock_proxy.cc \
-	ppapi/proxy/ppp_printing_proxy.cc \
-	ppapi/proxy/ppp_text_input_proxy.cc \
-	ppapi/proxy/ppp_video_decoder_proxy.cc \
-	ppapi/proxy/printing_resource.cc \
-	ppapi/proxy/proxy_array_output.cc \
-	ppapi/proxy/proxy_channel.cc \
-	ppapi/proxy/proxy_module.cc \
-	ppapi/proxy/proxy_object_var.cc \
-	ppapi/proxy/resource_creation_proxy.cc \
-	ppapi/proxy/url_request_info_resource.cc \
-	ppapi/proxy/websocket_resource.cc
-
-
-# Flags passed to both C and C++ files.
-MY_CFLAGS := \
-	-Werror \
-	-fno-exceptions \
-	-fno-strict-aliasing \
-	-Wall \
-	-Wno-unused-parameter \
-	-Wno-missing-field-initializers \
-	-fvisibility=hidden \
-	-pipe \
-	-fPIC \
-	-mthumb \
-	-march=armv7-a \
-	-mtune=cortex-a8 \
-	-mfloat-abi=softfp \
-	-mfpu=vfpv3-d16 \
-	-fno-tree-sra \
-	-fuse-ld=gold \
-	-Wno-psabi \
-	-mthumb-interwork \
-	-ffunction-sections \
-	-funwind-tables \
-	-g \
-	-fstack-protector \
-	-fno-short-enums \
-	-finline-limit=64 \
-	-Wa,--noexecstack \
-	-Wno-error=extra \
-	-Wno-error=ignored-qualifiers \
-	-Wno-error=type-limits \
-	-Wno-error=non-virtual-dtor \
-	-Wno-error=sign-promo \
-	-Os \
-	-g \
-	-fomit-frame-pointer \
-	-fdata-sections \
-	-ffunction-sections
-
-MY_CFLAGS_C :=
-
-MY_DEFS := \
-	'-D_FILE_OFFSET_BITS=64' \
-	'-DNO_TCMALLOC' \
-	'-DDISABLE_NACL' \
-	'-DCHROMIUM_BUILD' \
-	'-DUSE_LIBJPEG_TURBO=1' \
-	'-DUSE_PROPRIETARY_CODECS' \
-	'-DENABLE_PEPPER_THREADING' \
-	'-DENABLE_GPU=1' \
-	'-DUSE_OPENSSL=1' \
-	'-DENABLE_EGLIMAGE=1' \
-	'-DUSE_SKIA=1' \
-	'-DSK_BUILD_NO_IMAGE_ENCODE' \
-	'-DSK_DEFERRED_CANVAS_USES_GPIPE=1' \
-	'-DGR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"' \
-	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
-	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
-	'-DU_USING_ICU_NAMESPACE=0' \
-	'-DUSE_SYSTEM_ICU' \
-	'-D__STDC_CONSTANT_MACROS' \
-	'-D__STDC_FORMAT_MACROS' \
-	'-DPPAPI_PROXY_IMPLEMENTATION' \
-	'-DANDROID' \
-	'-D__GNU_SOURCE=1' \
-	'-DUSE_STLPORT=1' \
-	'-D_STLP_USE_PTR_SPECIALIZATIONS=1' \
-	'-DCHROME_SYMBOLS_ID=""' \
-	'-DANDROID_UPSTREAM_BRINGUP=1' \
-	'-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
-	'-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \
-	'-D_DEBUG'
-
-LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS)
-
-# Include paths placed before CFLAGS/CPPFLAGS
-LOCAL_C_INCLUDES := \
-	$(LOCAL_PATH)/third_party/khronos \
-	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/skia/config \
-	$(LOCAL_PATH)/third_party/skia/src/core \
-	$(LOCAL_PATH)/third_party/skia/include/config \
-	$(LOCAL_PATH)/third_party/skia/include/core \
-	$(LOCAL_PATH)/third_party/skia/include/effects \
-	$(LOCAL_PATH)/third_party/skia/include/pdf \
-	$(LOCAL_PATH)/third_party/skia/include/gpu \
-	$(LOCAL_PATH)/third_party/skia/include/gpu/gl \
-	$(LOCAL_PATH)/third_party/skia/include/pipe \
-	$(LOCAL_PATH)/third_party/skia/include/ports \
-	$(LOCAL_PATH)/third_party/skia/include/utils \
-	$(LOCAL_PATH)/skia/ext \
-	$(LOCAL_PATH)/third_party/harfbuzz/contrib \
-	$(LOCAL_PATH)/third_party/harfbuzz/src \
-	$(LOCAL_PATH)/third_party/WebKit/Source/Platform/chromium \
-	$(gyp_shared_intermediate_dir)/webcore_headers \
-	$(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/common \
-	$(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/i18n \
-	$(LOCAL_PATH)/third_party/npapi \
-	$(LOCAL_PATH)/third_party/npapi/bindings \
-	$(LOCAL_PATH)/v8/include \
-	$(GYP_ABS_ANDROID_TOP_DIR)/frameworks/wilhelm/include \
-	$(GYP_ABS_ANDROID_TOP_DIR)/bionic \
-	$(GYP_ABS_ANDROID_TOP_DIR)/external/stlport/stlport
-
-LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES)
-
-# Flags passed to only C++ (and not C) files.
-LOCAL_CPPFLAGS := \
-	-fno-rtti \
-	-fno-threadsafe-statics \
-	-fvisibility-inlines-hidden \
-	-Wsign-compare \
-	-Wno-abi \
-	-Wno-error=c++0x-compat
-
-### Rules for final target.
-
-LOCAL_LDFLAGS := \
-	-Wl,-z,noexecstack \
-	-fPIC \
-	-Wl,-z,relro \
-	-Wl,-z,now \
-	-fuse-ld=gold \
-	-nostdlib \
-	-Wl,--no-undefined \
-	-Wl,--exclude-libs=ALL \
-	-Wl,--icf=safe \
-	-Wl,-O1 \
-	-Wl,--as-needed \
-	-Wl,--gc-sections
-
-
-LOCAL_STATIC_LIBRARIES := \
-	skia_skia_gyp
-
-# Enable grouping to fix circular references
-LOCAL_GROUP_STATIC_LIBRARIES := true
-
-LOCAL_SHARED_LIBRARIES := \
-	libstlport \
-	libdl
-
-# Add target alias to "gyp_all_modules" target.
-.PHONY: gyp_all_modules
-gyp_all_modules: ppapi_ppapi_proxy_gyp
-
-# Alias gyp target name.
-.PHONY: ppapi_proxy
-ppapi_proxy: ppapi_ppapi_proxy_gyp
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/ppapi/ppapi_ipc_proxy_untrusted.gyp b/ppapi/ppapi_proxy_untrusted.gyp
similarity index 80%
rename from ppapi/ppapi_ipc_proxy_untrusted.gyp
rename to ppapi/ppapi_proxy_untrusted.gyp
index d2f7fa2..49fae82 100644
--- a/ppapi/ppapi_ipc_proxy_untrusted.gyp
+++ b/ppapi/ppapi_proxy_untrusted.gyp
@@ -2,11 +2,6 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-# This file is named ppapi_ipc_proxy_untrusted.gyp instead of
-# ppapi_proxy_untrusted.gyp, because there is already a file with that name in
-# ppapi/native_client/src/shared/ppapi_proxy. This causes problems on Mac when
-# generating for XCode. TODO(dmichael): This file should probably be renamed to
-# ppapi_proxy_untrusted.gyp when we remove the SRPC NaCl proxy.
 {
   'variables': {
     'chromium_code': 1,
@@ -28,7 +23,6 @@
             'build_glibc': 0,
             'build_newlib': 1,
             'defines': [
-              'NACL_PPAPI_IPC_PROXY',
               # Enable threading for the untrusted side of the proxy.
               # TODO(bbudge) remove when this is the default.
               'ENABLE_PEPPER_THREADING',
@@ -36,7 +30,6 @@
           },
           'include_dirs': [
             '..',
-            '../third_party/khronos',
           ],
           'dependencies': [
             '../native_client/tools.gyp:prep_toolchain',
@@ -50,6 +43,8 @@
             '../ipc/ipc_untrusted.gyp:ipc_untrusted',
             '../ppapi/ppapi_shared_untrusted.gyp:ppapi_shared_untrusted',
             '../ppapi/ppapi_ipc_untrusted.gyp:ppapi_ipc_untrusted',
+            '../third_party/khronos/khronos.gyp:khronos_headers',
+            '../components/tracing_untrusted.gyp:tracing_untrusted',
           ],
         },
       ],
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi
index 73c73f9..3b81c00 100644
--- a/ppapi/ppapi_shared.gypi
+++ b/ppapi/ppapi_shared.gypi
@@ -20,10 +20,16 @@
       # This part is shared between the targets defined below.
       ['ppapi_shared_target==1', {
         'sources': [
+          'shared_impl/array_var.cc',
+          'shared_impl/array_var.h',
           'shared_impl/array_writer.cc',
           'shared_impl/array_writer.h',
           'shared_impl/callback_tracker.cc',
           'shared_impl/callback_tracker.h',
+          'shared_impl/dictionary_var.cc',
+          'shared_impl/dictionary_var.h',
+          'shared_impl/file_io_state_manager.cc',
+          'shared_impl/file_io_state_manager.h',
           'shared_impl/file_path.cc',
           'shared_impl/file_path.h',
           'shared_impl/file_type_conversion.cc',
@@ -51,12 +57,8 @@
           'shared_impl/ppb_crypto_shared.cc',
           'shared_impl/ppb_device_ref_shared.cc',
           'shared_impl/ppb_device_ref_shared.h',
-          'shared_impl/ppb_file_io_shared.cc',
-          'shared_impl/ppb_file_io_shared.h',
           'shared_impl/ppb_file_ref_shared.cc',
           'shared_impl/ppb_file_ref_shared.h',
-          'shared_impl/ppb_flash_shared.cc',
-          'shared_impl/ppb_flash_shared.h',
           'shared_impl/ppb_gamepad_shared.cc',
           'shared_impl/ppb_gamepad_shared.h',
           'shared_impl/ppb_graphics_3d_shared.cc',
@@ -76,14 +78,14 @@
           'shared_impl/ppb_opengles2_shared.h',
           'shared_impl/ppb_resource_array_shared.cc',
           'shared_impl/ppb_resource_array_shared.h',
+          'shared_impl/ppb_trace_event_impl.cc',
+          'shared_impl/ppb_trace_event_impl.h',
           'shared_impl/ppb_url_util_shared.cc',
           'shared_impl/ppb_url_util_shared.h',
           'shared_impl/ppb_var_shared.cc',
           'shared_impl/ppb_var_shared.h',
           'shared_impl/ppb_video_decoder_shared.cc',
           'shared_impl/ppb_video_decoder_shared.h',
-          'shared_impl/ppb_video_capture_shared.cc',
-          'shared_impl/ppb_video_capture_shared.h',
           'shared_impl/ppb_view_shared.cc',
           'shared_impl/ppb_view_shared.h',
           'shared_impl/ppp_flash_browser_operations_shared.h',
@@ -99,34 +101,34 @@
           'shared_impl/scoped_pp_resource.h',
           'shared_impl/scoped_pp_var.cc',
           'shared_impl/scoped_pp_var.h',
+          'shared_impl/thread_aware_callback.cc',
+          'shared_impl/thread_aware_callback.h',
           'shared_impl/time_conversion.cc',
           'shared_impl/time_conversion.h',
           'shared_impl/tracked_callback.cc',
           'shared_impl/tracked_callback.h',
           'shared_impl/url_request_info_data.cc',
           'shared_impl/url_request_info_data.h',
+          'shared_impl/url_response_info_data.cc',
+          'shared_impl/url_response_info_data.h',
           'shared_impl/var.cc',
           'shared_impl/var.h',
           'shared_impl/var_tracker.cc',
           'shared_impl/var_tracker.h',
+          'shared_impl/var_value_conversions.cc',
+          'shared_impl/var_value_conversions.h',
           # TODO(viettrungluu): Split these out; it won't be used in NaCl.
           'shared_impl/private/net_address_private_impl.cc',
           'shared_impl/private/net_address_private_impl.h',
 
-          'shared_impl/private/ppb_browser_font_trusted_shared.cc',
-          'shared_impl/private/ppb_browser_font_trusted_shared.h',
           'shared_impl/private/ppb_char_set_shared.cc',
           'shared_impl/private/ppb_char_set_shared.h',
-          'shared_impl/private/ppb_host_resolver_shared.cc',
-          'shared_impl/private/ppb_host_resolver_shared.h',
           'shared_impl/private/ppb_tcp_server_socket_shared.cc',
           'shared_impl/private/ppb_tcp_server_socket_shared.h',
           'shared_impl/private/ppb_x509_certificate_private_shared.cc',
           'shared_impl/private/ppb_x509_certificate_private_shared.h',
           'shared_impl/private/tcp_socket_private_impl.cc',
           'shared_impl/private/tcp_socket_private_impl.h',
-          'shared_impl/private/udp_socket_private_impl.cc',
-          'shared_impl/private/udp_socket_private_impl.h',
 
           'thunk/enter.cc',
           'thunk/enter.h',
@@ -134,7 +136,7 @@
           'thunk/ppb_audio_config_api.h',
           'thunk/ppb_audio_config_thunk.cc',
           'thunk/ppb_audio_input_api.h',
-          'thunk/ppb_audio_input_thunk.cc',
+          'thunk/ppb_audio_input_dev_thunk.cc',
           'thunk/ppb_audio_thunk.cc',
           'thunk/ppb_audio_trusted_thunk.cc',
           'thunk/ppb_broker_api.h',
@@ -143,14 +145,13 @@
           'thunk/ppb_browser_font_trusted_thunk.cc',
           'thunk/ppb_buffer_api.h',
           'thunk/ppb_buffer_thunk.cc',
-          'thunk/ppb_buffer_trusted_api.h',
           'thunk/ppb_buffer_trusted_thunk.cc',
           'thunk/ppb_char_set_thunk.cc',
           'thunk/ppb_console_thunk.cc',
           'thunk/ppb_content_decryptor_private_thunk.cc',
           'thunk/ppb_cursor_control_thunk.cc',
           'thunk/ppb_device_ref_api.h',
-          'thunk/ppb_device_ref_thunk.cc',
+          'thunk/ppb_device_ref_dev_thunk.cc',
           'thunk/ppb_directory_reader_api.h',
           'thunk/ppb_directory_reader_thunk.cc',
           'thunk/ppb_file_chooser_api.h',
@@ -162,8 +163,8 @@
           'thunk/ppb_file_ref_thunk.cc',
           'thunk/ppb_file_system_api.h',
           'thunk/ppb_file_system_thunk.cc',
-          'thunk/ppb_find_thunk.cc',
-          'thunk/ppb_flash_api.h',
+          'thunk/ppb_find_dev_thunk.cc',
+          'thunk/ppb_flash_clipboard_api.h',
           'thunk/ppb_flash_clipboard_thunk.cc',
           'thunk/ppb_flash_device_id_api.h',
           'thunk/ppb_flash_device_id_thunk.cc',
@@ -171,12 +172,14 @@
           'thunk/ppb_flash_file_modulelocal_thunk.cc',
           'thunk/ppb_flash_font_file_api.h',
           'thunk/ppb_flash_font_file_thunk.cc',
+          'thunk/ppb_flash_fullscreen_api.h',
           'thunk/ppb_flash_fullscreen_thunk.cc',
           'thunk/ppb_flash_functions_api.h',
           'thunk/ppb_flash_menu_api.h',
           'thunk/ppb_flash_menu_thunk.cc',
           'thunk/ppb_flash_message_loop_api.h',
           'thunk/ppb_flash_message_loop_thunk.cc',
+          'thunk/ppb_flash_print_thunk.cc',
           'thunk/ppb_flash_thunk.cc',
           'thunk/ppb_fullscreen_thunk.cc',
           'thunk/ppb_gamepad_api.h',
@@ -195,6 +198,7 @@
           'thunk/ppb_input_event_api.h',
           'thunk/ppb_input_event_thunk.cc',
           'thunk/ppb_instance_api.h',
+          'thunk/ppb_instance_private_thunk.cc',
           'thunk/ppb_instance_thunk.cc',
           'thunk/ppb_message_loop_api.h',
           'thunk/ppb_messaging_thunk.cc',
@@ -205,10 +209,11 @@
           'thunk/ppb_network_monitor_private_api.h',
           'thunk/ppb_network_monitor_private_thunk.cc',
           'thunk/ppb_pdf_api.h',
+          'thunk/ppb_pdf_thunk.cc',
           'thunk/ppb_printing_api.h',
           'thunk/ppb_printing_thunk.cc',
           'thunk/ppb_resource_array_api.h',
-          'thunk/ppb_resource_array_thunk.cc',
+          'thunk/ppb_resource_array_dev_thunk.cc',
           'thunk/ppb_scrollbar_api.h',
           'thunk/ppb_scrollbar_thunk.cc',
           'thunk/ppb_talk_private_api.h',
@@ -218,6 +223,9 @@
           'thunk/ppb_tcp_socket_private_api.h',
           'thunk/ppb_tcp_socket_private_thunk.cc',
           'thunk/ppb_text_input_thunk.cc',
+          'thunk/ppb_truetype_font_api.h',
+          'thunk/ppb_truetype_font_singleton_api.h',
+          'thunk/ppb_truetype_font_thunk.cc',
           'thunk/ppb_udp_socket_private_api.h',
           'thunk/ppb_udp_socket_private_thunk.cc',
           'thunk/ppb_url_loader_api.h',
@@ -227,16 +235,19 @@
           'thunk/ppb_url_response_info_api.h',
           'thunk/ppb_url_response_info_thunk.cc',
           'thunk/ppb_url_util_thunk.cc',
+          'thunk/ppb_var_array_thunk.cc',
+          'thunk/ppb_var_dictionary_thunk.cc',
           'thunk/ppb_video_capture_api.h',
           'thunk/ppb_video_capture_thunk.cc',
           'thunk/ppb_video_decoder_api.h',
           'thunk/ppb_video_decoder_thunk.cc',
           'thunk/ppb_view_api.h',
+          'thunk/ppb_view_dev_thunk.cc',
           'thunk/ppb_view_thunk.cc',
           'thunk/ppb_websocket_api.h',
           'thunk/ppb_websocket_thunk.cc',
           'thunk/ppb_widget_api.h',
-          'thunk/ppb_widget_thunk.cc',
+          'thunk/ppb_widget_dev_thunk.cc',
           'thunk/ppb_x509_certificate_private_api.h',
           'thunk/ppb_x509_certificate_private_thunk.cc',
           'thunk/ppb_zoom_thunk.cc',
@@ -258,7 +269,7 @@
               'shared_impl/ppb_video_capture_shared.cc',
               'shared_impl/private/ppb_browser_font_trusted_shared.cc',
               'shared_impl/private/ppb_char_set_shared.cc',
-              'thunk/ppb_audio_input_thunk.cc',
+              'thunk/ppb_audio_input_dev_thunk.cc',
               'thunk/ppb_audio_trusted_thunk.cc',
               'thunk/ppb_broker_thunk.cc',
               'thunk/ppb_browser_font_trusted_thunk.cc',
@@ -267,7 +278,6 @@
               'thunk/ppb_content_decryptor_private_thunk.cc',
               'thunk/ppb_char_set_thunk.cc',
               'thunk/ppb_directory_reader_thunk.cc',
-              'thunk/ppb_file_chooser_thunk.cc',
               'thunk/ppb_file_io_trusted_thunk.cc',
               'thunk/ppb_flash_clipboard_thunk.cc',
               'thunk/ppb_flash_device_id_thunk.cc',
@@ -282,7 +292,6 @@
               'thunk/ppb_gles_chromium_texture_mapping_thunk.cc',
               'thunk/ppb_graphics_3d_trusted_thunk.cc',
               'thunk/ppb_image_data_trusted_thunk.cc',
-              'thunk/ppb_printing_thunk.cc',
               'thunk/ppb_scrollbar_thunk.cc',
               'thunk/ppb_talk_private_thunk.cc',
               'thunk/ppb_transport_thunk.cc',
diff --git a/ppapi/ppapi_shared.target.mk b/ppapi/ppapi_shared.target.linux-arm.mk
similarity index 86%
rename from ppapi/ppapi_shared.target.mk
rename to ppapi/ppapi_shared.target.linux-arm.mk
index 1d3f3bf..cc0e0fa 100644
--- a/ppapi/ppapi_shared.target.mk
+++ b/ppapi/ppapi_shared.target.linux-arm.mk
@@ -26,8 +26,11 @@
 GYP_COPIED_SOURCE_ORIGIN_DIRS :=
 
 LOCAL_SRC_FILES := \
+	ppapi/shared_impl/array_var.cc \
 	ppapi/shared_impl/array_writer.cc \
 	ppapi/shared_impl/callback_tracker.cc \
+	ppapi/shared_impl/dictionary_var.cc \
+	ppapi/shared_impl/file_io_state_manager.cc \
 	ppapi/shared_impl/file_path.cc \
 	ppapi/shared_impl/file_type_conversion.cc \
 	ppapi/shared_impl/flash_clipboard_format_registry.cc \
@@ -42,9 +45,7 @@
 	ppapi/shared_impl/ppb_audio_shared.cc \
 	ppapi/shared_impl/ppb_crypto_shared.cc \
 	ppapi/shared_impl/ppb_device_ref_shared.cc \
-	ppapi/shared_impl/ppb_file_io_shared.cc \
 	ppapi/shared_impl/ppb_file_ref_shared.cc \
-	ppapi/shared_impl/ppb_flash_shared.cc \
 	ppapi/shared_impl/ppb_gamepad_shared.cc \
 	ppapi/shared_impl/ppb_graphics_3d_shared.cc \
 	ppapi/shared_impl/ppb_image_data_shared.cc \
@@ -55,10 +56,10 @@
 	ppapi/shared_impl/ppb_network_list_private_shared.cc \
 	ppapi/shared_impl/ppb_opengles2_shared.cc \
 	ppapi/shared_impl/ppb_resource_array_shared.cc \
+	ppapi/shared_impl/ppb_trace_event_impl.cc \
 	ppapi/shared_impl/ppb_url_util_shared.cc \
 	ppapi/shared_impl/ppb_var_shared.cc \
 	ppapi/shared_impl/ppb_video_decoder_shared.cc \
-	ppapi/shared_impl/ppb_video_capture_shared.cc \
 	ppapi/shared_impl/ppb_view_shared.cc \
 	ppapi/shared_impl/ppp_instance_combined.cc \
 	ppapi/shared_impl/proxy_lock.cc \
@@ -66,22 +67,22 @@
 	ppapi/shared_impl/resource_tracker.cc \
 	ppapi/shared_impl/scoped_pp_resource.cc \
 	ppapi/shared_impl/scoped_pp_var.cc \
+	ppapi/shared_impl/thread_aware_callback.cc \
 	ppapi/shared_impl/time_conversion.cc \
 	ppapi/shared_impl/tracked_callback.cc \
 	ppapi/shared_impl/url_request_info_data.cc \
+	ppapi/shared_impl/url_response_info_data.cc \
 	ppapi/shared_impl/var.cc \
 	ppapi/shared_impl/var_tracker.cc \
+	ppapi/shared_impl/var_value_conversions.cc \
 	ppapi/shared_impl/private/net_address_private_impl.cc \
-	ppapi/shared_impl/private/ppb_browser_font_trusted_shared.cc \
 	ppapi/shared_impl/private/ppb_char_set_shared.cc \
-	ppapi/shared_impl/private/ppb_host_resolver_shared.cc \
 	ppapi/shared_impl/private/ppb_tcp_server_socket_shared.cc \
 	ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc \
 	ppapi/shared_impl/private/tcp_socket_private_impl.cc \
-	ppapi/shared_impl/private/udp_socket_private_impl.cc \
 	ppapi/thunk/enter.cc \
 	ppapi/thunk/ppb_audio_config_thunk.cc \
-	ppapi/thunk/ppb_audio_input_thunk.cc \
+	ppapi/thunk/ppb_audio_input_dev_thunk.cc \
 	ppapi/thunk/ppb_audio_thunk.cc \
 	ppapi/thunk/ppb_audio_trusted_thunk.cc \
 	ppapi/thunk/ppb_broker_thunk.cc \
@@ -92,14 +93,14 @@
 	ppapi/thunk/ppb_console_thunk.cc \
 	ppapi/thunk/ppb_content_decryptor_private_thunk.cc \
 	ppapi/thunk/ppb_cursor_control_thunk.cc \
-	ppapi/thunk/ppb_device_ref_thunk.cc \
+	ppapi/thunk/ppb_device_ref_dev_thunk.cc \
 	ppapi/thunk/ppb_directory_reader_thunk.cc \
 	ppapi/thunk/ppb_file_chooser_thunk.cc \
 	ppapi/thunk/ppb_file_io_thunk.cc \
 	ppapi/thunk/ppb_file_io_trusted_thunk.cc \
 	ppapi/thunk/ppb_file_ref_thunk.cc \
 	ppapi/thunk/ppb_file_system_thunk.cc \
-	ppapi/thunk/ppb_find_thunk.cc \
+	ppapi/thunk/ppb_find_dev_thunk.cc \
 	ppapi/thunk/ppb_flash_clipboard_thunk.cc \
 	ppapi/thunk/ppb_flash_device_id_thunk.cc \
 	ppapi/thunk/ppb_flash_file_fileref_thunk.cc \
@@ -108,6 +109,7 @@
 	ppapi/thunk/ppb_flash_fullscreen_thunk.cc \
 	ppapi/thunk/ppb_flash_menu_thunk.cc \
 	ppapi/thunk/ppb_flash_message_loop_thunk.cc \
+	ppapi/thunk/ppb_flash_print_thunk.cc \
 	ppapi/thunk/ppb_flash_thunk.cc \
 	ppapi/thunk/ppb_fullscreen_thunk.cc \
 	ppapi/thunk/ppb_gamepad_thunk.cc \
@@ -119,35 +121,43 @@
 	ppapi/thunk/ppb_image_data_thunk.cc \
 	ppapi/thunk/ppb_image_data_trusted_thunk.cc \
 	ppapi/thunk/ppb_input_event_thunk.cc \
+	ppapi/thunk/ppb_instance_private_thunk.cc \
 	ppapi/thunk/ppb_instance_thunk.cc \
 	ppapi/thunk/ppb_messaging_thunk.cc \
 	ppapi/thunk/ppb_mouse_cursor_thunk.cc \
 	ppapi/thunk/ppb_mouse_lock_thunk.cc \
 	ppapi/thunk/ppb_network_list_private_thunk.cc \
 	ppapi/thunk/ppb_network_monitor_private_thunk.cc \
+	ppapi/thunk/ppb_pdf_thunk.cc \
 	ppapi/thunk/ppb_printing_thunk.cc \
-	ppapi/thunk/ppb_resource_array_thunk.cc \
+	ppapi/thunk/ppb_resource_array_dev_thunk.cc \
 	ppapi/thunk/ppb_scrollbar_thunk.cc \
 	ppapi/thunk/ppb_talk_private_thunk.cc \
 	ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc \
 	ppapi/thunk/ppb_tcp_socket_private_thunk.cc \
 	ppapi/thunk/ppb_text_input_thunk.cc \
+	ppapi/thunk/ppb_truetype_font_thunk.cc \
 	ppapi/thunk/ppb_udp_socket_private_thunk.cc \
 	ppapi/thunk/ppb_url_loader_thunk.cc \
 	ppapi/thunk/ppb_url_request_info_thunk.cc \
 	ppapi/thunk/ppb_url_response_info_thunk.cc \
 	ppapi/thunk/ppb_url_util_thunk.cc \
+	ppapi/thunk/ppb_var_array_thunk.cc \
+	ppapi/thunk/ppb_var_dictionary_thunk.cc \
 	ppapi/thunk/ppb_video_capture_thunk.cc \
 	ppapi/thunk/ppb_video_decoder_thunk.cc \
+	ppapi/thunk/ppb_view_dev_thunk.cc \
 	ppapi/thunk/ppb_view_thunk.cc \
 	ppapi/thunk/ppb_websocket_thunk.cc \
-	ppapi/thunk/ppb_widget_thunk.cc \
+	ppapi/thunk/ppb_widget_dev_thunk.cc \
 	ppapi/thunk/ppb_x509_certificate_private_thunk.cc \
 	ppapi/thunk/ppb_zoom_thunk.cc
 
 
 # Flags passed to both C and C++ files.
 MY_CFLAGS := \
+	-fstack-protector \
+	--param=ssp-buffer-size=4 \
 	-Werror \
 	-fno-exceptions \
 	-fno-strict-aliasing \
@@ -157,15 +167,9 @@
 	-fvisibility=hidden \
 	-pipe \
 	-fPIC \
-	-mthumb \
-	-march=armv7-a \
-	-mtune=cortex-a8 \
-	-mfloat-abi=softfp \
-	-mfpu=vfpv3-d16 \
 	-fno-tree-sra \
 	-fuse-ld=gold \
 	-Wno-psabi \
-	-mthumb-interwork \
 	-ffunction-sections \
 	-funwind-tables \
 	-g \
@@ -173,11 +177,10 @@
 	-fno-short-enums \
 	-finline-limit=64 \
 	-Wa,--noexecstack \
-	-Wno-error=extra \
-	-Wno-error=ignored-qualifiers \
-	-Wno-error=type-limits \
-	-Wno-error=non-virtual-dtor \
-	-Wno-error=sign-promo \
+	-U_FORTIFY_SOURCE \
+	-Wno-extra \
+	-Wno-ignored-qualifiers \
+	-Wno-type-limits \
 	-Os \
 	-g \
 	-fomit-frame-pointer \
@@ -187,7 +190,9 @@
 MY_CFLAGS_C :=
 
 MY_DEFS := \
+	'-DUSE_SKIA' \
 	'-D_FILE_OFFSET_BITS=64' \
+	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
@@ -197,15 +202,15 @@
 	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
-	'-DUSE_SKIA=1' \
+	'-DENABLE_LANGUAGE_DETECTION=1' \
 	'-DSK_BUILD_NO_IMAGE_ENCODE' \
 	'-DSK_DEFERRED_CANVAS_USES_GPIPE=1' \
 	'-DGR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"' \
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
+	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
 	'-DSK_BUILD_FOR_ANDROID_NDK' \
 	'-DU_USING_ICU_NAMESPACE=0' \
-	'-DUSE_SYSTEM_ICU' \
 	'-D__STDC_CONSTANT_MACROS' \
 	'-D__STDC_FORMAT_MACROS' \
 	'-DPPAPI_SHARED_IMPLEMENTATION' \
@@ -214,8 +219,7 @@
 	'-D__GNU_SOURCE=1' \
 	'-DUSE_STLPORT=1' \
 	'-D_STLP_USE_PTR_SPECIALIZATIONS=1' \
-	'-DCHROME_SYMBOLS_ID=""' \
-	'-DANDROID_UPSTREAM_BRINGUP=1' \
+	'-DCHROME_BUILD_ID=""' \
 	'-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
 	'-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \
 	'-D_DEBUG'
@@ -224,8 +228,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
+	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -238,11 +245,10 @@
 	$(LOCAL_PATH)/third_party/skia/include/ports \
 	$(LOCAL_PATH)/third_party/skia/include/utils \
 	$(LOCAL_PATH)/skia/ext \
-	$(LOCAL_PATH)/third_party/harfbuzz/contrib \
-	$(LOCAL_PATH)/third_party/harfbuzz/src \
 	$(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/common \
 	$(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/WebKit/Source/Platform/chromium \
+	$(LOCAL_PATH)/third_party/WebKit/Source/Platform/chromium \
 	$(gyp_shared_intermediate_dir)/webcore_headers \
 	$(LOCAL_PATH)/third_party/npapi \
 	$(LOCAL_PATH)/third_party/npapi/bindings \
@@ -260,11 +266,15 @@
 	-fvisibility-inlines-hidden \
 	-Wsign-compare \
 	-Wno-abi \
-	-Wno-error=c++0x-compat
+	-Wno-error=c++0x-compat \
+	-Wno-non-virtual-dtor \
+	-Wno-sign-promo
 
 ### Rules for final target.
 
 LOCAL_LDFLAGS := \
+	-Wl,-z,now \
+	-Wl,-z,relro \
 	-Wl,-z,noexecstack \
 	-fPIC \
 	-Wl,-z,relro \
diff --git a/ppapi/ppapi_shared.target.mk b/ppapi/ppapi_shared.target.linux-x86.mk
similarity index 85%
copy from ppapi/ppapi_shared.target.mk
copy to ppapi/ppapi_shared.target.linux-x86.mk
index 1d3f3bf..affd212 100644
--- a/ppapi/ppapi_shared.target.mk
+++ b/ppapi/ppapi_shared.target.linux-x86.mk
@@ -26,8 +26,11 @@
 GYP_COPIED_SOURCE_ORIGIN_DIRS :=
 
 LOCAL_SRC_FILES := \
+	ppapi/shared_impl/array_var.cc \
 	ppapi/shared_impl/array_writer.cc \
 	ppapi/shared_impl/callback_tracker.cc \
+	ppapi/shared_impl/dictionary_var.cc \
+	ppapi/shared_impl/file_io_state_manager.cc \
 	ppapi/shared_impl/file_path.cc \
 	ppapi/shared_impl/file_type_conversion.cc \
 	ppapi/shared_impl/flash_clipboard_format_registry.cc \
@@ -42,9 +45,7 @@
 	ppapi/shared_impl/ppb_audio_shared.cc \
 	ppapi/shared_impl/ppb_crypto_shared.cc \
 	ppapi/shared_impl/ppb_device_ref_shared.cc \
-	ppapi/shared_impl/ppb_file_io_shared.cc \
 	ppapi/shared_impl/ppb_file_ref_shared.cc \
-	ppapi/shared_impl/ppb_flash_shared.cc \
 	ppapi/shared_impl/ppb_gamepad_shared.cc \
 	ppapi/shared_impl/ppb_graphics_3d_shared.cc \
 	ppapi/shared_impl/ppb_image_data_shared.cc \
@@ -55,10 +56,10 @@
 	ppapi/shared_impl/ppb_network_list_private_shared.cc \
 	ppapi/shared_impl/ppb_opengles2_shared.cc \
 	ppapi/shared_impl/ppb_resource_array_shared.cc \
+	ppapi/shared_impl/ppb_trace_event_impl.cc \
 	ppapi/shared_impl/ppb_url_util_shared.cc \
 	ppapi/shared_impl/ppb_var_shared.cc \
 	ppapi/shared_impl/ppb_video_decoder_shared.cc \
-	ppapi/shared_impl/ppb_video_capture_shared.cc \
 	ppapi/shared_impl/ppb_view_shared.cc \
 	ppapi/shared_impl/ppp_instance_combined.cc \
 	ppapi/shared_impl/proxy_lock.cc \
@@ -66,22 +67,22 @@
 	ppapi/shared_impl/resource_tracker.cc \
 	ppapi/shared_impl/scoped_pp_resource.cc \
 	ppapi/shared_impl/scoped_pp_var.cc \
+	ppapi/shared_impl/thread_aware_callback.cc \
 	ppapi/shared_impl/time_conversion.cc \
 	ppapi/shared_impl/tracked_callback.cc \
 	ppapi/shared_impl/url_request_info_data.cc \
+	ppapi/shared_impl/url_response_info_data.cc \
 	ppapi/shared_impl/var.cc \
 	ppapi/shared_impl/var_tracker.cc \
+	ppapi/shared_impl/var_value_conversions.cc \
 	ppapi/shared_impl/private/net_address_private_impl.cc \
-	ppapi/shared_impl/private/ppb_browser_font_trusted_shared.cc \
 	ppapi/shared_impl/private/ppb_char_set_shared.cc \
-	ppapi/shared_impl/private/ppb_host_resolver_shared.cc \
 	ppapi/shared_impl/private/ppb_tcp_server_socket_shared.cc \
 	ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc \
 	ppapi/shared_impl/private/tcp_socket_private_impl.cc \
-	ppapi/shared_impl/private/udp_socket_private_impl.cc \
 	ppapi/thunk/enter.cc \
 	ppapi/thunk/ppb_audio_config_thunk.cc \
-	ppapi/thunk/ppb_audio_input_thunk.cc \
+	ppapi/thunk/ppb_audio_input_dev_thunk.cc \
 	ppapi/thunk/ppb_audio_thunk.cc \
 	ppapi/thunk/ppb_audio_trusted_thunk.cc \
 	ppapi/thunk/ppb_broker_thunk.cc \
@@ -92,14 +93,14 @@
 	ppapi/thunk/ppb_console_thunk.cc \
 	ppapi/thunk/ppb_content_decryptor_private_thunk.cc \
 	ppapi/thunk/ppb_cursor_control_thunk.cc \
-	ppapi/thunk/ppb_device_ref_thunk.cc \
+	ppapi/thunk/ppb_device_ref_dev_thunk.cc \
 	ppapi/thunk/ppb_directory_reader_thunk.cc \
 	ppapi/thunk/ppb_file_chooser_thunk.cc \
 	ppapi/thunk/ppb_file_io_thunk.cc \
 	ppapi/thunk/ppb_file_io_trusted_thunk.cc \
 	ppapi/thunk/ppb_file_ref_thunk.cc \
 	ppapi/thunk/ppb_file_system_thunk.cc \
-	ppapi/thunk/ppb_find_thunk.cc \
+	ppapi/thunk/ppb_find_dev_thunk.cc \
 	ppapi/thunk/ppb_flash_clipboard_thunk.cc \
 	ppapi/thunk/ppb_flash_device_id_thunk.cc \
 	ppapi/thunk/ppb_flash_file_fileref_thunk.cc \
@@ -108,6 +109,7 @@
 	ppapi/thunk/ppb_flash_fullscreen_thunk.cc \
 	ppapi/thunk/ppb_flash_menu_thunk.cc \
 	ppapi/thunk/ppb_flash_message_loop_thunk.cc \
+	ppapi/thunk/ppb_flash_print_thunk.cc \
 	ppapi/thunk/ppb_flash_thunk.cc \
 	ppapi/thunk/ppb_fullscreen_thunk.cc \
 	ppapi/thunk/ppb_gamepad_thunk.cc \
@@ -119,35 +121,42 @@
 	ppapi/thunk/ppb_image_data_thunk.cc \
 	ppapi/thunk/ppb_image_data_trusted_thunk.cc \
 	ppapi/thunk/ppb_input_event_thunk.cc \
+	ppapi/thunk/ppb_instance_private_thunk.cc \
 	ppapi/thunk/ppb_instance_thunk.cc \
 	ppapi/thunk/ppb_messaging_thunk.cc \
 	ppapi/thunk/ppb_mouse_cursor_thunk.cc \
 	ppapi/thunk/ppb_mouse_lock_thunk.cc \
 	ppapi/thunk/ppb_network_list_private_thunk.cc \
 	ppapi/thunk/ppb_network_monitor_private_thunk.cc \
+	ppapi/thunk/ppb_pdf_thunk.cc \
 	ppapi/thunk/ppb_printing_thunk.cc \
-	ppapi/thunk/ppb_resource_array_thunk.cc \
+	ppapi/thunk/ppb_resource_array_dev_thunk.cc \
 	ppapi/thunk/ppb_scrollbar_thunk.cc \
 	ppapi/thunk/ppb_talk_private_thunk.cc \
 	ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc \
 	ppapi/thunk/ppb_tcp_socket_private_thunk.cc \
 	ppapi/thunk/ppb_text_input_thunk.cc \
+	ppapi/thunk/ppb_truetype_font_thunk.cc \
 	ppapi/thunk/ppb_udp_socket_private_thunk.cc \
 	ppapi/thunk/ppb_url_loader_thunk.cc \
 	ppapi/thunk/ppb_url_request_info_thunk.cc \
 	ppapi/thunk/ppb_url_response_info_thunk.cc \
 	ppapi/thunk/ppb_url_util_thunk.cc \
+	ppapi/thunk/ppb_var_array_thunk.cc \
+	ppapi/thunk/ppb_var_dictionary_thunk.cc \
 	ppapi/thunk/ppb_video_capture_thunk.cc \
 	ppapi/thunk/ppb_video_decoder_thunk.cc \
+	ppapi/thunk/ppb_view_dev_thunk.cc \
 	ppapi/thunk/ppb_view_thunk.cc \
 	ppapi/thunk/ppb_websocket_thunk.cc \
-	ppapi/thunk/ppb_widget_thunk.cc \
+	ppapi/thunk/ppb_widget_dev_thunk.cc \
 	ppapi/thunk/ppb_x509_certificate_private_thunk.cc \
 	ppapi/thunk/ppb_zoom_thunk.cc
 
 
 # Flags passed to both C and C++ files.
 MY_CFLAGS := \
+	--param=ssp-buffer-size=4 \
 	-Werror \
 	-fno-exceptions \
 	-fno-strict-aliasing \
@@ -157,27 +166,22 @@
 	-fvisibility=hidden \
 	-pipe \
 	-fPIC \
-	-mthumb \
-	-march=armv7-a \
-	-mtune=cortex-a8 \
-	-mfloat-abi=softfp \
-	-mfpu=vfpv3-d16 \
-	-fno-tree-sra \
-	-fuse-ld=gold \
-	-Wno-psabi \
-	-mthumb-interwork \
+	-m32 \
+	-mmmx \
+	-march=pentium4 \
+	-msse2 \
+	-mfpmath=sse \
 	-ffunction-sections \
 	-funwind-tables \
 	-g \
-	-fstack-protector \
 	-fno-short-enums \
 	-finline-limit=64 \
 	-Wa,--noexecstack \
-	-Wno-error=extra \
-	-Wno-error=ignored-qualifiers \
-	-Wno-error=type-limits \
-	-Wno-error=non-virtual-dtor \
-	-Wno-error=sign-promo \
+	-U_FORTIFY_SOURCE \
+	-Wno-extra \
+	-Wno-ignored-qualifiers \
+	-Wno-type-limits \
+	-fno-stack-protector \
 	-Os \
 	-g \
 	-fomit-frame-pointer \
@@ -187,7 +191,9 @@
 MY_CFLAGS_C :=
 
 MY_DEFS := \
+	'-DUSE_SKIA' \
 	'-D_FILE_OFFSET_BITS=64' \
+	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
@@ -197,15 +203,15 @@
 	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
-	'-DUSE_SKIA=1' \
+	'-DENABLE_LANGUAGE_DETECTION=1' \
 	'-DSK_BUILD_NO_IMAGE_ENCODE' \
 	'-DSK_DEFERRED_CANVAS_USES_GPIPE=1' \
 	'-DGR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"' \
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
+	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
 	'-DSK_BUILD_FOR_ANDROID_NDK' \
 	'-DU_USING_ICU_NAMESPACE=0' \
-	'-DUSE_SYSTEM_ICU' \
 	'-D__STDC_CONSTANT_MACROS' \
 	'-D__STDC_FORMAT_MACROS' \
 	'-DPPAPI_SHARED_IMPLEMENTATION' \
@@ -214,8 +220,7 @@
 	'-D__GNU_SOURCE=1' \
 	'-DUSE_STLPORT=1' \
 	'-D_STLP_USE_PTR_SPECIALIZATIONS=1' \
-	'-DCHROME_SYMBOLS_ID=""' \
-	'-DANDROID_UPSTREAM_BRINGUP=1' \
+	'-DCHROME_BUILD_ID=""' \
 	'-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
 	'-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \
 	'-D_DEBUG'
@@ -224,8 +229,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
+	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -238,11 +246,10 @@
 	$(LOCAL_PATH)/third_party/skia/include/ports \
 	$(LOCAL_PATH)/third_party/skia/include/utils \
 	$(LOCAL_PATH)/skia/ext \
-	$(LOCAL_PATH)/third_party/harfbuzz/contrib \
-	$(LOCAL_PATH)/third_party/harfbuzz/src \
 	$(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/common \
 	$(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/WebKit/Source/Platform/chromium \
+	$(LOCAL_PATH)/third_party/WebKit/Source/Platform/chromium \
 	$(gyp_shared_intermediate_dir)/webcore_headers \
 	$(LOCAL_PATH)/third_party/npapi \
 	$(LOCAL_PATH)/third_party/npapi/bindings \
@@ -259,21 +266,21 @@
 	-fno-threadsafe-statics \
 	-fvisibility-inlines-hidden \
 	-Wsign-compare \
-	-Wno-abi \
-	-Wno-error=c++0x-compat
+	-Wno-error=c++0x-compat \
+	-Wno-non-virtual-dtor \
+	-Wno-sign-promo
 
 ### Rules for final target.
 
 LOCAL_LDFLAGS := \
+	-Wl,-z,now \
+	-Wl,-z,relro \
 	-Wl,-z,noexecstack \
 	-fPIC \
-	-Wl,-z,relro \
-	-Wl,-z,now \
-	-fuse-ld=gold \
+	-m32 \
 	-nostdlib \
 	-Wl,--no-undefined \
 	-Wl,--exclude-libs=ALL \
-	-Wl,--icf=safe \
 	-Wl,-O1 \
 	-Wl,--as-needed \
 	-Wl,--gc-sections
diff --git a/ppapi/ppapi_shared_untrusted.gyp b/ppapi/ppapi_shared_untrusted.gyp
index ef76bd3..e085f60 100644
--- a/ppapi/ppapi_shared_untrusted.gyp
+++ b/ppapi/ppapi_shared_untrusted.gyp
@@ -24,7 +24,6 @@
             'build_glibc': 0,
             'build_newlib': 1,
             'defines': [
-              'NACL_PPAPI_IPC_PROXY',
               # Enable threading for the untrusted side of the proxy.
               # TODO(bbudge) remove when this is the default.
               'ENABLE_PEPPER_THREADING',
@@ -32,7 +31,6 @@
           },
           'include_dirs': [
             '..',
-            '../third_party/khronos',
           ],
           'dependencies': [
             '../native_client/tools.gyp:prep_toolchain',
@@ -41,6 +39,7 @@
             '../gpu/gpu_untrusted.gyp:command_buffer_client_untrusted',
             '../gpu/gpu_untrusted.gyp:gles2_implementation_untrusted',
             '../media/media_untrusted.gyp:shared_memory_support_untrusted',
+            '../third_party/khronos/khronos.gyp:khronos_headers',
           ],
         },
       ],
diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi
index 32a75fd..1d61391 100644
--- a/ppapi/ppapi_sources.gypi
+++ b/ppapi/ppapi_sources.gypi
@@ -25,6 +25,7 @@
       'c/ppb.h',
       'c/ppb_audio.h',
       'c/ppb_audio_config.h',
+      'c/ppb_console.h',
       'c/ppb_core.h',
       'c/ppb_file_io.h',
       'c/ppb_file_ref.h',
@@ -36,6 +37,7 @@
       'c/ppb_image_data.h',
       'c/ppb_input_event.h',
       'c/ppb_instance.h',
+      'c/ppb_message_loop.h',
       'c/ppb_messaging.h',
       'c/ppb_mouse_cursor.h',
       'c/ppb_mouse_lock.h',
@@ -60,7 +62,6 @@
       'c/dev/pp_video_dev.h',
       'c/dev/ppb_buffer_dev.h',
       'c/dev/ppb_char_set_dev.h',
-      'c/dev/ppb_console_dev.h',
       'c/dev/ppb_cursor_control_dev.h',
       'c/dev/ppb_device_ref_dev.h',
       'c/dev/ppb_directory_reader_dev.h',
@@ -69,13 +70,15 @@
       'c/dev/ppb_font_dev.h',
       'c/dev/ppb_ime_input_event_dev.h',
       'c/dev/ppb_memory_dev.h',
-      'c/dev/ppb_message_loop_dev.h',
       'c/dev/ppb_printing_dev.h',
       'c/dev/ppb_resource_array_dev.h',
       'c/dev/ppb_scrollbar_dev.h',
       'c/dev/ppb_testing_dev.h',
       'c/dev/ppb_text_input_dev.h',
+      'c/dev/ppb_truetype_font_dev.h',
       'c/dev/ppb_url_util_dev.h',
+      'c/dev/ppb_var_array_dev.h',
+      'c/dev/ppb_var_dictionary_dev.h',
       'c/dev/ppb_video_decoder_dev.h',
       'c/dev/ppb_widget_dev.h',
       'c/dev/ppb_zoom_dev.h',
@@ -131,6 +134,10 @@
       'c/trusted/ppb_image_data_trusted.h',
       'c/trusted/ppb_url_loader_trusted.h',
       'c/trusted/ppp_broker.h',
+
+      # Extensions dev interfaces.
+      'c/extensions/dev/ppb_alarms_dev.h',
+      'c/extensions/dev/ppb_events_dev.h',
     ],
     'cpp_source_files': [
       'cpp/array_output.cc',
@@ -165,6 +172,8 @@
       'cpp/instance_handle.cc',
       'cpp/instance_handle.h',
       'cpp/logging.h',
+      'cpp/message_loop.cc',
+      'cpp/message_loop.h',
       'cpp/module.cc',
       'cpp/module.h',
       'cpp/module_impl.h',
@@ -222,8 +231,6 @@
       'cpp/dev/ime_input_event_dev.h',
       'cpp/dev/memory_dev.cc',
       'cpp/dev/memory_dev.h',
-      'cpp/dev/message_loop_dev.cc',
-      'cpp/dev/message_loop_dev.h',
       'cpp/dev/printing_dev.cc',
       'cpp/dev/printing_dev.h',
       'cpp/dev/resource_array_dev.cc',
@@ -234,8 +241,14 @@
       'cpp/dev/selection_dev.h',
       'cpp/dev/text_input_dev.cc',
       'cpp/dev/text_input_dev.h',
+      'cpp/dev/truetype_font_dev.cc',
+      'cpp/dev/truetype_font_dev.h',
       'cpp/dev/url_util_dev.cc',
       'cpp/dev/url_util_dev.h',
+      'cpp/dev/var_array_dev.cc',
+      'cpp/dev/var_array_dev.h',
+      'cpp/dev/var_dictionary_dev.cc',
+      'cpp/dev/var_dictionary_dev.h',
       'cpp/dev/video_capture_client_dev.cc',
       'cpp/dev/video_capture_client_dev.h',
       'cpp/dev/video_capture_dev.cc',
@@ -286,6 +299,8 @@
       'cpp/private/network_list_private.h',
       'cpp/private/network_monitor_private.cc',
       'cpp/private/network_monitor_private.h',
+      'cpp/private/pdf.cc',
+      'cpp/private/pdf.h',
       'cpp/private/tcp_server_socket_private.cc',
       'cpp/private/tcp_server_socket_private.h',
       'cpp/private/tcp_socket_private.cc',
@@ -305,6 +320,21 @@
       'cpp/trusted/file_io_trusted.cc',
       'cpp/trusted/file_io_trusted.h',
 
+      # Extensions interfaces.
+      'cpp/extensions/dict_field.h',
+      'cpp/extensions/event_base.cc',
+      'cpp/extensions/event_base.h',
+      'cpp/extensions/ext_output_traits.h',
+      'cpp/extensions/from_var_converter.h',
+      'cpp/extensions/optional.h',
+      'cpp/extensions/to_var_converter.h',
+
+      # Extensions dev interfaces.
+      'cpp/extensions/dev/alarms_dev.cc',
+      'cpp/extensions/dev/alarms_dev.h',
+      'cpp/extensions/dev/events_dev.cc',
+      'cpp/extensions/dev/events_dev.h',
+
       # Utility sources.
       'utility/completion_callback_factory.h',
       'utility/completion_callback_factory_thread_traits.h',
@@ -340,6 +370,8 @@
       'tests/test_audio_config.h',
       'tests/test_case.cc',
       'tests/test_case.h',
+      'tests/test_console.cc',
+      'tests/test_console.h',
       'tests/test_core.cc',
       'tests/test_core.h',
       'tests/test_cursor_control.cc',
@@ -362,6 +394,8 @@
       'tests/test_graphics_3d.h',
       'tests/test_host_resolver_private.cc',
       'tests/test_host_resolver_private.h',
+      'tests/test_host_resolver_private_disallowed.cc',
+      'tests/test_host_resolver_private_disallowed.h',
       'tests/test_image_data.cc',
       'tests/test_image_data.h',
       'tests/test_ime_input_event.cc',
@@ -454,6 +488,8 @@
       'tests/test_resource_array.cc',
       'tests/test_resource_array.h',
       'tests/test_struct_sizes.c',
+      'tests/test_talk_private.cc',
+      'tests/test_talk_private.h',
       'tests/test_tcp_socket_private_trusted.cc',
       'tests/test_tcp_socket_private_trusted.h',
       'tests/test_uma.cc',
diff --git a/ppapi/ppapi_tests.gypi b/ppapi/ppapi_tests.gypi
index 48ae15e..a400e98 100644
--- a/ppapi/ppapi_tests.gypi
+++ b/ppapi/ppapi_tests.gypi
@@ -43,7 +43,6 @@
         'action': [
           '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)chrome<(EXECUTABLE_SUFFIX)',
           '--enable-pepper-testing',
-          '--enable-accelerated-plugins',
           '--register-pepper-plugins=$(TargetPath);application/x-ppapi-tests',
           'file://$(ProjectDir)/tests/test_case.html?testcase=',
         ],
@@ -56,6 +55,8 @@
             '_CRT_NONSTDC_NO_DEPRECATE',
             '_SCL_SECURE_NO_DEPRECATE',
           ],
+          # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
+          'msvs_disabled_warnings': [ 4267, ],
         }],
         ['OS=="mac"', {
           'mac_bundle': 1,
@@ -63,6 +64,8 @@
           'product_extension': 'plugin',
         }],
       ],
+      # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
+      'msvs_disabled_warnings': [ 4267, ],
 # TODO(dmichael):  Figure out what is wrong with the script on Windows and add
 #                  it as an automated action.
 #      'actions': [
@@ -126,6 +129,7 @@
         'chromium_code': 1,
       },
       'dependencies': [
+        'ppapi_host',
         'ppapi_proxy',
         'ppapi_shared',
         'ppapi_unittest_shared',
@@ -141,6 +145,8 @@
       'sources': [
         'proxy/run_all_unittests.cc',
 
+        'host/resource_message_filter_unittest.cc',
+        'proxy/device_enumeration_resource_helper_unittest.cc',
         'proxy/file_chooser_resource_unittest.cc',
         'proxy/flash_resource_unittest.cc',
         'proxy/mock_resource.cc',
@@ -156,8 +162,11 @@
         'proxy/serialized_var_unittest.cc',
         'proxy/websocket_resource_unittest.cc',
         'shared_impl/resource_tracker_unittest.cc',
+        'shared_impl/thread_aware_callback_unittest.cc',
+        'shared_impl/time_conversion_unittest.cc',
         'shared_impl/tracked_callback_unittest.cc',
         'shared_impl/var_tracker_unittest.cc',
+        'shared_impl/var_value_conversions_unittest.cc',
       ],
       'conditions': [
         [ 'os_posix == 1 and OS != "mac" and OS != "android" and OS != "ios"', {
@@ -170,6 +179,8 @@
           ],
         }],
       ],
+      # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
+      'msvs_disabled_warnings': [ 4267, ],          
     },
     {
       'target_name': 'ppapi_example_skeleton',
@@ -233,6 +244,8 @@
       'sources': [
         'examples/gamepad/gamepad.cc',
       ],
+      # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
+      'msvs_disabled_warnings': [ 4267, ],
     },
 
     {
@@ -304,6 +317,8 @@
       'sources': [
         'examples/ime/ime.cc',
       ],
+      # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
+      'msvs_disabled_warnings': [ 4267, ],
     },
     {
       'target_name': 'ppapi_example_paint_manager',
@@ -366,6 +381,16 @@
       ],
     },
     {
+      'target_name': 'ppapi_example_url_loader_file',
+      'dependencies': [
+        'ppapi_example_skeleton',
+        'ppapi.gyp:ppapi_cpp',
+      ],
+      'sources': [
+        'examples/url_loader/stream_to_file.cc',
+      ],
+    },
+    {
       'target_name': 'ppapi_example_gles2',
       'dependencies': [
         'ppapi_example_skeleton',
@@ -395,6 +420,8 @@
         'examples/video_decode/video_decode.cc',
         'examples/video_decode/testdata.h',
       ],
+      # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
+      'msvs_disabled_warnings': [ 4267, ],
     },
     {
       'target_name': 'ppapi_example_vc',
@@ -440,6 +467,8 @@
       'sources': [
         'examples/printing/printing.cc',
       ],
+      # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
+      'msvs_disabled_warnings': [ 4267, ],
     },
   ],
 }
diff --git a/ppapi/ppapi_untrusted.gyp b/ppapi/ppapi_untrusted.gyp
index 9f14e12..339cd24 100644
--- a/ppapi/ppapi_untrusted.gyp
+++ b/ppapi/ppapi_untrusted.gyp
@@ -20,6 +20,7 @@
         'nso_target': 'libppapi_cpp.so',
         'build_glibc': 1,
         'build_newlib': 1,
+        'build_pnacl_newlib': 1,
         'sources': [
           '<@(cpp_source_files)',
           'cpp/module_embedder.h',
@@ -38,6 +39,7 @@
         'nso_target': 'libppapi_gles2.so',
         'build_glibc': 1,
         'build_newlib': 1,
+        'build_pnacl_newlib': 1,
         'include_dirs': [
           'lib/gl/include',
         ],
@@ -77,14 +79,10 @@
         'link_flags': [
           '-lppapi_cpp',
           '-lppapi',
-          '-lpthread',
+          '-pthread',
         ],
         # TODO(bradchen): get rid of extra_deps64 and extra_deps32
         # once native_client/build/untrusted.gypi no longer needs them.
-        'extra_deps64': [
-          '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppapi_cpp.a',
-          '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppapi.a',
-        ],
         'extra_deps_newlib64': [
           '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppapi_cpp.a',
           '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppapi.a',
@@ -94,28 +92,40 @@
           '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libppapi.a',
         ],
         'extra_deps_glibc64': [
-          '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libppapi_cpp.a',
-          '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libppapi.a',
+          '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libppapi_cpp.so',
+          '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libppapi.so',
         ],
         'extra_deps_glibc32': [
-          '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libppapi_cpp.a',
-          '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libppapi.a',
+          '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libppapi_cpp.so',
+          '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libppapi.so',
         ],
         'extra_deps_arm': [
           '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libppapi_cpp.a',
           '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libppapi.a',
         ],
+        'extra_deps_pnacl': [
+          '<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_newlib/lib/libppapi_cpp.a',
+          '<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_newlib/lib/libppapi.a',
+        ],
         'sources': [
           '<@(test_common_source_files)',
           '<@(test_nacl_source_files)',
         ],
+        'extra_args': [
+          '--strip-all',
+        ],
       },
       'conditions': [
         ['target_arch!="arm"', {
+          # This is user code (vs IRT code), so tls accesses do not
+          # need to be indirect through a function call.
+          # For PNaCl, the -mtls-use-call flag is localized to the
+          # IRT's translation command, so it is unnecessary to
+          # counteract that flag here.
           'variables': {
-            'compile_flags': [
+            'gcc_compile_flags': [
               '-mno-tls-use-call',
-	    ],
+            ],
           },
         }],
         ['target_arch!="arm" and disable_glibc==0', {
@@ -147,11 +157,65 @@
               '--library-path=<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64',
               '--output=>(nmf_glibc)',
               '--stage-dependencies=<(PRODUCT_DIR)',
-              '--toolchain=glibc',
             ],
+            'msvs_cygwin_shell': 1,
           },
         ],
         }],
+        # Test PNaCl pre-translated code (pre-translated to save bot time).
+        # We only care about testing that code generation is correct,
+        # and in-browser translation is tested elsewhere.
+        # NOTE: native_client/build/untrusted.gypi dictates that
+        # PNaCl only generate x86-32 and x86-64 on x86 platforms,
+        # or ARM on ARM platforms, not all versions always.
+        # The same goes for the PNaCl shims. So, we have two variations here.
+        ['disable_pnacl==0 and target_arch!="arm"', {
+          'variables': {
+            'build_pnacl_newlib': 1,
+            'nmf_pnacl%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl.nmf',
+          },
+          # Shim is a dependency for the nexe because we pre-translate.
+          'dependencies': [
+            '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim',
+          ],
+         'actions': [
+            {
+              'action_name': 'Generate PNACL NEWLIB NMF',
+              'inputs': ['>(out_pnacl_newlib_x86_32_nexe)',
+                         '>(out_pnacl_newlib_x86_64_nexe)'],
+              'outputs': ['>(nmf_pnacl)'],
+              'action': [
+                'python',
+                '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py',
+                '>@(_inputs)',
+                '--output=>(nmf_pnacl)',
+              ],
+            },
+          ],
+        }],
+        ['disable_pnacl==0 and target_arch=="arm"', {
+          'variables': {
+            'build_pnacl_newlib': 1,
+            'nmf_pnacl%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl.nmf',
+          },
+          # Shim is a dependency for the nexe because we pre-translate.
+          'dependencies': [
+            '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim',
+          ],
+          'actions': [
+            {
+              'action_name': 'Generate PNACL NEWLIB NMF',
+              'inputs': ['>(out_pnacl_newlib_arm_nexe)'],
+              'outputs': ['>(nmf_pnacl)'],
+              'action': [
+                'python',
+                '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py',
+                '>@(_inputs)',
+                '--output=>(nmf_pnacl)',
+              ],
+            },
+          ],
+        }],
       ],
     },
   ],
diff --git a/ppapi/proxy/DEPS b/ppapi/proxy/DEPS
index 1a3c174..e56cd3d 100644
--- a/ppapi/proxy/DEPS
+++ b/ppapi/proxy/DEPS
@@ -1,7 +1,8 @@
 include_rules = [
   "+base",
-  "+ipc",
+  "+components/tracing",
   "+gpu",
+  "+ipc",
   "+media/audio",
   "+skia",
   "+ui/surface",
diff --git a/ppapi/proxy/OWNERS b/ppapi/proxy/OWNERS
index 1980838..ce430bf 100644
--- a/ppapi/proxy/OWNERS
+++ b/ppapi/proxy/OWNERS
@@ -5,6 +5,7 @@
 # new sandbox escapes.
 per-file *_messages.h=set noparent
 per-file *[email protected]
+per-file *[email protected]
 per-file *[email protected]
 per-file *[email protected]
 per-file *[email protected]
diff --git a/ppapi/proxy/audio_input_resource.cc b/ppapi/proxy/audio_input_resource.cc
index dd13b57..5f700ec 100644
--- a/ppapi/proxy/audio_input_resource.cc
+++ b/ppapi/proxy/audio_input_resource.cc
@@ -12,9 +12,8 @@
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/proxy/resource_message_params.h"
-#include "ppapi/proxy/serialized_structs.h"
+#include "ppapi/proxy/serialized_handle.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
-#include "ppapi/shared_impl/ppb_device_ref_shared.h"
 #include "ppapi/shared_impl/resource_tracker.h"
 #include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
@@ -32,7 +31,7 @@
       shared_memory_size_(0),
       audio_input_callback_(NULL),
       user_data_(NULL),
-      pending_enumerate_devices_(false) {
+      ALLOW_THIS_IN_INITIALIZER_LIST(enumeration_helper_(this)) {
   SendCreate(RENDERER, PpapiHostMsg_AudioInput_Create());
 }
 
@@ -44,28 +43,47 @@
   return this;
 }
 
-int32_t AudioInputResource::EnumerateDevices(
-    PP_Resource* devices,
-    scoped_refptr<TrackedCallback> callback) {
-  if (pending_enumerate_devices_)
-    return PP_ERROR_INPROGRESS;
-  if (!devices)
-    return PP_ERROR_BADARGUMENT;
-
-  pending_enumerate_devices_ = true;
-  PpapiHostMsg_AudioInput_EnumerateDevices msg;
-  Call<PpapiPluginMsg_AudioInput_EnumerateDevicesReply>(
-      RENDERER, msg,
-      base::Bind(&AudioInputResource::OnPluginMsgEnumerateDevicesReply,
-                 base::Unretained(this), devices, callback));
-  return PP_OK_COMPLETIONPENDING;
+void AudioInputResource::OnReplyReceived(
+    const ResourceMessageReplyParams& params,
+    const IPC::Message& msg) {
+  if (!enumeration_helper_.HandleReply(params, msg))
+    PluginResource::OnReplyReceived(params, msg);
 }
 
-int32_t AudioInputResource::Open(const std::string& device_id,
+int32_t AudioInputResource::EnumerateDevices0_2(
+    PP_Resource* devices,
+    scoped_refptr<TrackedCallback> callback) {
+  return enumeration_helper_.EnumerateDevices0_2(devices, callback);
+}
+
+int32_t AudioInputResource::EnumerateDevices(
+    const PP_ArrayOutput& output,
+    scoped_refptr<TrackedCallback> callback) {
+  return enumeration_helper_.EnumerateDevices(output, callback);
+}
+
+int32_t AudioInputResource::MonitorDeviceChange(
+    PP_MonitorDeviceChangeCallback callback,
+    void* user_data) {
+  return enumeration_helper_.MonitorDeviceChange(callback, user_data);
+}
+
+int32_t AudioInputResource::Open(PP_Resource device_ref,
                                  PP_Resource config,
                                  PPB_AudioInput_Callback audio_input_callback,
                                  void* user_data,
                                  scoped_refptr<TrackedCallback> callback) {
+  std::string device_id;
+  // |device_id| remains empty if |device_ref| is 0, which means the default
+  // device.
+  if (device_ref != 0) {
+    thunk::EnterResourceNoLock<thunk::PPB_DeviceRef_API> enter_device_ref(
+        device_ref, true);
+    if (enter_device_ref.failed())
+      return PP_ERROR_BADRESOURCE;
+    device_id = enter_device_ref.object()->GetDeviceRefData().id;
+  }
+
   if (TrackedCallback::IsPending(open_callback_))
     return PP_ERROR_INPROGRESS;
   if (open_state_ != BEFORE_OPEN)
@@ -153,25 +171,8 @@
     open_callback_->PostAbort();
 }
 
-void AudioInputResource::OnPluginMsgEnumerateDevicesReply(
-    PP_Resource* devices_resource,
-    scoped_refptr<TrackedCallback> callback,
-    const ResourceMessageReplyParams& params,
-    const std::vector<DeviceRefData>& devices) {
-  pending_enumerate_devices_ = false;
-
-  // We shouldn't access |devices_resource| if the callback has been called,
-  // which is possible if the last plugin reference to this resource has gone
-  // away, and the callback has been aborted.
-  if (!TrackedCallback::IsPending(callback))
-    return;
-
-  if (params.result() == PP_OK) {
-    *devices_resource = PPB_DeviceRef_Shared::CreateResourceArray(
-        OBJECT_IS_PROXY, pp_instance(), devices);
-  }
-
-  callback->Run(params.result());
+void AudioInputResource::LastPluginRefWasDeleted() {
+  enumeration_helper_.LastPluginRefWasDeleted();
 }
 
 void AudioInputResource::OnPluginMsgOpenReply(
diff --git a/ppapi/proxy/audio_input_resource.h b/ppapi/proxy/audio_input_resource.h
index 7ea91b6..abe18db 100644
--- a/ppapi/proxy/audio_input_resource.h
+++ b/ppapi/proxy/audio_input_resource.h
@@ -5,8 +5,6 @@
 #ifndef PPAPI_PROXY_AUDIO_INPUT_RESOURCE_H_
 #define PPAPI_PROXY_AUDIO_INPUT_RESOURCE_H_
 
-#include <vector>
-
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
 #include "base/memory/ref_counted.h"
@@ -14,18 +12,15 @@
 #include "base/shared_memory.h"
 #include "base/sync_socket.h"
 #include "base/threading/simple_thread.h"
+#include "ppapi/proxy/device_enumeration_resource_helper.h"
 #include "ppapi/proxy/plugin_resource.h"
 #include "ppapi/shared_impl/scoped_pp_resource.h"
 #include "ppapi/thunk/ppb_audio_input_api.h"
 
 namespace ppapi {
-
-struct DeviceRefData;
-
 namespace proxy {
 
 class ResourceMessageReplyParams;
-class SerializedHandle;
 
 class AudioInputResource : public PluginResource,
                            public thunk::PPB_AudioInput_API,
@@ -36,12 +31,20 @@
 
   // Resource overrides.
   virtual thunk::PPB_AudioInput_API* AsPPB_AudioInput_API() OVERRIDE;
+  virtual void OnReplyReceived(const ResourceMessageReplyParams& params,
+                               const IPC::Message& msg) OVERRIDE;
 
   // PPB_AudioInput_API implementation.
-  virtual int32_t EnumerateDevices(
+  virtual int32_t EnumerateDevices0_2(
       PP_Resource* devices,
       scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t Open(const std::string& device_id,
+  virtual int32_t EnumerateDevices(
+      const PP_ArrayOutput& output,
+      scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual int32_t MonitorDeviceChange(
+      PP_MonitorDeviceChangeCallback callback,
+      void* user_data) OVERRIDE;
+  virtual int32_t Open(PP_Resource device_ref,
                        PP_Resource config,
                        PPB_AudioInput_Callback audio_input_callback,
                        void* user_data,
@@ -51,6 +54,10 @@
   virtual PP_Bool StopCapture() OVERRIDE;
   virtual void Close() OVERRIDE;
 
+ protected:
+  // Resource override.
+  virtual void LastPluginRefWasDeleted() OVERRIDE;
+
  private:
   enum OpenState {
     BEFORE_OPEN,
@@ -58,11 +65,6 @@
     CLOSED
   };
 
-  void OnPluginMsgEnumerateDevicesReply(
-      PP_Resource* devices_resource,
-      scoped_refptr<TrackedCallback> callback,
-      const ResourceMessageReplyParams& params,
-      const std::vector<DeviceRefData>& devices);
   void OnPluginMsgOpenReply(const ResourceMessageReplyParams& params);
 
   // Sets the shared memory and socket handles. This will automatically start
@@ -107,7 +109,6 @@
   // User data pointer passed verbatim to the callback function.
   void* user_data_;
 
-  bool pending_enumerate_devices_;
   // The callback is not directly passed to OnPluginMsgOpenReply() because we
   // would like to be able to cancel it early in Close().
   scoped_refptr<TrackedCallback> open_callback_;
@@ -116,6 +117,8 @@
   // we just dish it out as requested by the plugin.
   ScopedPPResource config_;
 
+  DeviceEnumerationResourceHelper enumeration_helper_;
+
   DISALLOW_COPY_AND_ASSIGN(AudioInputResource);
 };
 
diff --git a/ppapi/proxy/broker_dispatcher.cc b/ppapi/proxy/broker_dispatcher.cc
index 97fca5c..7187852 100644
--- a/ppapi/proxy/broker_dispatcher.cc
+++ b/ppapi/proxy/broker_dispatcher.cc
@@ -21,9 +21,11 @@
 
 bool BrokerDispatcher::InitBrokerWithChannel(
     ProxyChannel::Delegate* delegate,
+    base::ProcessId peer_pid,
     const IPC::ChannelHandle& channel_handle,
     bool is_client) {
-  return ProxyChannel::InitWithChannel(delegate, channel_handle, is_client);
+  return ProxyChannel::InitWithChannel(delegate, peer_pid, channel_handle,
+                                       is_client);
 }
 
 bool BrokerDispatcher::OnMessageReceived(const IPC::Message& msg) {
diff --git a/ppapi/proxy/broker_dispatcher.h b/ppapi/proxy/broker_dispatcher.h
index de83b2b..2da4a47 100644
--- a/ppapi/proxy/broker_dispatcher.h
+++ b/ppapi/proxy/broker_dispatcher.h
@@ -20,6 +20,7 @@
   // The delegate pointer must outlive this class, ownership is not
   // transferred.
   virtual bool InitBrokerWithChannel(ProxyChannel::Delegate* delegate,
+                                     base::ProcessId peer_pid,
                                      const IPC::ChannelHandle& channel_handle,
                                      bool is_client);
 
diff --git a/ppapi/proxy/broker_resource.cc b/ppapi/proxy/broker_resource.cc
new file mode 100644
index 0000000..4fac07e
--- /dev/null
+++ b/ppapi/proxy/broker_resource.cc
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/broker_resource.h"
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/proxy/ppapi_messages.h"
+
+namespace ppapi {
+namespace proxy {
+
+BrokerResource::BrokerResource(Connection connection, PP_Instance instance)
+    : PluginResource(connection, instance) {
+  SendCreate(BROWSER, PpapiHostMsg_Broker_Create());
+}
+
+BrokerResource::~BrokerResource() {
+}
+
+thunk::PPB_Broker_Instance_API* BrokerResource::AsPPB_Broker_Instance_API() {
+  return this;
+}
+
+PP_Bool BrokerResource::IsAllowed() {
+  int32_t result =
+      SyncCall<IPC::Message>(BROWSER, PpapiHostMsg_Broker_IsAllowed());
+  return PP_FromBool(result == PP_OK);
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/broker_resource.h b/ppapi/proxy/broker_resource.h
new file mode 100644
index 0000000..48d8041
--- /dev/null
+++ b/ppapi/proxy/broker_resource.h
@@ -0,0 +1,35 @@
+// 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 PPAPI_PROXY_BROKER_RESOURCE_H_
+#define PPAPI_PROXY_BROKER_RESOURCE_H_
+
+#include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/thunk/ppb_broker_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+class BrokerResource
+    : public PluginResource,
+      public thunk::PPB_Broker_Instance_API {
+ public:
+  BrokerResource(Connection connection, PP_Instance instance);
+  virtual ~BrokerResource();
+
+  // Resource override.
+  virtual thunk::PPB_Broker_Instance_API* AsPPB_Broker_Instance_API() OVERRIDE;
+
+  // thunk::PPB_Broker_Instance_API implementation.
+  virtual PP_Bool IsAllowed() OVERRIDE;
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(BrokerResource);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_BROKER_RESOURCE_H_
diff --git a/ppapi/shared_impl/private/ppb_browser_font_trusted_shared.cc b/ppapi/proxy/browser_font_resource_trusted.cc
similarity index 88%
rename from ppapi/shared_impl/private/ppb_browser_font_trusted_shared.cc
rename to ppapi/proxy/browser_font_resource_trusted.cc
index 9b2c0f5..ae3b07d 100644
--- a/ppapi/shared_impl/private/ppb_browser_font_trusted_shared.cc
+++ b/ppapi/proxy/browser_font_resource_trusted.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 "ppapi/shared_impl/private/ppb_browser_font_trusted_shared.h"
+#include "ppapi/proxy/browser_font_resource_trusted.h"
 
 #include "base/string_util.h"
 #include "base/utf_string_conversions.h"
@@ -13,15 +13,15 @@
 #include "ppapi/thunk/ppb_image_data_api.h"
 #include "ppapi/thunk/thunk.h"
 #include "skia/ext/platform_canvas.h"
-#include "third_party/skia/include/core/SkRect.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatPoint.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatRect.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebCanvas.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h"
 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFont.h"
 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFontDescription.h"
 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextRun.h"
-#include "unicode/ubidi.h"
+#include "third_party/icu/public/common/unicode/ubidi.h"
+#include "third_party/skia/include/core/SkRect.h"
 
 using ppapi::StringVar;
 using ppapi::thunk::EnterResourceNoLock;
@@ -35,6 +35,7 @@
 using WebKit::WebCanvas;
 
 namespace ppapi {
+namespace proxy {
 
 namespace {
 
@@ -223,7 +224,7 @@
 }  // namespace
 
 // static
-bool PPB_BrowserFont_Trusted_Shared::IsPPFontDescriptionValid(
+bool BrowserFontResource_Trusted::IsPPFontDescriptionValid(
     const PP_BrowserFont_Trusted_Description& desc) {
   // Check validity of string. We can't check the actual text since we could
   // be on the wrong thread and don't know if we're in the plugin or the host.
@@ -246,37 +247,24 @@
   return true;
 }
 
-// static
-PP_Resource PPB_BrowserFont_Trusted_Shared::Create(
-    ResourceObjectType type,
-    PP_Instance instance,
-    const PP_BrowserFont_Trusted_Description& description,
-    const Preferences& prefs) {
-  if (!PPB_BrowserFont_Trusted_Shared::IsPPFontDescriptionValid(description))
-    return 0;
-  return (new PPB_BrowserFont_Trusted_Shared(type, instance,
-                                             description,
-                                             prefs))->GetReference();
-}
-
-PPB_BrowserFont_Trusted_Shared::PPB_BrowserFont_Trusted_Shared(
-    ResourceObjectType type,
+BrowserFontResource_Trusted::BrowserFontResource_Trusted(
+    Connection connection,
     PP_Instance instance,
     const PP_BrowserFont_Trusted_Description& desc,
     const Preferences& prefs)
-    : Resource(type, instance),
+    : PluginResource(connection, instance),
       font_(WebFont::create(PPFontDescToWebFontDesc(desc, prefs))) {
 }
 
-PPB_BrowserFont_Trusted_Shared::~PPB_BrowserFont_Trusted_Shared() {
+BrowserFontResource_Trusted::~BrowserFontResource_Trusted() {
 }
 
 thunk::PPB_BrowserFont_Trusted_API*
-PPB_BrowserFont_Trusted_Shared::AsPPB_BrowserFont_Trusted_API() {
+BrowserFontResource_Trusted::AsPPB_BrowserFont_Trusted_API() {
   return this;
 }
 
-PP_Bool PPB_BrowserFont_Trusted_Shared::Describe(
+PP_Bool BrowserFontResource_Trusted::Describe(
     PP_BrowserFont_Trusted_Description* description,
     PP_BrowserFont_Trusted_Metrics* metrics) {
   if (description->face.type != PP_VARTYPE_UNDEFINED)
@@ -306,7 +294,7 @@
   return PP_TRUE;
 }
 
-PP_Bool PPB_BrowserFont_Trusted_Shared::DrawTextAt(
+PP_Bool BrowserFontResource_Trusted::DrawTextAt(
     PP_Resource image_data,
     const PP_BrowserFont_Trusted_TextRun* text,
     const PP_Point* position,
@@ -321,7 +309,7 @@
 
   PPB_ImageData_API* image = static_cast<PPB_ImageData_API*>(
       enter.object());
-  skia::PlatformCanvas* canvas = image->GetPlatformCanvas();
+  SkCanvas* canvas = image->GetPlatformCanvas();
   bool needs_unmapping = false;
   if (!canvas) {
     needs_unmapping = true;
@@ -338,7 +326,7 @@
   return PP_TRUE;
 }
 
-int32_t PPB_BrowserFont_Trusted_Shared::MeasureText(
+int32_t BrowserFontResource_Trusted::MeasureText(
     const PP_BrowserFont_Trusted_TextRun* text) {
   WebTextRun run;
   if (!PPTextRunToWebTextRun(*text, &run))
@@ -346,7 +334,7 @@
   return font_->calculateWidth(run);
 }
 
-uint32_t PPB_BrowserFont_Trusted_Shared::CharacterOffsetForPixel(
+uint32_t BrowserFontResource_Trusted::CharacterOffsetForPixel(
     const PP_BrowserFont_Trusted_TextRun* text,
     int32_t pixel_position) {
   TextRunCollection runs(*text);
@@ -367,7 +355,7 @@
   return runs.text().size();
 }
 
-int32_t PPB_BrowserFont_Trusted_Shared::PixelOffsetForCharacter(
+int32_t BrowserFontResource_Trusted::PixelOffsetForCharacter(
     const PP_BrowserFont_Trusted_TextRun* text,
     uint32_t char_offset) {
   TextRunCollection runs(*text);
@@ -398,8 +386,8 @@
   return -1;  // Requested a char beyond the end.
 }
 
-void PPB_BrowserFont_Trusted_Shared::DrawTextToCanvas(
-    skia::PlatformCanvas* destination,
+void BrowserFontResource_Trusted::DrawTextToCanvas(
+    SkCanvas* destination,
     const PP_BrowserFont_Trusted_TextRun& text,
     const PP_Point* position,
     uint32_t color,
@@ -437,4 +425,5 @@
   }
 }
 
+}  // namespace proxy
 }  // namespace ppapi
diff --git a/ppapi/shared_impl/private/ppb_browser_font_trusted_shared.h b/ppapi/proxy/browser_font_resource_trusted.h
similarity index 66%
rename from ppapi/shared_impl/private/ppb_browser_font_trusted_shared.h
rename to ppapi/proxy/browser_font_resource_trusted.h
index e77be56..a3b9a70 100644
--- a/ppapi/shared_impl/private/ppb_browser_font_trusted_shared.h
+++ b/ppapi/proxy/browser_font_resource_trusted.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef PPAPI_SHARED_IMPL_PRIVATE_PPB_BROWSER_FONT_TRUSTED_SHARED_H_
-#define PPAPI_SHARED_IMPL_PRIVATE_PPB_BROWSER_FONT_TRUSTED_SHARED_H_
+#ifndef PPAPI_PROXY_BROWSER_FONT_TRUSTED_RESOURCE_H_
+#define PPAPI_PROXY_BROWSER_FONT_TRUSTED_RESOURCE_H_
 
 #include <string>
 
@@ -13,42 +13,40 @@
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/c/pp_stdint.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
 #include "ppapi/shared_impl/ppapi_preferences.h"
-#include "ppapi/shared_impl/ppapi_shared_export.h"
-#include "ppapi/shared_impl/resource.h"
 #include "ppapi/thunk/ppb_browser_font_trusted_api.h"
 
-namespace skia {
-class PlatformCanvas;
-}
+class SkCanvas;
 
 namespace WebKit {
 class WebFont;
 }
 
 namespace ppapi {
+namespace proxy {
 
-class PPAPI_SHARED_EXPORT PPB_BrowserFont_Trusted_Shared
-    : public Resource,
+class PPAPI_PROXY_EXPORT BrowserFontResource_Trusted
+    : public PluginResource,
       public thunk::PPB_BrowserFont_Trusted_API {
  public:
+  BrowserFontResource_Trusted(Connection connection,
+                              PP_Instance instance,
+                              const PP_BrowserFont_Trusted_Description& desc,
+                              const Preferences& prefs);
+
+  virtual ~BrowserFontResource_Trusted();
+
   // Validates the parameters in thee description. Can be called on any thread.
   static bool IsPPFontDescriptionValid(
       const PP_BrowserFont_Trusted_Description& desc);
 
-  virtual ~PPB_BrowserFont_Trusted_Shared();
-
-  static PP_Resource Create(
-      ResourceObjectType type,
-      PP_Instance instance,
-      const PP_BrowserFont_Trusted_Description& description,
-      const ::ppapi::Preferences& prefs);
-
-  // Resource.
+  // Resource override.
   virtual ::ppapi::thunk::PPB_BrowserFont_Trusted_API*
       AsPPB_BrowserFont_Trusted_API() OVERRIDE;
 
-  // PPB_Font implementation.
+  // PPB_BrowserFont_Trusted_API implementation.
   virtual PP_Bool Describe(PP_BrowserFont_Trusted_Description* description,
                            PP_BrowserFont_Trusted_Metrics* metrics) OVERRIDE;
   virtual PP_Bool DrawTextAt(PP_Resource image_data,
@@ -67,24 +65,21 @@
       uint32_t char_offset) OVERRIDE;
 
  private:
-  PPB_BrowserFont_Trusted_Shared(ResourceObjectType type,
-                                 PP_Instance instance,
-                                 const PP_BrowserFont_Trusted_Description& desc,
-                                 const Preferences& prefs);
-
   // Internal version of DrawTextAt that takes a mapped PlatformCanvas.
-  void DrawTextToCanvas(skia::PlatformCanvas* destination,
+  void DrawTextToCanvas(SkCanvas* destination,
                         const PP_BrowserFont_Trusted_TextRun& text,
                         const PP_Point* position,
                         uint32_t color,
                         const PP_Rect* clip,
                         PP_Bool image_data_is_opaque);
 
+ private:
   scoped_ptr<WebKit::WebFont> font_;
 
-  DISALLOW_COPY_AND_ASSIGN(PPB_BrowserFont_Trusted_Shared);
+  DISALLOW_COPY_AND_ASSIGN(BrowserFontResource_Trusted);
 };
 
+}  // namespace proxy
 }  // namespace ppapi
 
-#endif  // PPAPI_SHARED_IMPL_PRIVATE_PPB_BROWSER_FONT_TRUSTED_SHARED_H_
+#endif  // PPAPI_PROXY_BROWSER_FONT_TRUSTED_RESOURCE_H_
diff --git a/ppapi/proxy/browser_font_singleton_resource.cc b/ppapi/proxy/browser_font_singleton_resource.cc
new file mode 100644
index 0000000..0805126
--- /dev/null
+++ b/ppapi/proxy/browser_font_singleton_resource.cc
@@ -0,0 +1,38 @@
+// 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 "ppapi/proxy/browser_font_singleton_resource.h"
+
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/var.h"
+
+namespace ppapi {
+namespace proxy {
+
+BrowserFontSingletonResource::BrowserFontSingletonResource(
+    Connection connection,
+    PP_Instance instance)
+    : PluginResource(connection, instance) {
+  SendCreate(BROWSER, PpapiHostMsg_BrowserFontSingleton_Create());
+}
+
+BrowserFontSingletonResource::~BrowserFontSingletonResource() {
+}
+
+thunk::PPB_BrowserFont_Singleton_API*
+BrowserFontSingletonResource::AsPPB_BrowserFont_Singleton_API() {
+  return this;
+}
+
+PP_Var BrowserFontSingletonResource::GetFontFamilies(PP_Instance instance) {
+  if (families_.empty()) {
+    SyncCall<PpapiPluginMsg_BrowserFontSingleton_GetFontFamiliesReply>(
+        BROWSER, PpapiHostMsg_BrowserFontSingleton_GetFontFamilies(),
+        &families_);
+  }
+  return StringVar::StringToPPVar(families_);
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/browser_font_singleton_resource.h b/ppapi/proxy/browser_font_singleton_resource.h
new file mode 100644
index 0000000..50b88dc
--- /dev/null
+++ b/ppapi/proxy/browser_font_singleton_resource.h
@@ -0,0 +1,42 @@
+// 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 PPAPI_PROXY_BROWSER_FONT_SINGLETON_RESOURCE_H_
+#define PPAPI_PROXY_BROWSER_FONT_SINGLETON_RESOURCE_H_
+
+#include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/thunk/ppb_browser_font_singleton_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+// This handles the singleton calls (that don't take a PP_Resource parameter)
+// on the browser font interface
+class BrowserFontSingletonResource
+    : public PluginResource,
+      public thunk::PPB_BrowserFont_Singleton_API {
+ public:
+  BrowserFontSingletonResource(Connection connection, PP_Instance instance);
+  virtual ~BrowserFontSingletonResource();
+
+  // Resource override.
+  virtual thunk::PPB_BrowserFont_Singleton_API*
+      AsPPB_BrowserFont_Singleton_API() OVERRIDE;
+
+  // thunk::PPB_BrowserFontSingleton_API implementation.
+  virtual PP_Var GetFontFamilies(PP_Instance instance) OVERRIDE;
+
+ private:
+  // Lazily-filled-in list of font families.
+  std::string families_;
+
+  DISALLOW_COPY_AND_ASSIGN(BrowserFontSingletonResource);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_BROWSER_FONT_SINGLETON_RESOURCE_H_
+
diff --git a/ppapi/proxy/device_enumeration_resource_helper.cc b/ppapi/proxy/device_enumeration_resource_helper.cc
new file mode 100644
index 0000000..2729406
--- /dev/null
+++ b/ppapi/proxy/device_enumeration_resource_helper.cc
@@ -0,0 +1,223 @@
+// 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 "ppapi/proxy/device_enumeration_resource_helper.h"
+
+#include "base/bind.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "ipc/ipc_message.h"
+#include "ipc/ipc_message_macros.h"
+#include "ppapi/c/pp_array_output.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/dispatch_reply_message.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/resource_message_params.h"
+#include "ppapi/shared_impl/array_writer.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/ppb_device_ref_shared.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/shared_impl/resource_tracker.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+
+namespace ppapi {
+namespace proxy {
+
+DeviceEnumerationResourceHelper::DeviceEnumerationResourceHelper(
+    PluginResource* owner)
+    : owner_(owner),
+      pending_enumerate_devices_(false),
+      monitor_callback_id_(0),
+      monitor_user_data_(NULL) {
+}
+
+DeviceEnumerationResourceHelper::~DeviceEnumerationResourceHelper() {
+}
+
+int32_t DeviceEnumerationResourceHelper::EnumerateDevices0_2(
+    PP_Resource* devices,
+    scoped_refptr<TrackedCallback> callback) {
+  if (pending_enumerate_devices_)
+    return PP_ERROR_INPROGRESS;
+  if (!devices)
+    return PP_ERROR_BADARGUMENT;
+
+  pending_enumerate_devices_ = true;
+  PpapiHostMsg_DeviceEnumeration_EnumerateDevices msg;
+  owner_->Call<PpapiPluginMsg_DeviceEnumeration_EnumerateDevicesReply>(
+      PluginResource::RENDERER, msg,
+      base::Bind(
+          &DeviceEnumerationResourceHelper::OnPluginMsgEnumerateDevicesReply0_2,
+          AsWeakPtr(), devices, callback));
+  return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t DeviceEnumerationResourceHelper::EnumerateDevices(
+    const PP_ArrayOutput& output,
+    scoped_refptr<TrackedCallback> callback) {
+  if (pending_enumerate_devices_)
+    return PP_ERROR_INPROGRESS;
+
+  pending_enumerate_devices_ = true;
+  PpapiHostMsg_DeviceEnumeration_EnumerateDevices msg;
+  owner_->Call<PpapiPluginMsg_DeviceEnumeration_EnumerateDevicesReply>(
+      PluginResource::RENDERER, msg,
+      base::Bind(
+          &DeviceEnumerationResourceHelper::OnPluginMsgEnumerateDevicesReply,
+          AsWeakPtr(), output, callback));
+  return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t DeviceEnumerationResourceHelper::EnumerateDevicesSync(
+    const PP_ArrayOutput& output) {
+  std::vector<DeviceRefData> devices;
+  int32_t result =
+      owner_->SyncCall<PpapiPluginMsg_DeviceEnumeration_EnumerateDevicesReply>(
+          PluginResource::RENDERER,
+          PpapiHostMsg_DeviceEnumeration_EnumerateDevices(),
+          &devices);
+
+  if (result == PP_OK)
+    result = WriteToArrayOutput(devices, output);
+
+  return result;
+}
+
+int32_t DeviceEnumerationResourceHelper::MonitorDeviceChange(
+    PP_MonitorDeviceChangeCallback callback,
+    void* user_data) {
+  monitor_callback_id_++;
+  monitor_user_data_ = user_data;
+  if (callback) {
+    monitor_callback_.reset(
+        ThreadAwareCallback<PP_MonitorDeviceChangeCallback>::Create(callback));
+    if (!monitor_callback_.get())
+      return PP_ERROR_NO_MESSAGE_LOOP;
+
+    owner_->Post(PluginResource::RENDERER,
+                 PpapiHostMsg_DeviceEnumeration_MonitorDeviceChange(
+                     monitor_callback_id_));
+  } else {
+    monitor_callback_.reset(NULL);
+
+    owner_->Post(PluginResource::RENDERER,
+                 PpapiHostMsg_DeviceEnumeration_StopMonitoringDeviceChange());
+  }
+  return PP_OK;
+}
+
+bool DeviceEnumerationResourceHelper::HandleReply(
+    const ResourceMessageReplyParams& params,
+    const IPC::Message& msg) {
+  IPC_BEGIN_MESSAGE_MAP(DeviceEnumerationResourceHelper, msg)
+    PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL(
+        PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange,
+        OnPluginMsgNotifyDeviceChange)
+    PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL_UNHANDLED(return false)
+  IPC_END_MESSAGE_MAP()
+
+  return true;
+}
+
+void DeviceEnumerationResourceHelper::LastPluginRefWasDeleted() {
+  // Make sure that no further notifications are sent to the plugin.
+  monitor_callback_id_++;
+  monitor_callback_.reset(NULL);
+  monitor_user_data_ = NULL;
+
+  // There is no need to do anything with pending callback of
+  // EnumerateDevices(), because OnPluginMsgEnumerateDevicesReply*() will handle
+  // that properly.
+}
+
+void DeviceEnumerationResourceHelper::OnPluginMsgEnumerateDevicesReply0_2(
+    PP_Resource* devices_resource,
+    scoped_refptr<TrackedCallback> callback,
+    const ResourceMessageReplyParams& params,
+    const std::vector<DeviceRefData>& devices) {
+  pending_enumerate_devices_ = false;
+
+  // We shouldn't access |devices_resource| if the callback has been called,
+  // which is possible if the last plugin reference to the corresponding
+  // resource has gone away, and the callback has been aborted.
+  if (!TrackedCallback::IsPending(callback))
+    return;
+
+  if (params.result() == PP_OK) {
+    *devices_resource = PPB_DeviceRef_Shared::CreateResourceArray(
+        OBJECT_IS_PROXY, owner_->pp_instance(), devices);
+  }
+
+  callback->Run(params.result());
+}
+
+void DeviceEnumerationResourceHelper::OnPluginMsgEnumerateDevicesReply(
+    const PP_ArrayOutput& output,
+    scoped_refptr<TrackedCallback> callback,
+    const ResourceMessageReplyParams& params,
+    const std::vector<DeviceRefData>& devices) {
+  pending_enumerate_devices_ = false;
+
+  // We shouldn't access |output| if the callback has been called, which is
+  // possible if the last plugin reference to the corresponding resource has
+  // gone away, and the callback has been aborted.
+  if (!TrackedCallback::IsPending(callback))
+    return;
+
+  int32_t result = params.result();
+  if (result == PP_OK)
+    result = WriteToArrayOutput(devices, output);
+
+  callback->Run(result);
+}
+
+void DeviceEnumerationResourceHelper::OnPluginMsgNotifyDeviceChange(
+    const ResourceMessageReplyParams& /* params */,
+    uint32_t callback_id,
+    const std::vector<DeviceRefData>& devices) {
+  if (monitor_callback_id_ != callback_id) {
+    // A new callback or NULL has been set.
+    return;
+  }
+
+  CHECK(monitor_callback_.get());
+
+  scoped_array<PP_Resource> elements;
+  uint32_t size = devices.size();
+  if (size > 0) {
+    elements.reset(new PP_Resource[size]);
+    for (size_t index = 0; index < size; ++index) {
+      PPB_DeviceRef_Shared* device_object = new PPB_DeviceRef_Shared(
+          OBJECT_IS_PROXY, owner_->pp_instance(), devices[index]);
+      elements[index] = device_object->GetReference();
+    }
+  }
+
+  monitor_callback_->RunOnTargetThread(monitor_user_data_, size,
+                                       elements.get());
+  for (size_t index = 0; index < size; ++index)
+    PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(elements[index]);
+}
+
+int32_t DeviceEnumerationResourceHelper::WriteToArrayOutput(
+    const std::vector<DeviceRefData>& devices,
+    const PP_ArrayOutput& output) {
+  ArrayWriter writer(output);
+  if (!writer.is_valid())
+    return PP_ERROR_BADARGUMENT;
+
+  std::vector<scoped_refptr<Resource> > device_resources;
+  for (size_t i = 0; i < devices.size(); ++i) {
+    device_resources.push_back(new PPB_DeviceRef_Shared(
+        OBJECT_IS_PROXY, owner_->pp_instance(), devices[i]));
+  }
+  if (!writer.StoreResourceVector(device_resources))
+    return PP_ERROR_FAILED;
+
+  return PP_OK;
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/device_enumeration_resource_helper.h b/ppapi/proxy/device_enumeration_resource_helper.h
new file mode 100644
index 0000000..a2574ec
--- /dev/null
+++ b/ppapi/proxy/device_enumeration_resource_helper.h
@@ -0,0 +1,88 @@
+// 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 PPAPI_PROXY_DEVICE_ENUMERATION_RESOURCE_HELPER_H_
+#define PPAPI_PROXY_DEVICE_ENUMERATION_RESOURCE_HELPER_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "ppapi/c/dev/ppb_device_ref_dev.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/shared_impl/thread_aware_callback.h"
+
+namespace IPC {
+class Message;
+}
+
+struct PP_ArrayOutput;
+
+namespace ppapi {
+
+struct DeviceRefData;
+class TrackedCallback;
+
+namespace proxy {
+
+class PluginResource;
+class ResourceMessageReplyParams;
+
+class PPAPI_PROXY_EXPORT DeviceEnumerationResourceHelper
+    : public base::SupportsWeakPtr<DeviceEnumerationResourceHelper> {
+ public:
+  // |owner| must outlive this object.
+  explicit DeviceEnumerationResourceHelper(PluginResource* owner);
+  ~DeviceEnumerationResourceHelper();
+
+  int32_t EnumerateDevices0_2(PP_Resource* devices,
+                              scoped_refptr<TrackedCallback> callback);
+  int32_t EnumerateDevices(const PP_ArrayOutput& output,
+                           scoped_refptr<TrackedCallback> callback);
+  int32_t EnumerateDevicesSync(const PP_ArrayOutput& output);
+  int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback,
+                              void* user_data);
+
+  // Returns true if the message has been handled.
+  bool HandleReply(const ResourceMessageReplyParams& params,
+                   const IPC::Message& msg);
+
+  void LastPluginRefWasDeleted();
+
+ private:
+  void OnPluginMsgEnumerateDevicesReply0_2(
+      PP_Resource* devices_resource,
+      scoped_refptr<TrackedCallback> callback,
+      const ResourceMessageReplyParams& params,
+      const std::vector<DeviceRefData>& devices);
+  void OnPluginMsgEnumerateDevicesReply(
+      const PP_ArrayOutput& output,
+      scoped_refptr<TrackedCallback> callback,
+      const ResourceMessageReplyParams& params,
+      const std::vector<DeviceRefData>& devices);
+  void OnPluginMsgNotifyDeviceChange(const ResourceMessageReplyParams& params,
+                                     uint32_t callback_id,
+                                     const std::vector<DeviceRefData>& devices);
+
+  int32_t WriteToArrayOutput(const std::vector<DeviceRefData>& devices,
+                             const PP_ArrayOutput& output);
+
+  // Not owned by this object.
+  PluginResource* owner_;
+
+  bool pending_enumerate_devices_;
+
+  uint32_t monitor_callback_id_;
+  scoped_ptr<ThreadAwareCallback<PP_MonitorDeviceChangeCallback> >
+      monitor_callback_;
+  void* monitor_user_data_;
+
+  DISALLOW_COPY_AND_ASSIGN(DeviceEnumerationResourceHelper);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_DEVICE_ENUMERATION_RESOURCE_HELPER_H_
diff --git a/ppapi/proxy/device_enumeration_resource_helper_unittest.cc b/ppapi/proxy/device_enumeration_resource_helper_unittest.cc
new file mode 100644
index 0000000..330bca3
--- /dev/null
+++ b/ppapi/proxy/device_enumeration_resource_helper_unittest.cc
@@ -0,0 +1,386 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/device_enumeration_resource_helper.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/plugin_resource_tracker.h"
+#include "ppapi/proxy/plugin_var_tracker.h"
+#include "ppapi/proxy/ppapi_message_utils.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/ppapi_proxy_test.h"
+#include "ppapi/shared_impl/ppb_device_ref_shared.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_device_ref_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+
+typedef PluginProxyTest DeviceEnumerationResourceHelperTest;
+
+Connection GetConnection(PluginProxyTestHarness* harness) {
+  CHECK(harness->GetGlobals()->IsPluginGlobals());
+
+  return Connection(
+      static_cast<PluginGlobals*>(harness->GetGlobals())->GetBrowserSender(),
+      harness->plugin_dispatcher());
+}
+
+bool CompareDeviceRef(PluginVarTracker* var_tracker,
+                      PP_Resource resource,
+                      const DeviceRefData& expected) {
+  thunk::EnterResource<thunk::PPB_DeviceRef_API> enter(resource, true);
+  if (enter.failed())
+    return false;
+
+  if (expected.type != enter.object()->GetType())
+    return false;
+
+  PP_Var name_pp_var = enter.object()->GetName();
+  bool result = false;
+  do {
+    Var* name_var = var_tracker->GetVar(name_pp_var);
+    if (!name_var)
+      break;
+    StringVar* name_string_var = name_var->AsStringVar();
+    if (!name_string_var)
+      break;
+    if (expected.name != name_string_var->value())
+      break;
+
+    result = true;
+  } while (false);
+  var_tracker->ReleaseVar(name_pp_var);
+  return result;
+}
+
+class TestResource : public PluginResource {
+ public:
+  TestResource(Connection connection, PP_Instance instance)
+      : PluginResource(connection, instance),
+        ALLOW_THIS_IN_INITIALIZER_LIST(device_enumeration_(this)) {
+  }
+
+  virtual ~TestResource() {}
+
+  virtual void OnReplyReceived(const ResourceMessageReplyParams& params,
+                               const IPC::Message& msg) OVERRIDE {
+    if (!device_enumeration_.HandleReply(params, msg))
+      PluginResource::OnReplyReceived(params, msg);
+  }
+
+  DeviceEnumerationResourceHelper& device_enumeration() {
+    return device_enumeration_;
+  }
+
+ private:
+  DeviceEnumerationResourceHelper device_enumeration_;
+
+  DISALLOW_COPY_AND_ASSIGN(TestResource);
+};
+
+class TestCallback {
+ public:
+  TestCallback() : called_(false), result_(PP_ERROR_FAILED) {
+  }
+  ~TestCallback() {
+    CHECK(called_);
+  }
+
+  PP_CompletionCallback MakeCompletionCallback() {
+    return PP_MakeCompletionCallback(&CompletionCallbackBody, this);
+  }
+
+  bool called() const { return called_; }
+  int32_t result() const { return result_; }
+
+ private:
+  static void CompletionCallbackBody(void* user_data, int32_t result) {
+    TestCallback* callback = static_cast<TestCallback*>(user_data);
+
+    CHECK(!callback->called_);
+    callback->called_ = true;
+    callback->result_ = result;
+  }
+
+  bool called_;
+  int32_t result_;
+
+  DISALLOW_COPY_AND_ASSIGN(TestCallback);
+};
+
+class TestArrayOutput {
+ public:
+  explicit TestArrayOutput(PluginResourceTracker* resource_tracker)
+      : data_(NULL),
+        count_(0),
+        resource_tracker_(resource_tracker) {
+  }
+
+  ~TestArrayOutput() {
+    if (count_ > 0) {
+      for (size_t i = 0; i < count_; ++i)
+        resource_tracker_->ReleaseResource(data_[i]);
+      delete [] data_;
+    }
+  }
+
+  PP_ArrayOutput MakeArrayOutput() {
+    PP_ArrayOutput array_output = { &GetDataBuffer, this };
+    return array_output;
+  }
+
+  const PP_Resource* data() const { return data_; }
+  uint32_t count() const { return count_; }
+
+ private:
+  static void* GetDataBuffer(void* user_data,
+                             uint32_t element_count,
+                             uint32_t element_size) {
+    CHECK_EQ(element_size, sizeof(PP_Resource));
+
+    TestArrayOutput* output = static_cast<TestArrayOutput*>(user_data);
+    CHECK(!output->data_);
+
+    output->count_ = element_count;
+    if (element_count > 0)
+      output->data_ = new PP_Resource[element_count];
+    else
+      output->data_ = NULL;
+
+    return output->data_;
+  }
+
+  PP_Resource* data_;
+  uint32_t count_;
+  PluginResourceTracker* resource_tracker_;
+
+  DISALLOW_COPY_AND_ASSIGN(TestArrayOutput);
+};
+
+class TestMonitorDeviceChange {
+ public:
+  explicit TestMonitorDeviceChange(PluginVarTracker* var_tracker)
+      : called_(false),
+        same_as_expected_(false),
+        var_tracker_(var_tracker) {
+  }
+
+  ~TestMonitorDeviceChange() {}
+
+  void SetExpectedResult(const std::vector<DeviceRefData>& expected) {
+    called_ = false;
+    same_as_expected_ = false;
+    expected_ = expected;
+  }
+
+  bool called() const { return called_; }
+
+  bool same_as_expected() const { return same_as_expected_; }
+
+  static void MonitorDeviceChangeCallback(void* user_data,
+                                          uint32_t device_count,
+                                          const PP_Resource devices[]) {
+    TestMonitorDeviceChange* helper =
+        static_cast<TestMonitorDeviceChange*>(user_data);
+    CHECK(!helper->called_);
+
+    helper->called_ = true;
+    helper->same_as_expected_ = false;
+    if (device_count != helper->expected_.size())
+      return;
+    for (size_t i = 0; i < device_count; ++i) {
+      if (!CompareDeviceRef(helper->var_tracker_, devices[i],
+                            helper->expected_[i])) {
+        return;
+      }
+    }
+    helper->same_as_expected_ = true;
+  }
+
+ private:
+  bool called_;
+  bool same_as_expected_;
+  std::vector<DeviceRefData> expected_;
+  PluginVarTracker* var_tracker_;
+
+  DISALLOW_COPY_AND_ASSIGN(TestMonitorDeviceChange);
+};
+
+}  // namespace
+
+TEST_F(DeviceEnumerationResourceHelperTest, EnumerateDevices) {
+  scoped_refptr<TestResource> resource(
+      new TestResource(GetConnection(this), pp_instance()));
+  DeviceEnumerationResourceHelper& device_enumeration =
+      resource->device_enumeration();
+
+  TestArrayOutput output(&resource_tracker());
+  TestCallback callback;
+  scoped_refptr<TrackedCallback> tracked_callback(
+      new TrackedCallback(resource.get(), callback.MakeCompletionCallback()));
+  int32_t result = device_enumeration.EnumerateDevices(output.MakeArrayOutput(),
+                                                       tracked_callback);
+  ASSERT_EQ(PP_OK_COMPLETIONPENDING, result);
+
+  // Should have sent an EnumerateDevices message.
+  ResourceMessageCallParams params;
+  IPC::Message msg;
+  ASSERT_TRUE(sink().GetFirstResourceCallMatching(
+      PpapiHostMsg_DeviceEnumeration_EnumerateDevices::ID, &params, &msg));
+
+  // Synthesize a response.
+  ResourceMessageReplyParams reply_params(params.pp_resource(),
+                                          params.sequence());
+  reply_params.set_result(PP_OK);
+  std::vector<DeviceRefData> data;
+  DeviceRefData data_item;
+  data_item.type = PP_DEVICETYPE_DEV_AUDIOCAPTURE;
+  data_item.name = "name_1";
+  data_item.id = "id_1";
+  data.push_back(data_item);
+  data_item.type = PP_DEVICETYPE_DEV_VIDEOCAPTURE;
+  data_item.name = "name_2";
+  data_item.id = "id_2";
+  data.push_back(data_item);
+
+  ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
+      PpapiPluginMsg_ResourceReply(
+          reply_params,
+          PpapiPluginMsg_DeviceEnumeration_EnumerateDevicesReply(data))));
+
+  EXPECT_TRUE(callback.called());
+  EXPECT_EQ(PP_OK, callback.result());
+  EXPECT_EQ(2U, output.count());
+  for (size_t i = 0; i < output.count(); ++i)
+    EXPECT_TRUE(CompareDeviceRef(&var_tracker(), output.data()[i], data[i]));
+}
+
+TEST_F(DeviceEnumerationResourceHelperTest, MonitorDeviceChange) {
+  scoped_refptr<TestResource> resource(
+      new TestResource(GetConnection(this), pp_instance()));
+  DeviceEnumerationResourceHelper& device_enumeration =
+      resource->device_enumeration();
+
+  TestMonitorDeviceChange helper(&var_tracker());
+
+  int32_t result = device_enumeration.MonitorDeviceChange(
+      &TestMonitorDeviceChange::MonitorDeviceChangeCallback, &helper);
+  ASSERT_EQ(PP_OK, result);
+
+  // Should have sent a MonitorDeviceChange message.
+  ResourceMessageCallParams params;
+  IPC::Message msg;
+  ASSERT_TRUE(sink().GetFirstResourceCallMatching(
+      PpapiHostMsg_DeviceEnumeration_MonitorDeviceChange::ID, &params, &msg));
+  sink().ClearMessages();
+
+  uint32_t callback_id = 0;
+  ASSERT_TRUE(UnpackMessage<PpapiHostMsg_DeviceEnumeration_MonitorDeviceChange>(
+      msg, &callback_id));
+
+  ResourceMessageReplyParams reply_params(params.pp_resource(), 0);
+  reply_params.set_result(PP_OK);
+  std::vector<DeviceRefData> data;
+
+  helper.SetExpectedResult(data);
+
+  // Synthesize a response with no device.
+  ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
+      PpapiPluginMsg_ResourceReply(
+          reply_params,
+          PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
+              callback_id, data))));
+  EXPECT_TRUE(helper.called() && helper.same_as_expected());
+
+  DeviceRefData data_item;
+  data_item.type = PP_DEVICETYPE_DEV_AUDIOCAPTURE;
+  data_item.name = "name_1";
+  data_item.id = "id_1";
+  data.push_back(data_item);
+  data_item.type = PP_DEVICETYPE_DEV_VIDEOCAPTURE;
+  data_item.name = "name_2";
+  data_item.id = "id_2";
+  data.push_back(data_item);
+
+  helper.SetExpectedResult(data);
+
+  // Synthesize a response with some devices.
+  ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
+      PpapiPluginMsg_ResourceReply(
+          reply_params,
+          PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
+              callback_id, data))));
+  EXPECT_TRUE(helper.called() && helper.same_as_expected());
+
+  TestMonitorDeviceChange helper2(&var_tracker());
+
+  result = device_enumeration.MonitorDeviceChange(
+      &TestMonitorDeviceChange::MonitorDeviceChangeCallback, &helper2);
+  ASSERT_EQ(PP_OK, result);
+
+  // Should have sent another MonitorDeviceChange message.
+  ResourceMessageCallParams params2;
+  IPC::Message msg2;
+  ASSERT_TRUE(sink().GetFirstResourceCallMatching(
+      PpapiHostMsg_DeviceEnumeration_MonitorDeviceChange::ID, &params2, &msg2));
+  sink().ClearMessages();
+
+  uint32_t callback_id2 = 0;
+  ASSERT_TRUE(UnpackMessage<PpapiHostMsg_DeviceEnumeration_MonitorDeviceChange>(
+      msg2, &callback_id2));
+
+  helper.SetExpectedResult(data);
+  helper2.SetExpectedResult(data);
+  // |helper2| should receive the result while |helper| shouldn't.
+  ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
+      PpapiPluginMsg_ResourceReply(
+          reply_params,
+          PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
+              callback_id2, data))));
+  EXPECT_TRUE(helper2.called() && helper2.same_as_expected());
+  EXPECT_FALSE(helper.called());
+
+  helper.SetExpectedResult(data);
+  helper2.SetExpectedResult(data);
+  // Even if a message with |callback_id| arrives. |helper| shouldn't receive
+  // the result.
+  ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
+      PpapiPluginMsg_ResourceReply(
+          reply_params,
+          PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
+              callback_id, data))));
+  EXPECT_FALSE(helper2.called());
+  EXPECT_FALSE(helper.called());
+
+  result = device_enumeration.MonitorDeviceChange(NULL, NULL);
+  ASSERT_EQ(PP_OK, result);
+
+  // Should have sent a StopMonitoringDeviceChange message.
+  ResourceMessageCallParams params3;
+  IPC::Message msg3;
+  ASSERT_TRUE(sink().GetFirstResourceCallMatching(
+      PpapiHostMsg_DeviceEnumeration_StopMonitoringDeviceChange::ID,
+      &params3, &msg3));
+  sink().ClearMessages();
+
+  helper2.SetExpectedResult(data);
+  // |helper2| shouldn't receive any result any more.
+  ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
+      PpapiPluginMsg_ResourceReply(
+          reply_params,
+          PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
+              callback_id2, data))));
+  EXPECT_FALSE(helper2.called());
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/directory_reader_resource.cc b/ppapi/proxy/directory_reader_resource.cc
new file mode 100644
index 0000000..17826d0
--- /dev/null
+++ b/ppapi/proxy/directory_reader_resource.cc
@@ -0,0 +1,108 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/directory_reader_resource.h"
+
+#include "base/bind.h"
+#include "ipc/ipc_message.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/dispatch_reply_message.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/ppb_file_ref_proxy.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/resource_tracker.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_file_ref_api.h"
+
+using ppapi::proxy::PPB_FileRef_Proxy;
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+
+void ReleaseEntries(const std::vector<PP_DirectoryEntry_Dev>& entries) {
+  ResourceTracker* tracker = PpapiGlobals::Get()->GetResourceTracker();
+  for (std::vector<PP_DirectoryEntry_Dev>::const_iterator it = entries.begin();
+       it != entries.end(); ++it)
+    tracker->ReleaseResource(it->file_ref);
+}
+
+}  // namespace
+
+DirectoryReaderResource::DirectoryReaderResource(
+    Connection connection,
+    PP_Instance instance,
+    PP_Resource directory_ref)
+    : PluginResource(connection, instance) {
+  directory_resource_ =
+      PpapiGlobals::Get()->GetResourceTracker()->GetResource(directory_ref);
+}
+
+DirectoryReaderResource::~DirectoryReaderResource() {
+}
+
+thunk::PPB_DirectoryReader_API*
+DirectoryReaderResource::AsPPB_DirectoryReader_API() {
+  return this;
+}
+
+int32_t DirectoryReaderResource::ReadEntries(
+    const PP_ArrayOutput& output,
+    scoped_refptr<TrackedCallback> callback) {
+  if (TrackedCallback::IsPending(callback_))
+    return PP_ERROR_INPROGRESS;
+
+  callback_ = callback;
+
+  if (!sent_create_to_renderer())
+    SendCreate(RENDERER, PpapiHostMsg_DirectoryReader_Create());
+
+  PpapiHostMsg_DirectoryReader_GetEntries msg(
+      directory_resource_->host_resource());
+  Call<PpapiPluginMsg_DirectoryReader_GetEntriesReply>(
+      RENDERER, msg,
+      base::Bind(&DirectoryReaderResource::OnPluginMsgGetEntriesReply,
+                 this, output));
+  return PP_OK_COMPLETIONPENDING;
+}
+
+void DirectoryReaderResource::OnPluginMsgGetEntriesReply(
+    const PP_ArrayOutput& output,
+    const ResourceMessageReplyParams& params,
+    const std::vector<ppapi::PPB_FileRef_CreateInfo>& infos,
+    const std::vector<PP_FileType>& file_types) {
+  CHECK_EQ(infos.size(), file_types.size());
+
+  std::vector<PP_DirectoryEntry_Dev> entries;
+  for (std::vector<ppapi::PPB_FileRef_CreateInfo>::size_type i = 0;
+       i < infos.size(); ++i) {
+    PP_DirectoryEntry_Dev entry;
+    entry.file_ref = PPB_FileRef_Proxy::DeserializeFileRef(infos[i]);
+    entry.file_type = file_types[i];
+    entries.push_back(entry);
+  }
+
+  if (!TrackedCallback::IsPending(callback_)) {
+    ReleaseEntries(entries);
+    entries.clear();
+    return;
+  }
+
+  ArrayWriter writer(output);
+  if (!writer.is_valid()) {
+    ReleaseEntries(entries);
+    entries.clear();
+    callback_->Run(PP_ERROR_FAILED);
+    return;
+  }
+
+  writer.StoreVector(entries);
+  entries.clear();
+  callback_->Run(params.result());
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/directory_reader_resource.h b/ppapi/proxy/directory_reader_resource.h
new file mode 100644
index 0000000..e532414
--- /dev/null
+++ b/ppapi/proxy/directory_reader_resource.h
@@ -0,0 +1,58 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_DIRECTORY_READER_RESOURCE_H_
+#define PPAPI_PROXY_DIRECTORY_READER_RESOURCE_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/shared_impl/array_writer.h"
+#include "ppapi/shared_impl/ppb_file_ref_shared.h"
+#include "ppapi/shared_impl/resource.h"
+#include "ppapi/thunk/ppb_directory_reader_api.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace proxy {
+
+class PPAPI_PROXY_EXPORT DirectoryReaderResource
+    : public PluginResource,
+      public NON_EXPORTED_BASE(thunk::PPB_DirectoryReader_API) {
+ public:
+  DirectoryReaderResource(Connection connection,
+                          PP_Instance instance,
+                          PP_Resource directory_ref);
+  virtual ~DirectoryReaderResource();
+
+  // Resource overrides.
+  virtual thunk::PPB_DirectoryReader_API* AsPPB_DirectoryReader_API() OVERRIDE;
+
+  // PPB_DirectoryReader_API.
+  virtual int32_t ReadEntries(
+      const PP_ArrayOutput& output,
+      scoped_refptr<TrackedCallback> callback) OVERRIDE;
+
+ private:
+  void OnPluginMsgGetEntriesReply(
+      const PP_ArrayOutput& output,
+      const ResourceMessageReplyParams& params,
+      const std::vector<ppapi::PPB_FileRef_CreateInfo>& infos,
+      const std::vector<PP_FileType>& file_types);
+
+  scoped_refptr<Resource> directory_resource_;
+  scoped_refptr<TrackedCallback> callback_;
+
+  DISALLOW_COPY_AND_ASSIGN(DirectoryReaderResource);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_DIRECTORY_READER_RESOURCE_H_
diff --git a/ppapi/proxy/file_chooser_resource.cc b/ppapi/proxy/file_chooser_resource.cc
index 6135aaa..ebd545c 100644
--- a/ppapi/proxy/file_chooser_resource.cc
+++ b/ppapi/proxy/file_chooser_resource.cc
@@ -5,7 +5,7 @@
 #include "ppapi/proxy/file_chooser_resource.h"
 
 #include "base/bind.h"
-#include "base/string_split.h"
+#include "base/strings/string_split.h"
 #include "ipc/ipc_message.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/proxy/dispatch_reply_message.h"
diff --git a/ppapi/proxy/file_chooser_resource_unittest.cc b/ppapi/proxy/file_chooser_resource_unittest.cc
index 10ac0b3..49c95da 100644
--- a/ppapi/proxy/file_chooser_resource_unittest.cc
+++ b/ppapi/proxy/file_chooser_resource_unittest.cc
@@ -8,10 +8,11 @@
 #include "ppapi/proxy/file_chooser_resource.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/proxy/ppapi_proxy_test.h"
-#include "ppapi/thunk/thunk.h"
+#include "ppapi/shared_impl/proxy_lock.h"
 #include "ppapi/shared_impl/scoped_pp_resource.h"
 #include "ppapi/shared_impl/scoped_pp_var.h"
 #include "ppapi/shared_impl/var.h"
+#include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
 namespace proxy {
@@ -110,14 +111,19 @@
   EXPECT_EQ(PP_FILESYSTEMTYPE_EXTERNAL,
             file_ref_iface->GetFileSystemType(dest[0]));
 
-  ScopedPPVar name_var(ScopedPPVar::PassRef(),
-                       file_ref_iface->GetName(dest[0]));
-  EXPECT_VAR_IS_STRING(create_info.name, name_var.get());
-
+  PP_Var name_var(file_ref_iface->GetName(dest[0]));
+  {
+    ProxyAutoLock lock;
+    ScopedPPVar release_name_var(ScopedPPVar::PassRef(), name_var);
+    EXPECT_VAR_IS_STRING(create_info.name, name_var);
+  }
   // Path should be undefined since it's external filesystem.
-  ScopedPPVar path_var(ScopedPPVar::PassRef(),
-                       file_ref_iface->GetPath(dest[0]));
-  EXPECT_EQ(PP_VARTYPE_UNDEFINED, path_var.get().type);
+  PP_Var path_var(file_ref_iface->GetPath(dest[0]));
+  {
+    ProxyAutoLock lock;
+    ScopedPPVar release_path_var(ScopedPPVar::PassRef(), path_var);
+    EXPECT_EQ(PP_VARTYPE_UNDEFINED, path_var.type);
+  }
 }
 
 TEST_F(FileChooserResourceTest, PopulateAcceptTypes) {
diff --git a/ppapi/proxy/file_io_resource.cc b/ppapi/proxy/file_io_resource.cc
new file mode 100644
index 0000000..77105a1
--- /dev/null
+++ b/ppapi/proxy/file_io_resource.cc
@@ -0,0 +1,291 @@
+// 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 "ppapi/proxy/file_io_resource.h"
+
+#include "base/bind.h"
+#include "ipc/ipc_message.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/array_writer.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/resource_tracker.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_file_ref_api.h"
+
+using ppapi::thunk::EnterResourceNoLock;
+using ppapi::thunk::PPB_FileIO_API;
+using ppapi::thunk::PPB_FileRef_API;
+
+namespace {
+
+// An adapter to let Read() share the same implementation with ReadToArray().
+void* DummyGetDataBuffer(void* user_data, uint32_t count, uint32_t size) {
+  return user_data;
+}
+
+}  // namespace
+
+namespace ppapi {
+namespace proxy {
+
+FileIOResource::FileIOResource(Connection connection, PP_Instance instance)
+    : PluginResource(connection, instance) {
+  SendCreate(RENDERER, PpapiHostMsg_FileIO_Create());
+}
+
+FileIOResource::~FileIOResource() {
+}
+
+PPB_FileIO_API* FileIOResource::AsPPB_FileIO_API() {
+  return this;
+}
+
+int32_t FileIOResource::Open(PP_Resource file_ref,
+                             int32_t open_flags,
+                             scoped_refptr<TrackedCallback> callback) {
+  EnterResourceNoLock<PPB_FileRef_API> enter(file_ref, true);
+  if (enter.failed())
+    return PP_ERROR_BADRESOURCE;
+
+  int32_t rv = state_manager_.CheckOperationState(
+      FileIOStateManager::OPERATION_EXCLUSIVE, false);
+  if (rv != PP_OK)
+    return rv;
+
+  Call<PpapiPluginMsg_FileIO_OpenReply>(RENDERER,
+      PpapiHostMsg_FileIO_Open(
+          enter.resource()->host_resource().host_resource(),
+          open_flags),
+      base::Bind(&FileIOResource::OnPluginMsgOpenFileComplete, this,
+                 callback));
+
+  state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
+  return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t FileIOResource::Query(PP_FileInfo* info,
+                              scoped_refptr<TrackedCallback> callback) {
+  int32_t rv = state_manager_.CheckOperationState(
+      FileIOStateManager::OPERATION_EXCLUSIVE, true);
+  if (rv != PP_OK)
+    return rv;
+
+  Call<PpapiPluginMsg_FileIO_QueryReply>(RENDERER,
+      PpapiHostMsg_FileIO_Query(),
+      base::Bind(&FileIOResource::OnPluginMsgQueryComplete, this,
+                 callback, info));
+
+  state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
+  return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t FileIOResource::Touch(PP_Time last_access_time,
+                              PP_Time last_modified_time,
+                              scoped_refptr<TrackedCallback> callback) {
+  int32_t rv = state_manager_.CheckOperationState(
+      FileIOStateManager::OPERATION_EXCLUSIVE, true);
+  if (rv != PP_OK)
+    return rv;
+
+  Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER,
+      PpapiHostMsg_FileIO_Touch(last_access_time, last_modified_time),
+      base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this,
+                 callback));
+
+  state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
+  return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t FileIOResource::Read(int64_t offset,
+                             char* buffer,
+                             int32_t bytes_to_read,
+                             scoped_refptr<TrackedCallback> callback) {
+  int32_t rv = state_manager_.CheckOperationState(
+      FileIOStateManager::OPERATION_READ, true);
+  if (rv != PP_OK)
+    return rv;
+
+  PP_ArrayOutput output_adapter;
+  output_adapter.GetDataBuffer = &DummyGetDataBuffer;
+  output_adapter.user_data = buffer;
+  state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_READ);
+  return ReadValidated(offset, bytes_to_read, output_adapter, callback);
+}
+
+int32_t FileIOResource::ReadToArray(int64_t offset,
+                                    int32_t max_read_length,
+                                    PP_ArrayOutput* array_output,
+                                    scoped_refptr<TrackedCallback> callback) {
+  DCHECK(array_output);
+  int32_t rv = state_manager_.CheckOperationState(
+      FileIOStateManager::OPERATION_READ, true);
+  if (rv != PP_OK)
+    return rv;
+
+  state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_READ);
+  return ReadValidated(offset, max_read_length, *array_output, callback);
+}
+
+int32_t FileIOResource::Write(int64_t offset,
+                              const char* buffer,
+                              int32_t bytes_to_write,
+                              scoped_refptr<TrackedCallback> callback) {
+  int32_t rv = state_manager_.CheckOperationState(
+      FileIOStateManager::OPERATION_WRITE, true);
+  if (rv != PP_OK)
+    return rv;
+
+  // TODO(brettw) it would be nice to use a shared memory buffer for large
+  // writes rather than having to copy to a string (which will involve a number
+  // of extra copies to serialize over IPC).
+  Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER,
+      PpapiHostMsg_FileIO_Write(offset, std::string(buffer, bytes_to_write)),
+      base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this,
+                 callback));
+
+  state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_WRITE);
+  return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t FileIOResource::SetLength(int64_t length,
+                                  scoped_refptr<TrackedCallback> callback) {
+  int32_t rv = state_manager_.CheckOperationState(
+      FileIOStateManager::OPERATION_EXCLUSIVE, true);
+  if (rv != PP_OK)
+    return rv;
+
+  Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER,
+      PpapiHostMsg_FileIO_SetLength(length),
+      base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this,
+                 callback));
+
+  state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
+  return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t FileIOResource::Flush(scoped_refptr<TrackedCallback> callback) {
+  int32_t rv = state_manager_.CheckOperationState(
+      FileIOStateManager::OPERATION_EXCLUSIVE, true);
+  if (rv != PP_OK)
+    return rv;
+
+  Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER,
+      PpapiHostMsg_FileIO_Flush(),
+      base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this,
+                 callback));
+
+  state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
+  return PP_OK_COMPLETIONPENDING;
+}
+
+void FileIOResource::Close() {
+  Post(RENDERER, PpapiHostMsg_FileIO_Close());
+}
+
+int32_t FileIOResource::GetOSFileDescriptor() {
+  int32_t file_descriptor;
+  // Only available when running in process.
+  SyncCall<PpapiPluginMsg_FileIO_GetOSFileDescriptorReply>(
+      RENDERER, PpapiHostMsg_FileIO_GetOSFileDescriptor(), &file_descriptor);
+  return file_descriptor;
+}
+
+int32_t FileIOResource::WillWrite(int64_t offset,
+                                  int32_t bytes_to_write,
+                                  scoped_refptr<TrackedCallback> callback) {
+  Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER,
+      PpapiHostMsg_FileIO_WillWrite(offset, bytes_to_write),
+      base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this,
+                 callback));
+  state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
+  return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t FileIOResource::WillSetLength(int64_t length,
+                                      scoped_refptr<TrackedCallback> callback) {
+  Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER,
+      PpapiHostMsg_FileIO_WillSetLength(length),
+      base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this,
+                 callback));
+  state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
+  return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t FileIOResource::ReadValidated(int64_t offset,
+                                      int32_t bytes_to_read,
+                                      const PP_ArrayOutput& array_output,
+                                      scoped_refptr<TrackedCallback> callback) {
+  Call<PpapiPluginMsg_FileIO_ReadReply>(RENDERER,
+      PpapiHostMsg_FileIO_Read(offset, bytes_to_read),
+      base::Bind(&FileIOResource::OnPluginMsgReadComplete, this,
+                 callback, array_output));
+  return PP_OK_COMPLETIONPENDING;
+}
+
+void FileIOResource::OnPluginMsgGeneralComplete(
+    scoped_refptr<TrackedCallback> callback,
+    const ResourceMessageReplyParams& params) {
+  DCHECK(state_manager_.get_pending_operation() ==
+         FileIOStateManager::OPERATION_EXCLUSIVE ||
+         state_manager_.get_pending_operation() ==
+         FileIOStateManager::OPERATION_WRITE);
+  // End the operation now. The callback may perform another file operation.
+  state_manager_.SetOperationFinished();
+  callback->Run(params.result());
+}
+
+void FileIOResource::OnPluginMsgOpenFileComplete(
+    scoped_refptr<TrackedCallback> callback,
+    const ResourceMessageReplyParams& params) {
+  DCHECK(state_manager_.get_pending_operation() ==
+         FileIOStateManager::OPERATION_EXCLUSIVE);
+  if (params.result() == PP_OK)
+    state_manager_.SetOpenSucceed();
+  // End the operation now. The callback may perform another file operation.
+  state_manager_.SetOperationFinished();
+  callback->Run(params.result());
+}
+
+void FileIOResource::OnPluginMsgQueryComplete(
+    scoped_refptr<TrackedCallback> callback,
+    PP_FileInfo* output_info,
+    const ResourceMessageReplyParams& params,
+    const PP_FileInfo& info) {
+  DCHECK(state_manager_.get_pending_operation() ==
+         FileIOStateManager::OPERATION_EXCLUSIVE);
+  *output_info = info;
+  // End the operation now. The callback may perform another file operation.
+  state_manager_.SetOperationFinished();
+  callback->Run(params.result());
+}
+
+void FileIOResource::OnPluginMsgReadComplete(
+    scoped_refptr<TrackedCallback> callback,
+    PP_ArrayOutput array_output,
+    const ResourceMessageReplyParams& params,
+    const std::string& data) {
+  DCHECK(state_manager_.get_pending_operation() ==
+         FileIOStateManager::OPERATION_READ);
+
+  // The result code should contain the data size if it's positive.
+  int32_t result = params.result();
+  DCHECK((result < 0 && data.size() == 0) ||
+         result == static_cast<int32_t>(data.size()));
+
+  ArrayWriter output;
+  output.set_pp_array_output(array_output);
+  if (output.is_valid())
+    output.StoreArray(data.data(), std::max(0, result));
+  else
+    result = PP_ERROR_FAILED;
+
+  // End the operation now. The callback may perform another file operation.
+  state_manager_.SetOperationFinished();
+  callback->Run(result);
+}
+
+}  // namespace proxy
+}  // namespace ppapi
+
diff --git a/ppapi/proxy/file_io_resource.h b/ppapi/proxy/file_io_resource.h
new file mode 100644
index 0000000..f5a1aa8
--- /dev/null
+++ b/ppapi/proxy/file_io_resource.h
@@ -0,0 +1,95 @@
+// 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 PPAPI_PROXY_FILE_IO_RESOURCE_H_
+#define PPAPI_PROXY_FILE_IO_RESOURCE_H_
+
+#include <string>
+
+#include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/shared_impl/file_io_state_manager.h"
+#include "ppapi/thunk/ppb_file_io_api.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace proxy {
+
+class PPAPI_PROXY_EXPORT FileIOResource
+    : public PluginResource,
+      public thunk::PPB_FileIO_API {
+ public:
+  FileIOResource(Connection connection, PP_Instance instance);
+  virtual ~FileIOResource();
+
+  // Resource overrides.
+  virtual thunk::PPB_FileIO_API* AsPPB_FileIO_API() OVERRIDE;
+
+  // PPB_FileIO_API implementation.
+  virtual int32_t Open(PP_Resource file_ref,
+                       int32_t open_flags,
+                       scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual int32_t Query(PP_FileInfo* info,
+                        scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual int32_t Touch(PP_Time last_access_time,
+                        PP_Time last_modified_time,
+                        scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual int32_t Read(int64_t offset,
+                       char* buffer,
+                       int32_t bytes_to_read,
+                       scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual int32_t ReadToArray(int64_t offset,
+                              int32_t max_read_length,
+                              PP_ArrayOutput* array_output,
+                              scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual int32_t Write(int64_t offset,
+                        const char* buffer,
+                        int32_t bytes_to_write,
+                        scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual int32_t SetLength(int64_t length,
+                            scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual void Close() OVERRIDE;
+  virtual int32_t GetOSFileDescriptor() OVERRIDE;
+  virtual int32_t WillWrite(int64_t offset,
+                            int32_t bytes_to_write,
+                            scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual int32_t WillSetLength(
+      int64_t length,
+      scoped_refptr<TrackedCallback> callback) OVERRIDE;
+
+ private:
+  int32_t ReadValidated(int64_t offset,
+                        int32_t bytes_to_read,
+                        const PP_ArrayOutput& array_output,
+                        scoped_refptr<TrackedCallback> callback);
+
+  // Handlers of reply messages. Note that all of them have a callback
+  // parameters bound when call to the host.
+  void OnPluginMsgGeneralComplete(scoped_refptr<TrackedCallback> callback,
+                                  const ResourceMessageReplyParams& params);
+  void OnPluginMsgOpenFileComplete(scoped_refptr<TrackedCallback> callback,
+                                   const ResourceMessageReplyParams& params);
+  void OnPluginMsgQueryComplete(scoped_refptr<TrackedCallback> callback,
+                                PP_FileInfo* output_info_,
+                                const ResourceMessageReplyParams& params,
+                                const PP_FileInfo& info);
+  void OnPluginMsgReadComplete(scoped_refptr<TrackedCallback> callback,
+                               PP_ArrayOutput array_output,
+                               const ResourceMessageReplyParams& params,
+                               const std::string& data);
+
+  FileIOStateManager state_manager_;
+
+  DISALLOW_COPY_AND_ASSIGN(FileIOResource);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_FILE_IO_RESOURCE_H_
+
diff --git a/ppapi/proxy/flash_clipboard_resource.cc b/ppapi/proxy/flash_clipboard_resource.cc
index 1ef90e2..5f06402 100644
--- a/ppapi/proxy/flash_clipboard_resource.cc
+++ b/ppapi/proxy/flash_clipboard_resource.cc
@@ -61,7 +61,7 @@
 FlashClipboardResource::FlashClipboardResource(
     Connection connection, PP_Instance instance)
     : PluginResource(connection, instance) {
-  SendCreate(RENDERER, PpapiHostMsg_FlashClipboard_Create());
+  SendCreate(BROWSER, PpapiHostMsg_FlashClipboard_Create());
 }
 
 FlashClipboardResource::~FlashClipboardResource() {
@@ -81,7 +81,7 @@
     return format;
   int32_t result =
       SyncCall<PpapiPluginMsg_FlashClipboard_RegisterCustomFormatReply>(
-          RENDERER,
+          BROWSER,
           PpapiHostMsg_FlashClipboard_RegisterCustomFormat(format_name),
           &format);
   if (result != PP_OK || format == PP_FLASH_CLIPBOARD_FORMAT_INVALID)
@@ -97,7 +97,7 @@
   if (IsValidClipboardType(clipboard_type) &&
       (FlashClipboardFormatRegistry::IsValidPredefinedFormat(format) ||
        clipboard_formats_.IsFormatRegistered(format))) {
-    int32_t result = SyncCall<IPC::Message>(RENDERER,
+    int32_t result = SyncCall<IPC::Message>(BROWSER,
         PpapiHostMsg_FlashClipboard_IsFormatAvailable(clipboard_type, format));
     return result == PP_OK ? PP_TRUE : PP_FALSE;
   }
@@ -111,7 +111,7 @@
   std::string value;
   int32_t result =
       SyncCall<PpapiPluginMsg_FlashClipboard_ReadDataReply>(
-          RENDERER,
+          BROWSER,
           PpapiHostMsg_FlashClipboard_ReadData(clipboard_type, format),
           &value);
   if (result != PP_OK)
@@ -142,7 +142,7 @@
     data_items_vector.push_back(string);
   }
 
-  Post(RENDERER,
+  Post(BROWSER,
        PpapiHostMsg_FlashClipboard_WriteData(
            static_cast<uint32_t>(clipboard_type),
            formats_vector,
diff --git a/ppapi/proxy/flash_file_resource.cc b/ppapi/proxy/flash_file_resource.cc
new file mode 100644
index 0000000..a7db4c0
--- /dev/null
+++ b/ppapi/proxy/flash_file_resource.cc
@@ -0,0 +1,231 @@
+// 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 "ppapi/proxy/flash_file_resource.h"
+
+#include "base/files/file_path.h"
+#include "ipc/ipc_message.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/file_type_conversion.h"
+#include "ppapi/shared_impl/scoped_pp_var.h"
+#include "ppapi/shared_impl/time_conversion.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/thunk/enter.h"
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+
+// Returns the path that a PPB_FileRef resource references as long as it is an
+// PP_FILESYSTEMTYPE_EXTERNAL path. Returns an empty string on error.
+std::string GetPathFromFileRef(PP_Resource file_ref) {
+  thunk::EnterResourceNoLock<thunk::PPB_FileRef_API> enter(file_ref, true);
+  if (enter.failed())
+    return std::string();
+  if (enter.object()->GetFileSystemType() != PP_FILESYSTEMTYPE_EXTERNAL)
+    return std::string();
+  ScopedPPVar var(ScopedPPVar::PassRef(), enter.object()->GetAbsolutePath());
+  StringVar* string_var = StringVar::FromPPVar(var.get());
+  if (!string_var)
+    return std::string();
+  return string_var->value();
+}
+
+}  // namespace
+
+FlashFileResource::FlashFileResource(Connection connection,
+                                     PP_Instance instance)
+    : PluginResource(connection, instance) {
+  SendCreate(BROWSER, PpapiHostMsg_FlashFile_Create());
+}
+
+FlashFileResource::~FlashFileResource() {
+}
+
+thunk::PPB_Flash_File_API* FlashFileResource::AsPPB_Flash_File_API() {
+  return this;
+}
+
+int32_t FlashFileResource::OpenFile(PP_Instance /*instance*/,
+                                    const char* path,
+                                    int32_t mode,
+                                    PP_FileHandle* file) {
+  return OpenFileHelper(path, PepperFilePath::DOMAIN_MODULE_LOCAL, mode, file);
+}
+
+int32_t FlashFileResource::RenameFile(PP_Instance /*instance*/,
+                                      const char* path_from,
+                                      const char* path_to) {
+  PepperFilePath pepper_from(PepperFilePath::DOMAIN_MODULE_LOCAL,
+                             base::FilePath::FromUTF8Unsafe(path_from));
+  PepperFilePath pepper_to(PepperFilePath::DOMAIN_MODULE_LOCAL,
+                           base::FilePath::FromUTF8Unsafe(path_to));
+
+  int32_t error = SyncCall<IPC::Message>(
+      BROWSER, PpapiHostMsg_FlashFile_RenameFile(pepper_from, pepper_to));
+
+  return error;
+}
+
+int32_t FlashFileResource::DeleteFileOrDir(PP_Instance /*instance*/,
+                                           const char* path,
+                                           PP_Bool recursive) {
+  PepperFilePath pepper_path(PepperFilePath::DOMAIN_MODULE_LOCAL,
+                             base::FilePath::FromUTF8Unsafe(path));
+
+  int32_t error = SyncCall<IPC::Message>(
+      BROWSER, PpapiHostMsg_FlashFile_DeleteFileOrDir(pepper_path,
+                                                      PP_ToBool(recursive)));
+
+  return error;
+}
+
+int32_t FlashFileResource::CreateDir(PP_Instance /*instance*/,
+                                     const char* path) {
+  PepperFilePath pepper_path(PepperFilePath::DOMAIN_MODULE_LOCAL,
+                             base::FilePath::FromUTF8Unsafe(path));
+
+  int32_t error = SyncCall<IPC::Message>(BROWSER,
+      PpapiHostMsg_FlashFile_CreateDir(pepper_path));
+
+  return error;
+}
+
+int32_t FlashFileResource::QueryFile(PP_Instance /*instance*/,
+                                     const char* path,
+                                     PP_FileInfo* info) {
+  return QueryFileHelper(path, PepperFilePath::DOMAIN_MODULE_LOCAL, info);
+}
+
+int32_t FlashFileResource::GetDirContents(PP_Instance /*instance*/,
+                                          const char* path,
+                                          PP_DirContents_Dev** contents) {
+  ppapi::DirContents entries;
+  PepperFilePath pepper_path(PepperFilePath::DOMAIN_MODULE_LOCAL,
+                             base::FilePath::FromUTF8Unsafe(path));
+
+  int32_t error = SyncCall<PpapiPluginMsg_FlashFile_GetDirContentsReply>(
+      BROWSER, PpapiHostMsg_FlashFile_GetDirContents(pepper_path), &entries);
+
+  if (error == PP_OK) {
+    // Copy the serialized dir entries to the output struct.
+    *contents = new PP_DirContents_Dev;
+    (*contents)->count = static_cast<int32_t>(entries.size());
+    (*contents)->entries = new PP_DirEntry_Dev[entries.size()];
+    for (size_t i = 0; i < entries.size(); i++) {
+      const ppapi::DirEntry& source = entries[i];
+      PP_DirEntry_Dev* dest = &(*contents)->entries[i];
+      std::string name = source.name.AsUTF8Unsafe();
+      char* name_copy = new char[name.size() + 1];
+      memcpy(name_copy, name.c_str(), name.size() + 1);
+      dest->name = name_copy;
+      dest->is_dir = PP_FromBool(source.is_dir);
+    }
+  }
+
+  return error;
+}
+
+void FlashFileResource::FreeDirContents(PP_Instance /*instance*/,
+                                        PP_DirContents_Dev* contents) {
+  for (int32_t i = 0; i < contents->count; ++i)
+    delete[] contents->entries[i].name;
+  delete[] contents->entries;
+  delete contents;
+}
+
+int32_t FlashFileResource::CreateTemporaryFile(PP_Instance /*instance*/,
+                                               PP_FileHandle* file) {
+  if (!file)
+    return PP_ERROR_BADARGUMENT;
+
+  IPC::Message unused;
+  ResourceMessageReplyParams reply_params;
+  int32_t error = GenericSyncCall(BROWSER,
+      PpapiHostMsg_FlashFile_CreateTemporaryFile(), &unused, &reply_params);
+  if (error != PP_OK)
+    return error;
+
+  IPC::PlatformFileForTransit transit_file;
+  if (!reply_params.TakeFileHandleAtIndex(0, &transit_file))
+    return PP_ERROR_FAILED;
+
+  *file = IPC::PlatformFileForTransitToPlatformFile(transit_file);
+  return PP_OK;
+}
+
+int32_t FlashFileResource::OpenFileRef(PP_Instance /*instance*/,
+                                       PP_Resource file_ref,
+                                       int32_t mode,
+                                       PP_FileHandle* file) {
+  return OpenFileHelper(GetPathFromFileRef(file_ref),
+                        PepperFilePath::DOMAIN_ABSOLUTE, mode, file);
+}
+
+int32_t FlashFileResource::QueryFileRef(PP_Instance /*instance*/,
+                                        PP_Resource file_ref,
+                                        PP_FileInfo* info) {
+  return QueryFileHelper(GetPathFromFileRef(file_ref),
+                         PepperFilePath::DOMAIN_ABSOLUTE, info);
+}
+
+int32_t FlashFileResource::OpenFileHelper(const std::string& path,
+                                          PepperFilePath::Domain domain_type,
+                                          int32_t mode,
+                                          PP_FileHandle* file) {
+  int flags = 0;
+  if (path.empty() ||
+      !ppapi::PepperFileOpenFlagsToPlatformFileFlags(mode, &flags) ||
+      !file)
+    return PP_ERROR_BADARGUMENT;
+
+  PepperFilePath pepper_path(domain_type, base::FilePath::FromUTF8Unsafe(path));
+
+  IPC::Message unused;
+  ResourceMessageReplyParams reply_params;
+  int32_t error = GenericSyncCall(BROWSER,
+      PpapiHostMsg_FlashFile_OpenFile(pepper_path, flags), &unused,
+      &reply_params);
+  if (error != PP_OK)
+    return error;
+
+  IPC::PlatformFileForTransit transit_file;
+  if (!reply_params.TakeFileHandleAtIndex(0, &transit_file))
+    return PP_ERROR_FAILED;
+
+  *file = IPC::PlatformFileForTransitToPlatformFile(transit_file);
+  return PP_OK;
+}
+
+int32_t FlashFileResource::QueryFileHelper(const std::string& path,
+                                           PepperFilePath::Domain domain_type,
+                                           PP_FileInfo* info) {
+  if (path.empty() || !info)
+    return PP_ERROR_BADARGUMENT;
+
+  base::PlatformFileInfo file_info;
+  PepperFilePath pepper_path(domain_type, base::FilePath::FromUTF8Unsafe(path));
+
+  int32_t error = SyncCall<PpapiPluginMsg_FlashFile_QueryFileReply>(BROWSER,
+      PpapiHostMsg_FlashFile_QueryFile(pepper_path), &file_info);
+
+  if (error == PP_OK) {
+    info->size = file_info.size;
+    info->creation_time = TimeToPPTime(file_info.creation_time);
+    info->last_access_time = TimeToPPTime(file_info.last_accessed);
+    info->last_modified_time = TimeToPPTime(file_info.last_modified);
+    info->system_type = PP_FILESYSTEMTYPE_EXTERNAL;
+    if (file_info.is_directory)
+      info->type = PP_FILETYPE_DIRECTORY;
+    else
+      info->type = PP_FILETYPE_REGULAR;
+  }
+
+  return error;
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/flash_file_resource.h b/ppapi/proxy/flash_file_resource.h
new file mode 100644
index 0000000..f8c4b18
--- /dev/null
+++ b/ppapi/proxy/flash_file_resource.h
@@ -0,0 +1,73 @@
+// 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 PPAPI_PROXY_FLASH_FILE_RESOURCE_H_
+#define PPAPI_PROXY_FLASH_FILE_RESOURCE_H_
+
+#include <string>
+
+#include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/shared_impl/file_path.h"
+#include "ppapi/thunk/ppb_flash_file_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+class FlashFileResource
+    : public PluginResource,
+      public thunk::PPB_Flash_File_API {
+ public:
+  FlashFileResource(Connection connection, PP_Instance instance);
+  virtual ~FlashFileResource();
+
+  // Resource overrides.
+  virtual thunk::PPB_Flash_File_API* AsPPB_Flash_File_API() OVERRIDE;
+
+  // PPB_Flash_Functions_API.
+  virtual int32_t OpenFile(PP_Instance instance,
+                           const char* path,
+                           int32_t mode,
+                           PP_FileHandle* file) OVERRIDE;
+  virtual int32_t RenameFile(PP_Instance instance,
+                             const char* path_from,
+                             const char* path_to) OVERRIDE;
+  virtual int32_t DeleteFileOrDir(PP_Instance instance,
+                                  const char* path,
+                                  PP_Bool recursive) OVERRIDE;
+  virtual int32_t CreateDir(PP_Instance instance, const char* path) OVERRIDE;
+  virtual int32_t QueryFile(PP_Instance instance,
+                            const char* path,
+                            PP_FileInfo* info) OVERRIDE;
+  virtual int32_t GetDirContents(PP_Instance instance,
+                                 const char* path,
+                                 PP_DirContents_Dev** contents) OVERRIDE;
+  virtual void FreeDirContents(PP_Instance instance,
+                               PP_DirContents_Dev* contents) OVERRIDE;
+  virtual int32_t CreateTemporaryFile(PP_Instance instance,
+                                      PP_FileHandle* file) OVERRIDE;
+  virtual int32_t OpenFileRef(PP_Instance instance,
+                              PP_Resource file_ref,
+                              int32_t mode,
+                              PP_FileHandle* file) OVERRIDE;
+  virtual int32_t QueryFileRef(PP_Instance instance,
+                               PP_Resource file_ref,
+                               PP_FileInfo* info) OVERRIDE;
+
+ private:
+  int32_t OpenFileHelper(const std::string& path,
+                         PepperFilePath::Domain domain_type,
+                         int32_t mode,
+                         PP_FileHandle* file);
+  int32_t QueryFileHelper(const std::string& path,
+                          PepperFilePath::Domain domain_type,
+                          PP_FileInfo* info);
+
+  DISALLOW_COPY_AND_ASSIGN(FlashFileResource);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_FLASH_FILE_RESOURCE_H_
diff --git a/ppapi/proxy/flash_font_file_resource.cc b/ppapi/proxy/flash_font_file_resource.cc
index e835ac1..86caf1f 100644
--- a/ppapi/proxy/flash_font_file_resource.cc
+++ b/ppapi/proxy/flash_font_file_resource.cc
@@ -16,11 +16,11 @@
 FlashFontFileResource::FlashFontFileResource(
     Connection connection,
     PP_Instance instance,
-    const PP_FontDescription_Dev* description,
+    const PP_BrowserFont_Trusted_Description* description,
     PP_PrivateFontCharset charset)
     : PluginResource(connection, instance),
       charset_(charset) {
-  description_.SetFromPPFontDescription(*description);
+  description_.SetFromPPBrowserFontDescription(*description);
 }
 
 FlashFontFileResource::~FlashFontFileResource() {
diff --git a/ppapi/proxy/flash_font_file_resource.h b/ppapi/proxy/flash_font_file_resource.h
index 1644394..5bc633a 100644
--- a/ppapi/proxy/flash_font_file_resource.h
+++ b/ppapi/proxy/flash_font_file_resource.h
@@ -16,7 +16,7 @@
 #include "ppapi/proxy/serialized_structs.h"
 #include "ppapi/thunk/ppb_flash_font_file_api.h"
 
-struct PP_FontDescription_Dev;
+struct PP_BrowserFont_Trusted_Description;
 
 namespace ppapi {
 namespace proxy {
@@ -27,7 +27,7 @@
  public:
   FlashFontFileResource(Connection connection,
                         PP_Instance instance,
-                        const PP_FontDescription_Dev* description,
+                        const PP_BrowserFont_Trusted_Description* description,
                         PP_PrivateFontCharset charset);
   virtual ~FlashFontFileResource();
 
diff --git a/ppapi/proxy/flash_fullscreen_resource.cc b/ppapi/proxy/flash_fullscreen_resource.cc
new file mode 100644
index 0000000..90a68fc
--- /dev/null
+++ b/ppapi/proxy/flash_fullscreen_resource.cc
@@ -0,0 +1,46 @@
+// 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 "ppapi/proxy/flash_fullscreen_resource.h"
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/proxy/ppapi_messages.h"
+
+namespace ppapi {
+namespace proxy {
+
+FlashFullscreenResource::FlashFullscreenResource(Connection connection,
+                                                 PP_Instance instance)
+    : PluginResource(connection, instance),
+      is_fullscreen_(PP_FALSE) {
+}
+
+FlashFullscreenResource::~FlashFullscreenResource() {
+}
+
+thunk::PPB_Flash_Fullscreen_API*
+FlashFullscreenResource::AsPPB_Flash_Fullscreen_API() {
+  return this;
+}
+
+PP_Bool FlashFullscreenResource::IsFullscreen(PP_Instance instance) {
+  return is_fullscreen_;
+}
+
+PP_Bool FlashFullscreenResource::SetFullscreen(PP_Instance instance,
+                                               PP_Bool fullscreen) {
+  if (!sent_create_to_renderer())
+    SendCreate(RENDERER, PpapiHostMsg_FlashFullscreen_Create());
+  int32_t result = SyncCall<IPC::Message>(RENDERER,
+      PpapiHostMsg_FlashFullscreen_SetFullscreen(PP_ToBool(fullscreen)));
+  return PP_FromBool(result == PP_OK);
+}
+
+void FlashFullscreenResource::SetLocalIsFullscreen(PP_Instance instance,
+                                                   PP_Bool is_fullscreen) {
+  is_fullscreen_ = is_fullscreen;
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/flash_fullscreen_resource.h b/ppapi/proxy/flash_fullscreen_resource.h
new file mode 100644
index 0000000..c6d5ccb
--- /dev/null
+++ b/ppapi/proxy/flash_fullscreen_resource.h
@@ -0,0 +1,43 @@
+// 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 PPAPI_PROXY_FLASH_FULLSCREEN_RESOURCE_H_
+#define PPAPI_PROXY_FLASH_FULLSCREEN_RESOURCE_H_
+
+#include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/thunk/ppb_flash_fullscreen_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+class FlashFullscreenResource
+    : public PluginResource,
+      public thunk::PPB_Flash_Fullscreen_API {
+ public:
+  FlashFullscreenResource(Connection connection,
+                          PP_Instance instance);
+  virtual ~FlashFullscreenResource();
+
+  // Resource overrides.
+  virtual thunk::PPB_Flash_Fullscreen_API*
+      AsPPB_Flash_Fullscreen_API() OVERRIDE;
+
+  // PPB_Flash_Fullscreen_API implementation.
+  virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE;
+  virtual PP_Bool SetFullscreen(PP_Instance instance,
+                                PP_Bool fullscreen) OVERRIDE;
+  virtual void SetLocalIsFullscreen(PP_Instance instance,
+                                    PP_Bool is_fullscreen) OVERRIDE;
+
+ private:
+  PP_Bool is_fullscreen_;
+
+  DISALLOW_COPY_AND_ASSIGN(FlashFullscreenResource);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_FLASH_FULLSCREEN_RESOURCE_H_
diff --git a/ppapi/proxy/flash_menu_resource.cc b/ppapi/proxy/flash_menu_resource.cc
new file mode 100644
index 0000000..1c3b7f0
--- /dev/null
+++ b/ppapi/proxy/flash_menu_resource.cc
@@ -0,0 +1,97 @@
+// 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 "ppapi/proxy/flash_menu_resource.h"
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/serialized_flash_menu.h"
+
+namespace ppapi {
+namespace proxy {
+
+FlashMenuResource::FlashMenuResource(Connection connection,
+                                     PP_Instance instance)
+    : PluginResource(connection, instance),
+      selected_id_dest_(NULL) {
+}
+
+FlashMenuResource::~FlashMenuResource() {
+}
+
+bool FlashMenuResource::Initialize(const PP_Flash_Menu* menu_data) {
+  SerializedFlashMenu serialized_menu;
+  if (!menu_data || !serialized_menu.SetPPMenu(menu_data))
+    return false;
+  SendCreate(RENDERER, PpapiHostMsg_FlashMenu_Create(serialized_menu));
+  return true;
+}
+
+thunk::PPB_Flash_Menu_API* FlashMenuResource::AsPPB_Flash_Menu_API() {
+  return this;
+}
+
+int32_t FlashMenuResource::Show(
+    const PP_Point* location,
+    int32_t* selected_id,
+    scoped_refptr<TrackedCallback> callback) {
+  if (TrackedCallback::IsPending(callback_))
+    return PP_ERROR_INPROGRESS;
+
+  selected_id_dest_ = selected_id;
+  callback_ = callback;
+
+  // This must be a sync message even though we don't care about the result.
+  // The actual reply will be sent asynchronously in the future. This sync
+  // request is due to the following deadlock:
+  //
+  //  1. Flash sends a show request to the renderer.
+  //  2. The show handler in the renderer (in the case of full screen) requests
+  //     the window rect which is a sync message to the browser. This causes
+  //     a nested message loop to be spun up in the renderer.
+  //  3. Flash expects context menus to be synchronous so it starts a nested
+  //     message loop. This creates a second nested message loop in both the
+  //     plugin and renderer process.
+  //  4. The browser sends the window rect reply to unblock the renderer, but
+  //     it's in the second nested message loop and the reply will *not*
+  //     unblock this loop.
+  //  5. The second loop won't exit until the message loop is complete, but
+  //     that can't start until the first one exits.
+  //
+  // Having this message sync forces the sync request from the renderer to the
+  // browser for the window rect will complete before Flash can run a nested
+  // message loop to wait for the result of the menu.
+  SyncCall<IPC::Message>(RENDERER, PpapiHostMsg_FlashMenu_Show(*location));
+  return PP_OK_COMPLETIONPENDING;
+}
+
+void FlashMenuResource::OnReplyReceived(
+    const proxy::ResourceMessageReplyParams& params,
+    const IPC::Message& msg) {
+  // Because the Show call is synchronous but we ignore the sync result, we
+  // can't use the normal reply dispatch and have to do it manually here.
+  switch (msg.type()) {
+    case PpapiPluginMsg_FlashMenu_ShowReply::ID: {
+      int32_t selected_id;
+      if (ppapi::UnpackMessage<PpapiPluginMsg_FlashMenu_ShowReply>(
+              msg, &selected_id))
+        OnShowReply(params, selected_id);
+      break;
+    }
+  }
+}
+
+void FlashMenuResource::OnShowReply(
+    const proxy::ResourceMessageReplyParams& params,
+    int32_t selected_id) {
+  if (!TrackedCallback::IsPending(callback_))
+    return;
+
+  *selected_id_dest_ = selected_id;
+  selected_id_dest_ = NULL;
+  callback_->Run(params.result());
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/flash_menu_resource.h b/ppapi/proxy/flash_menu_resource.h
new file mode 100644
index 0000000..46b227a
--- /dev/null
+++ b/ppapi/proxy/flash_menu_resource.h
@@ -0,0 +1,57 @@
+// 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 PPAPI_PROXY_FLASH_MENU_RESOURCE_H_
+#define PPAPI_PROXY_FLASH_MENU_RESOURCE_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/ppb_flash_menu_api.h"
+
+struct PP_Flash_Menu;
+
+namespace ppapi {
+namespace proxy {
+
+class FlashMenuResource
+    : public PluginResource,
+      public thunk::PPB_Flash_Menu_API {
+ public:
+  // You must call Initialize after construction.
+  FlashMenuResource(Connection connection, PP_Instance instance);
+  virtual ~FlashMenuResource();
+
+  // Returns true on success. False means that this object can not be used.
+  // This has to be separate from the constructor because the menu data could
+  // be invalid.
+  bool Initialize(const PP_Flash_Menu* menu_data);
+
+  // Resource overrides.
+  virtual thunk::PPB_Flash_Menu_API* AsPPB_Flash_Menu_API() OVERRIDE;
+
+  // PPB_Flash_Menu_API.
+  virtual int32_t Show(const PP_Point* location,
+                       int32_t* selected_id,
+                       scoped_refptr<TrackedCallback> callback) OVERRIDE;
+
+ private:
+  virtual void OnReplyReceived(const proxy::ResourceMessageReplyParams& params,
+                               const IPC::Message& msg) OVERRIDE;
+
+  void OnShowReply(
+      const proxy::ResourceMessageReplyParams& params,
+      int32_t selected_id);
+
+  int* selected_id_dest_;
+  scoped_refptr<TrackedCallback> callback_;
+
+  DISALLOW_COPY_AND_ASSIGN(FlashMenuResource);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_FLASH_MENU_RESOURCE_H_
diff --git a/ppapi/proxy/flash_resource.cc b/ppapi/proxy/flash_resource.cc
index b8dd5c8..1fc45b1 100644
--- a/ppapi/proxy/flash_resource.cc
+++ b/ppapi/proxy/flash_resource.cc
@@ -4,19 +4,58 @@
 
 #include "ppapi/proxy/flash_resource.h"
 
-#include "ipc/ipc_message.h"
+#include <cmath>
+
+#include "base/containers/mru_cache.h"
+#include "base/lazy_instance.h"
+#include "base/time.h"
 #include "ppapi/c/pp_errors.h"
-#include "ppapi/proxy/dispatch_reply_message.h"
+#include "ppapi/c/private/ppb_flash.h"
+#include "ppapi/c/trusted/ppb_browser_font_trusted.h"
+#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/plugin_globals.h"
 #include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/shared_impl/array_writer.h"
+#include "ppapi/proxy/serialized_structs.h"
+#include "ppapi/shared_impl/ppapi_preferences.h"
+#include "ppapi/shared_impl/scoped_pp_var.h"
+#include "ppapi/shared_impl/time_conversion.h"
+#include "ppapi/shared_impl/var.h"
 #include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_url_request_info_api.h"
+
+using ppapi::thunk::EnterResourceNoLock;
 
 namespace ppapi {
 namespace proxy {
 
-FlashResource::FlashResource(Connection connection, PP_Instance instance)
-    : PluginResource(connection, instance) {
+namespace {
+
+struct LocalTimeZoneOffsetEntry {
+  base::TimeTicks expiration;
+  double offset;
+};
+
+class LocalTimeZoneOffsetCache
+    : public base::MRUCache<PP_Time, LocalTimeZoneOffsetEntry> {
+ public:
+  LocalTimeZoneOffsetCache()
+      : base::MRUCache<PP_Time, LocalTimeZoneOffsetEntry>(kCacheSize) {}
+ private:
+  static const size_t kCacheSize = 100;
+};
+
+base::LazyInstance<LocalTimeZoneOffsetCache>::Leaky
+    g_local_time_zone_offset_cache = LAZY_INSTANCE_INITIALIZER;
+
+} //  namespace
+
+FlashResource::FlashResource(Connection connection,
+                             PP_Instance instance,
+                             PluginDispatcher* plugin_dispatcher)
+    : PluginResource(connection, instance),
+      plugin_dispatcher_(plugin_dispatcher) {
   SendCreate(RENDERER, PpapiHostMsg_Flash_Create());
+  SendCreate(BROWSER, PpapiHostMsg_Flash_Create());
 }
 
 FlashResource::~FlashResource() {
@@ -26,41 +65,186 @@
   return this;
 }
 
-int32_t FlashResource::EnumerateVideoCaptureDevices(
-    PP_Instance instance,
-    PP_Resource video_capture,
-    const PP_ArrayOutput& devices) {
-  ArrayWriter output;
-  output.set_pp_array_output(devices);
-  if (!output.is_valid())
-    return PP_ERROR_BADARGUMENT;
+PP_Var FlashResource::GetProxyForURL(PP_Instance instance,
+                                     const std::string& url) {
+  std::string proxy;
+  int32_t result = SyncCall<PpapiPluginMsg_Flash_GetProxyForURLReply>(RENDERER,
+      PpapiHostMsg_Flash_GetProxyForURL(url), &proxy);
 
-  thunk::EnterResourceNoLock<thunk::PPB_VideoCapture_API> enter(video_capture,
-                                                                true);
-  if (enter.failed())
-    return PP_ERROR_NOINTERFACE;
+  if (result == PP_OK)
+    return StringVar::StringToPPVar(proxy);
+  return PP_MakeUndefined();
+}
 
-  std::vector<ppapi::DeviceRefData> device_ref_data;
-  int32_t result =
-      SyncCall<PpapiPluginMsg_Flash_EnumerateVideoCaptureDevicesReply>(
-          RENDERER,
-          PpapiHostMsg_Flash_EnumerateVideoCaptureDevices(
-              enter.resource()->host_resource()),
-          &device_ref_data);
-  if (result != PP_OK)
-    return result;
+void FlashResource::UpdateActivity(PP_Instance instance) {
+  Post(BROWSER, PpapiHostMsg_Flash_UpdateActivity());
+}
 
-  std::vector<scoped_refptr<Resource> > device_resources;
-  for (size_t i = 0; i < device_ref_data.size(); ++i) {
-    scoped_refptr<Resource> resource(new PPB_DeviceRef_Shared(
-        OBJECT_IS_PROXY, instance, device_ref_data[i]));
-    device_resources.push_back(resource);
+PP_Bool FlashResource::SetCrashData(PP_Instance instance,
+                                    PP_FlashCrashKey key,
+                                    PP_Var value) {
+  switch (key) {
+    case PP_FLASHCRASHKEY_URL: {
+      StringVar* url_string_var(StringVar::FromPPVar(value));
+      if (!url_string_var)
+        return PP_FALSE;
+      PluginGlobals::Get()->SetActiveURL(url_string_var->value());
+      return PP_TRUE;
+    }
   }
+  return PP_FALSE;
+}
 
-  if (!output.StoreResourceVector(device_resources))
-    return PP_ERROR_FAILED;
+double FlashResource::GetLocalTimeZoneOffset(PP_Instance instance,
+                                             PP_Time t) {
+  LocalTimeZoneOffsetCache& cache = g_local_time_zone_offset_cache.Get();
 
-  return PP_OK;
+  // Get the minimum PP_Time value that shares the same minute as |t|.
+  // Use cached offset if cache hasn't expired and |t| is in the same minute as
+  // the time for the cached offset (assume offsets change on minute
+  // boundaries).
+  PP_Time t_minute_base = floor(t / 60.0) * 60.0;
+  LocalTimeZoneOffsetCache::iterator iter = cache.Get(t_minute_base);
+  base::TimeTicks now = base::TimeTicks::Now();
+  if (iter != cache.end() && now < iter->second.expiration)
+    return iter->second.offset;
+
+  // Cache the local offset for ten seconds, since it's slow on XP and Linux.
+  // Note that TimeTicks does not continue counting across sleep/resume on all
+  // platforms. This may be acceptable for 10 seconds, but if in the future this
+  // is changed to one minute or more, then we should consider using base::Time.
+  const int64 kMaxCachedLocalOffsetAgeInSeconds = 10;
+  base::TimeDelta expiration_delta =
+      base::TimeDelta::FromSeconds(kMaxCachedLocalOffsetAgeInSeconds);
+
+  LocalTimeZoneOffsetEntry cache_entry;
+  cache_entry.expiration = now + expiration_delta;
+  cache_entry.offset = 0.0;
+
+  // We can't do the conversion here on Linux because the localtime calls
+  // require filesystem access prohibited by the sandbox.
+  // TODO(shess): Figure out why OSX needs the access, the sandbox warmup should
+  // handle it.  http://crbug.com/149006
+#if defined(OS_LINUX) || defined(OS_MACOSX)
+  int32_t result = SyncCall<PpapiPluginMsg_Flash_GetLocalTimeZoneOffsetReply>(
+      BROWSER,
+      PpapiHostMsg_Flash_GetLocalTimeZoneOffset(PPTimeToTime(t)),
+      &cache_entry.offset);
+  if (result != PP_OK)
+    cache_entry.offset = 0.0;
+#else
+  cache_entry.offset = PPGetLocalTimeZoneOffset(PPTimeToTime(t));
+#endif
+
+  cache.Put(t_minute_base, cache_entry);
+  return cache_entry.offset;
+}
+
+PP_Var FlashResource::GetSetting(PP_Instance instance,
+                                 PP_FlashSetting setting) {
+  switch (setting) {
+    case PP_FLASHSETTING_3DENABLED:
+      return PP_MakeBool(PP_FromBool(
+          plugin_dispatcher_->preferences().is_3d_supported));
+    case PP_FLASHSETTING_INCOGNITO:
+      return PP_MakeBool(PP_FromBool(plugin_dispatcher_->incognito()));
+    case PP_FLASHSETTING_STAGE3DENABLED:
+      return PP_MakeBool(PP_FromBool(
+          plugin_dispatcher_->preferences().is_stage3d_supported));
+    case PP_FLASHSETTING_STAGE3DBASELINEENABLED:
+      return PP_MakeBool(PP_FromBool(
+          plugin_dispatcher_->preferences().is_stage3d_baseline_supported));
+    case PP_FLASHSETTING_LANGUAGE:
+      return StringVar::StringToPPVar(
+          PluginGlobals::Get()->GetUILanguage());
+    case PP_FLASHSETTING_NUMCORES:
+      return PP_MakeInt32(
+          plugin_dispatcher_->preferences().number_of_cpu_cores);
+    case PP_FLASHSETTING_LSORESTRICTIONS: {
+      int32_t restrictions;
+      int32_t result =
+          SyncCall<PpapiPluginMsg_Flash_GetLocalDataRestrictionsReply>(BROWSER,
+              PpapiHostMsg_Flash_GetLocalDataRestrictions(), &restrictions);
+      if (result != PP_OK)
+        return PP_MakeInt32(PP_FLASHLSORESTRICTIONS_NONE);
+      return PP_MakeInt32(restrictions);
+    }
+  }
+  return PP_MakeUndefined();
+}
+
+void FlashResource::SetInstanceAlwaysOnTop(PP_Instance instance,
+                                           PP_Bool on_top) {
+  Post(RENDERER, PpapiHostMsg_Flash_SetInstanceAlwaysOnTop(PP_ToBool(on_top)));
+}
+
+PP_Bool FlashResource::DrawGlyphs(
+    PP_Instance instance,
+    PP_Resource pp_image_data,
+    const PP_BrowserFont_Trusted_Description* font_desc,
+    uint32_t color,
+    const PP_Point* position,
+    const PP_Rect* clip,
+    const float transformation[3][3],
+    PP_Bool allow_subpixel_aa,
+    uint32_t glyph_count,
+    const uint16_t glyph_indices[],
+    const PP_Point glyph_advances[]) {
+  EnterResourceNoLock<thunk::PPB_ImageData_API> enter(pp_image_data, true);
+  if (enter.failed())
+    return PP_FALSE;
+  // The instance parameter isn't strictly necessary but we check that it
+  // matches anyway.
+  if (enter.resource()->pp_instance() != instance)
+    return PP_FALSE;
+
+  PPBFlash_DrawGlyphs_Params params;
+  params.image_data = enter.resource()->host_resource();
+  params.font_desc.SetFromPPBrowserFontDescription(*font_desc);
+  params.color = color;
+  params.position = *position;
+  params.clip = *clip;
+  for (int i = 0; i < 3; i++) {
+    for (int j = 0; j < 3; j++)
+      params.transformation[i][j] = transformation[i][j];
+  }
+  params.allow_subpixel_aa = allow_subpixel_aa;
+
+  params.glyph_indices.insert(params.glyph_indices.begin(),
+                              &glyph_indices[0],
+                              &glyph_indices[glyph_count]);
+  params.glyph_advances.insert(params.glyph_advances.begin(),
+                               &glyph_advances[0],
+                               &glyph_advances[glyph_count]);
+
+  // This has to be synchronous because the caller may want to composite on
+  // top of the resulting text after the call is complete.
+  int32_t result = SyncCall<IPC::Message>(RENDERER,
+      PpapiHostMsg_Flash_DrawGlyphs(params));
+  return PP_FromBool(result == PP_OK);
+}
+
+int32_t FlashResource::Navigate(PP_Instance instance,
+                                PP_Resource request_info,
+                                const char* target,
+                                PP_Bool from_user_action) {
+  EnterResourceNoLock<thunk::PPB_URLRequestInfo_API> enter(request_info,
+                                                                  true);
+  if (enter.failed())
+    return PP_ERROR_BADRESOURCE;
+  return SyncCall<IPC::Message>(RENDERER, PpapiHostMsg_Flash_Navigate(
+      enter.object()->GetData(), target, PP_ToBool(from_user_action)));
+}
+
+PP_Bool FlashResource::IsRectTopmost(PP_Instance instance,
+                                     const PP_Rect* rect) {
+  int32_t result = SyncCall<IPC::Message>(RENDERER,
+      PpapiHostMsg_Flash_IsRectTopmost(*rect));
+  return PP_FromBool(result == PP_OK);
+}
+
+void FlashResource::InvokePrinting(PP_Instance instance) {
+  Post(RENDERER, PpapiHostMsg_Flash_InvokePrinting());
 }
 
 }  // namespace proxy
diff --git a/ppapi/proxy/flash_resource.h b/ppapi/proxy/flash_resource.h
index b5a4428..cfb6b1e 100644
--- a/ppapi/proxy/flash_resource.h
+++ b/ppapi/proxy/flash_resource.h
@@ -5,33 +5,67 @@
 #ifndef PPAPI_PROXY_FLASH_RESOURCE_H_
 #define PPAPI_PROXY_FLASH_RESOURCE_H_
 
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/c/private/ppb_flash.h"
 #include "ppapi/proxy/connection.h"
 #include "ppapi/proxy/plugin_resource.h"
-#include "ppapi/proxy/ppapi_proxy_export.h"
 #include "ppapi/thunk/ppb_flash_functions_api.h"
 
-struct PP_ArrayOutput;
-
 namespace ppapi {
 namespace proxy {
 
-class PPAPI_PROXY_EXPORT FlashResource
+class PluginDispatcher;
+
+class FlashResource
     : public PluginResource,
-      public NON_EXPORTED_BASE(thunk::PPB_Flash_Functions_API) {
+      public thunk::PPB_Flash_Functions_API {
  public:
-  FlashResource(Connection connection, PP_Instance instance);
+  FlashResource(Connection connection,
+                PP_Instance instance,
+                PluginDispatcher* plugin_dispatcher);
   virtual ~FlashResource();
 
-  // Resource overrides.
+  // Resource override.
   virtual thunk::PPB_Flash_Functions_API* AsPPB_Flash_Functions_API() OVERRIDE;
 
-  // PPB_Flash_Functions_API.
-  virtual int32_t EnumerateVideoCaptureDevices(
+  // PPB_Flash_Functions_API implementation.
+  virtual PP_Var GetProxyForURL(PP_Instance instance,
+                                const std::string& url) OVERRIDE;
+  virtual void UpdateActivity(PP_Instance instance) OVERRIDE;
+  virtual PP_Bool SetCrashData(PP_Instance instance,
+                               PP_FlashCrashKey key,
+                               PP_Var value) OVERRIDE;
+  virtual double GetLocalTimeZoneOffset(PP_Instance instance,
+                                        PP_Time t) OVERRIDE;
+  virtual PP_Var GetSetting(PP_Instance instance,
+                            PP_FlashSetting setting) OVERRIDE;
+  virtual void SetInstanceAlwaysOnTop(PP_Instance instance,
+                                      PP_Bool on_top) OVERRIDE;
+  virtual PP_Bool DrawGlyphs(
       PP_Instance instance,
-      PP_Resource video_capture,
-      const PP_ArrayOutput& devices) OVERRIDE;
+      PP_Resource pp_image_data,
+      const PP_BrowserFont_Trusted_Description* font_desc,
+      uint32_t color,
+      const PP_Point* position,
+      const PP_Rect* clip,
+      const float transformation[3][3],
+      PP_Bool allow_subpixel_aa,
+      uint32_t glyph_count,
+      const uint16_t glyph_indices[],
+      const PP_Point glyph_advances[]) OVERRIDE;
+  virtual int32_t Navigate(PP_Instance instance,
+                           PP_Resource request_info,
+                           const char* target,
+                           PP_Bool from_user_action) OVERRIDE;
+  virtual PP_Bool IsRectTopmost(PP_Instance instance,
+                                const PP_Rect* rect) OVERRIDE;
+  virtual void InvokePrinting(PP_Instance instance) OVERRIDE;
 
  private:
+  // Non-owning pointer to the PluginDispatcher that owns this object.
+  PluginDispatcher* plugin_dispatcher_;
+
   DISALLOW_COPY_AND_ASSIGN(FlashResource);
 };
 
diff --git a/ppapi/proxy/flash_resource_unittest.cc b/ppapi/proxy/flash_resource_unittest.cc
index 901e855..ab22077 100644
--- a/ppapi/proxy/flash_resource_unittest.cc
+++ b/ppapi/proxy/flash_resource_unittest.cc
@@ -17,33 +17,6 @@
 
 typedef PluginProxyTest FlashResourceTest;
 
-// This simulates the creation reply message of a VideoCapture resource. This
-// won't be necessary once VideoCapture is converted to the new-style proxy.
-class VideoCaptureCreationHandler : public IPC::Listener {
- public:
-  VideoCaptureCreationHandler(ResourceMessageTestSink* test_sink,
-                              PP_Instance instance)
-      : test_sink_(test_sink),
-        instance_(instance) {
-  }
-  virtual ~VideoCaptureCreationHandler() {}
-
-  virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE {
-    if (msg.type() != ::PpapiHostMsg_PPBVideoCapture_Create::ID)
-      return false;
-
-    IPC::Message* reply_msg = IPC::SyncMessage::GenerateReply(&msg);
-    HostResource resource;
-    resource.SetHostResource(instance_, 12345);
-    PpapiHostMsg_PPBVideoCapture_Create::WriteReplyParams(reply_msg, resource);
-    test_sink_->SetSyncReplyMessage(reply_msg);
-    return true;
-  }
- private:
-  ResourceMessageTestSink* test_sink_;
-  PP_Instance instance_;
-};
-
 void* Unused(void* user_data, uint32_t element_count, uint32_t element_size) {
   return NULL;
 }
@@ -60,22 +33,18 @@
   // Set up a sync call handler that should return this message.
   std::vector<ppapi::DeviceRefData> reply_device_ref_data;
   int32_t expected_result = PP_OK;
-  PpapiPluginMsg_Flash_EnumerateVideoCaptureDevicesReply reply_msg(
+  PpapiPluginMsg_DeviceEnumeration_EnumerateDevicesReply reply_msg(
       reply_device_ref_data);
   ResourceSyncCallHandler enumerate_video_devices_handler(
       &sink(),
-      PpapiHostMsg_Flash_EnumerateVideoCaptureDevices::ID,
+      PpapiHostMsg_DeviceEnumeration_EnumerateDevices::ID,
       expected_result,
       reply_msg);
   sink().AddFilter(&enumerate_video_devices_handler);
 
-  // Setup the handler to simulate creation of the video resource.
-  VideoCaptureCreationHandler video_creation_handler(&sink(), pp_instance());
-  sink().AddFilter(&video_creation_handler);
-
   // Set up the arguments to the call.
   ScopedPPResource video_capture(ScopedPPResource::PassRef(),
-      ::ppapi::thunk::GetPPB_VideoCapture_Dev_0_2_Thunk()->Create(
+      ::ppapi::thunk::GetPPB_VideoCapture_Dev_0_3_Thunk()->Create(
           pp_instance()));
   std::vector<PP_Resource> unused;
   PP_ArrayOutput output;
@@ -90,13 +59,12 @@
   // Check the result is as expected.
   EXPECT_EQ(expected_result, actual_result);
 
-  // Should have sent an "EnumerateVideoCaptureDevices" message.
+  // Should have sent an "DeviceEnumeration_EnumerateDevices" message.
   ASSERT_TRUE(enumerate_video_devices_handler.last_handled_msg().type() ==
-      PpapiHostMsg_Flash_EnumerateVideoCaptureDevices::ID);
+      PpapiHostMsg_DeviceEnumeration_EnumerateDevices::ID);
 
   // Remove the filter or it will be destroyed before the sink() is destroyed.
   sink().RemoveFilter(&enumerate_video_devices_handler);
-  sink().RemoveFilter(&video_creation_handler);
 }
 
 }  // namespace proxy
diff --git a/ppapi/proxy/gamepad_resource.cc b/ppapi/proxy/gamepad_resource.cc
index 8a49437..1cfc041 100644
--- a/ppapi/proxy/gamepad_resource.cc
+++ b/ppapi/proxy/gamepad_resource.cc
@@ -58,7 +58,12 @@
 GamepadResource::~GamepadResource() {
 }
 
-void GamepadResource::Sample(PP_GamepadsSampleData* data) {
+thunk::PPB_Gamepad_API* GamepadResource::AsPPB_Gamepad_API() {
+  return this;
+}
+
+void GamepadResource::Sample(PP_Instance /* instance */,
+                             PP_GamepadsSampleData* data) {
   if (!buffer_) {
     // Browser hasn't sent back our shared memory, give the plugin gamepad
     // data corresponding to "not connected".
diff --git a/ppapi/proxy/gamepad_resource.h b/ppapi/proxy/gamepad_resource.h
index 1eaa547..017f99a 100644
--- a/ppapi/proxy/gamepad_resource.h
+++ b/ppapi/proxy/gamepad_resource.h
@@ -35,8 +35,12 @@
   GamepadResource(Connection connection, PP_Instance instance);
   virtual ~GamepadResource();
 
+  // Resource implementation.
+  virtual thunk::PPB_Gamepad_API* AsPPB_Gamepad_API() OVERRIDE;
+
   // PPB_Gamepad_API.
-  virtual void Sample(PP_GamepadsSampleData* data) OVERRIDE;
+  virtual void Sample(PP_Instance instance,
+                      PP_GamepadsSampleData* data) OVERRIDE;
 
  private:
   void OnPluginMsgSendMemory(const ResourceMessageReplyParams& params);
diff --git a/ppapi/proxy/graphics_2d_resource.cc b/ppapi/proxy/graphics_2d_resource.cc
new file mode 100644
index 0000000..b07db46
--- /dev/null
+++ b/ppapi/proxy/graphics_2d_resource.cc
@@ -0,0 +1,152 @@
+// 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 "ppapi/proxy/graphics_2d_resource.h"
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_point.h"
+#include "ppapi/c/pp_rect.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_size.h"
+#include "ppapi/c/ppb_graphics_2d.h"
+#include "ppapi/proxy/dispatch_reply_message.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/resource_tracker.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_image_data_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+Graphics2DResource::Graphics2DResource(Connection connection,
+                                       PP_Instance instance,
+                                       const PP_Size& size,
+                                       PP_Bool is_always_opaque)
+    : PluginResource(connection, instance),
+      size_(size),
+      is_always_opaque_(is_always_opaque),
+      scale_(1.0f) {
+  // These checks are copied from PPB_ImageData_Impl::Init to make tests passed.
+  // Let's remove/refactor this when start to refactor ImageData.
+  bool bad_args = size.width <= 0 || size.height <= 0 ||
+      static_cast<int64>(size.width) * static_cast<int64>(size.height) >=
+          std::numeric_limits<int32>::max() / 4;
+  if (!bad_args && !sent_create_to_renderer()) {
+    SendCreate(RENDERER,
+        PpapiHostMsg_Graphics2D_Create(size, is_always_opaque));
+  }
+}
+
+Graphics2DResource::~Graphics2DResource() {
+}
+
+PP_Bool Graphics2DResource::Describe(PP_Size* size, PP_Bool* is_always_opaque) {
+  *size = size_;
+  *is_always_opaque = is_always_opaque_;
+  return PP_TRUE;
+}
+
+thunk::PPB_Graphics2D_API* Graphics2DResource::AsPPB_Graphics2D_API() {
+  return this;
+}
+
+void Graphics2DResource::PaintImageData(PP_Resource image_data,
+                                        const PP_Point* top_left,
+                                        const PP_Rect* src_rect) {
+  Resource* image_object =
+      PpapiGlobals::Get()->GetResourceTracker()->GetResource(image_data);
+  if (!image_object || pp_instance() != image_object->pp_instance()) {
+    Log(PP_LOGLEVEL_ERROR,
+        "Graphics2DResource.PaintImageData: Bad image resource.");
+    return;
+  }
+
+  PP_Rect dummy;
+  memset(&dummy, 0, sizeof(PP_Rect));
+  Post(RENDERER, PpapiHostMsg_Graphics2D_PaintImageData(
+      image_object->host_resource(), *top_left,
+      !!src_rect, src_rect ? *src_rect : dummy));
+}
+
+void Graphics2DResource::Scroll(const PP_Rect* clip_rect,
+                                const PP_Point* amount) {
+  PP_Rect dummy;
+  memset(&dummy, 0, sizeof(PP_Rect));
+  Post(RENDERER, PpapiHostMsg_Graphics2D_Scroll(
+      !!clip_rect, clip_rect ? *clip_rect : dummy, *amount));
+}
+
+void Graphics2DResource::ReplaceContents(PP_Resource image_data) {
+  thunk::EnterResourceNoLock<thunk::PPB_ImageData_API> enter_image(
+      image_data, true);
+  if (enter_image.failed())
+    return;
+
+  // Check that the PP_Instance matches.
+  Resource* image_object =
+      PpapiGlobals::Get()->GetResourceTracker()->GetResource(image_data);
+  if (!image_object || pp_instance() != image_object->pp_instance()) {
+    Log(PP_LOGLEVEL_ERROR,
+        "Graphics2DResource.PaintImageData: Bad image resource.");
+    return;
+  }
+  enter_image.object()->SetUsedInReplaceContents();
+
+  Post(RENDERER, PpapiHostMsg_Graphics2D_ReplaceContents(
+      image_object->host_resource()));
+}
+
+bool Graphics2DResource::SetScale(float scale) {
+  if (scale <= 0.0f)
+    return false;
+  Post(RENDERER, PpapiHostMsg_Graphics2D_Dev_SetScale(scale));
+  scale_ = scale;
+  return true;
+}
+
+float Graphics2DResource::GetScale() {
+  return scale_;
+}
+
+int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback,
+                                  PP_Resource* old_image_data) {
+  // If host is not even created, return failure immediately.  This can happen
+  // when failed to initialize (in constructor).
+  if (!sent_create_to_renderer())
+    return PP_ERROR_FAILED;
+
+  // We don't support this feature, it's for in-renderer only.
+  if (old_image_data)
+    *old_image_data = 0;
+
+  if (TrackedCallback::IsPending(current_flush_callback_))
+    return PP_ERROR_INPROGRESS;  // Can't have >1 flush pending.
+  current_flush_callback_ = callback;
+
+  Call<PpapiPluginMsg_Graphics2D_FlushAck>(
+      RENDERER,
+      PpapiHostMsg_Graphics2D_Flush(),
+      base::Bind(&Graphics2DResource::OnPluginMsgFlushACK, this));
+  return PP_OK_COMPLETIONPENDING;
+}
+
+bool Graphics2DResource::ReadImageData(PP_Resource image,
+                                       const PP_Point* top_left) {
+  if (!top_left)
+    return false;
+  int32_t result = SyncCall<PpapiPluginMsg_Graphics2D_ReadImageDataAck>(
+      RENDERER,
+      PpapiHostMsg_Graphics2D_ReadImageData(image, *top_left));
+  return result == PP_OK;
+}
+
+void Graphics2DResource::OnPluginMsgFlushACK(
+    const ResourceMessageReplyParams& params) {
+  current_flush_callback_->Run(params.result());
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/graphics_2d_resource.h b/ppapi/proxy/graphics_2d_resource.h
new file mode 100644
index 0000000..01309dc
--- /dev/null
+++ b/ppapi/proxy/graphics_2d_resource.h
@@ -0,0 +1,63 @@
+// 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 PPAPI_PROXY_GRAPHICS_2D_RESOURCE_H_
+#define PPAPI_PROXY_GRAPHICS_2D_RESOURCE_H_
+
+#include "base/compiler_specific.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/thunk/ppb_graphics_2d_api.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace proxy {
+
+class PPAPI_PROXY_EXPORT Graphics2DResource
+      : public PluginResource,
+        public NON_EXPORTED_BASE(thunk::PPB_Graphics2D_API) {
+ public:
+  Graphics2DResource(Connection connection,
+                     PP_Instance instance,
+                     const PP_Size& size,
+                     PP_Bool is_always_opaque);
+
+  virtual ~Graphics2DResource();
+
+  // Resource overrides.
+  virtual thunk::PPB_Graphics2D_API* AsPPB_Graphics2D_API() OVERRIDE;
+
+  // PPB_Graphics2D_API overrides.
+  virtual PP_Bool Describe(PP_Size* size, PP_Bool* is_always_opaque) OVERRIDE;
+  virtual void PaintImageData(PP_Resource image_data,
+                              const PP_Point* top_left,
+                              const PP_Rect* src_rect) OVERRIDE;
+  virtual void Scroll(const PP_Rect* clip_rect,
+                      const PP_Point* amount) OVERRIDE;
+  virtual void ReplaceContents(PP_Resource image_data) OVERRIDE;
+  virtual bool SetScale(float scale) OVERRIDE;
+  virtual float GetScale() OVERRIDE;
+  virtual int32_t Flush(scoped_refptr<TrackedCallback> callback,
+                        PP_Resource* old_image_data) OVERRIDE;
+  virtual bool ReadImageData(PP_Resource image,
+                             const PP_Point* top_left) OVERRIDE;
+
+ private:
+  void OnPluginMsgFlushACK(const ResourceMessageReplyParams& params);
+
+  const PP_Size size_;
+  const PP_Bool is_always_opaque_;
+  float scale_;
+
+  scoped_refptr<TrackedCallback> current_flush_callback_;
+
+  DISALLOW_COPY_AND_ASSIGN(Graphics2DResource);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_GRAPHICS_2D_RESOURCE_H_
diff --git a/ppapi/proxy/handle_converter.cc b/ppapi/proxy/handle_converter.cc
new file mode 100644
index 0000000..ef4102c
--- /dev/null
+++ b/ppapi/proxy/handle_converter.cc
@@ -0,0 +1,278 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/handle_converter.h"
+
+#include <vector>
+#include "ipc/ipc_message.h"
+#include "ipc/ipc_message_macros.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/resource_message_params.h"
+#include "ppapi/proxy/serialized_handle.h"
+#include "ppapi/proxy/serialized_var.h"
+
+class NaClDescImcShm;
+
+namespace IPC {
+class Message;
+}
+
+namespace {
+
+void WriteHandle(int handle_index,
+                 const ppapi::proxy::SerializedHandle& handle,
+                 IPC::Message* message) {
+  ppapi::proxy::SerializedHandle::WriteHeader(handle.header(), message);
+
+  // Now write the handle itself in POSIX style.
+  message->WriteBool(true);  // valid == true
+  message->WriteInt(handle_index);
+}
+
+typedef std::vector<ppapi::proxy::SerializedHandle> Handles;
+
+// We define overloads for catching SerializedHandles so that we can share
+// them correctly to the untrusted side.
+// See ConvertHandlesImpl for how these get used.
+void ConvertHandlesInParam(const ppapi::proxy::SerializedHandle& handle,
+                           Handles* handles,
+                           IPC::Message* msg,
+                           int* handle_index) {
+  handles->push_back(handle);
+  if (msg)
+    WriteHandle((*handle_index)++, handle, msg);
+}
+
+void ConvertHandlesInParam(const ppapi::proxy::SerializedVar& var,
+                           Handles* handles,
+                           IPC::Message* msg,
+                           int* handle_index) {
+  ppapi::proxy::SerializedHandle *handle = var.GetPluginShmemHandle();
+  if (handle) {
+    handles->push_back(*handle);
+    if (msg) {
+      var.WriteRawVarHeader(msg);
+      WriteHandle((*handle_index)++, *handle, msg);
+    }
+  }
+}
+
+// For PpapiMsg_ResourceReply and the reply to PpapiHostMsg_ResourceSyncCall,
+// the handles are carried inside the ResourceMessageReplyParams.
+// NOTE: We only translate handles from host->NaCl. The only kind of
+//       ResourceMessageParams that travels this direction is
+//       ResourceMessageReplyParams, so that's the only one we need to handle.
+void ConvertHandlesInParam(
+    const ppapi::proxy::ResourceMessageReplyParams& params,
+    Handles* handles,
+    IPC::Message* msg,
+    int* handle_index) {
+  // First, if we need to rewrite the message parameters, write everything
+  // before the handles (there's nothing after the handles).
+  if (msg) {
+    params.WriteReplyHeader(msg);
+    // IPC writes the vector length as an int before the contents of the
+    // vector.
+    msg->WriteInt(static_cast<int>(params.handles().size()));
+  }
+  for (Handles::const_iterator iter = params.handles().begin();
+       iter != params.handles().end();
+       ++iter) {
+    // ConvertHandle will write each handle to |msg|, if necessary.
+    ConvertHandlesInParam(*iter, handles, msg, handle_index);
+  }
+  // Tell ResourceMessageReplyParams that we have taken the handles, so it
+  // shouldn't close them. The NaCl runtime will take ownership of them.
+  params.ConsumeHandles();
+}
+
+// This overload is to catch all types other than SerializedHandle or
+// ResourceMessageReplyParams. On Windows, |msg| will be a valid pointer, and we
+// must write |param| to it.
+template <class T>
+void ConvertHandlesInParam(const T& param,
+                           Handles* /* handles */,
+                           IPC::Message* msg,
+                           int* /* handle_index */) {
+  // It's not a handle, so just write to the output message, if necessary.
+  if (msg)
+    IPC::WriteParam(msg, param);
+}
+
+// These just break apart the given tuple and run ConvertHandle over each param.
+// The idea is to extract any handles in the tuple, while writing all data to
+// msg (if msg is valid). The msg will only be valid on Windows, where we need
+// to re-write all of the message parameters, writing the handles in POSIX style
+// for NaCl.
+template <class A>
+void ConvertHandlesImpl(const Tuple1<A>& t1, Handles* handles,
+                        IPC::Message* msg) {
+  int handle_index = 0;
+  ConvertHandlesInParam(t1.a, handles, msg, &handle_index);
+}
+template <class A, class B>
+void ConvertHandlesImpl(const Tuple2<A, B>& t1, Handles* handles,
+                        IPC::Message* msg) {
+  int handle_index = 0;
+  ConvertHandlesInParam(t1.a, handles, msg, &handle_index);
+  ConvertHandlesInParam(t1.b, handles, msg, &handle_index);
+}
+template <class A, class B, class C>
+void ConvertHandlesImpl(const Tuple3<A, B, C>& t1, Handles* handles,
+                        IPC::Message* msg) {
+  int handle_index = 0;
+  ConvertHandlesInParam(t1.a, handles, msg, &handle_index);
+  ConvertHandlesInParam(t1.b, handles, msg, &handle_index);
+  ConvertHandlesInParam(t1.c, handles, msg, &handle_index);
+}
+template <class A, class B, class C, class D>
+void ConvertHandlesImpl(const Tuple4<A, B, C, D>& t1, Handles* handles,
+                        IPC::Message* msg) {
+  int handle_index = 0;
+  ConvertHandlesInParam(t1.a, handles, msg, &handle_index);
+  ConvertHandlesInParam(t1.b, handles, msg, &handle_index);
+  ConvertHandlesInParam(t1.c, handles, msg, &handle_index);
+  ConvertHandlesInParam(t1.d, handles, msg, &handle_index);
+}
+
+template <class MessageType>
+class HandleConverterImpl {
+ public:
+  explicit HandleConverterImpl(const IPC::Message* msg)
+      : msg_(static_cast<const MessageType*>(msg)) {
+  }
+  bool ConvertMessage(Handles* handles, IPC::Message* out_msg) {
+    typename TupleTypes<typename MessageType::Schema::Param>::ValueTuple params;
+    if (!MessageType::Read(msg_, &params))
+      return false;
+    ConvertHandlesImpl(params, handles, out_msg);
+    return true;
+  }
+
+  bool ConvertReply(Handles* handles, IPC::SyncMessage* out_msg) {
+    typename TupleTypes<typename MessageType::Schema::ReplyParam>::ValueTuple
+        params;
+    if (!MessageType::ReadReplyParam(msg_, &params))
+      return false;
+    // If we need to rewrite the message (i.e., on Windows), we need to make
+    // sure we write the message id first.
+    if (out_msg) {
+      out_msg->set_reply();
+      int id = IPC::SyncMessage::GetMessageId(*msg_);
+      out_msg->WriteInt(id);
+    }
+    ConvertHandlesImpl(params, handles, out_msg);
+    return true;
+  }
+  // TODO(dmichael): Add ConvertSyncMessage for outgoing sync messages, if we
+  //                 ever pass handles in one of those.
+
+ private:
+  const MessageType* msg_;
+};
+
+}  // namespace
+
+#define CASE_FOR_MESSAGE(MESSAGE_TYPE) \
+      case MESSAGE_TYPE::ID: { \
+        HandleConverterImpl<MESSAGE_TYPE> extractor(&msg); \
+        if (!extractor.ConvertMessage(handles, new_msg_ptr->get())) \
+          return false; \
+        break; \
+      }
+#define CASE_FOR_REPLY(MESSAGE_TYPE) \
+      case MESSAGE_TYPE::ID: { \
+        HandleConverterImpl<MESSAGE_TYPE> extractor(&msg); \
+        if (!extractor.ConvertReply( \
+                handles, \
+                static_cast<IPC::SyncMessage*>(new_msg_ptr->get()))) \
+          return false; \
+        break; \
+      }
+
+namespace ppapi {
+namespace proxy {
+
+class SerializedHandle;
+
+HandleConverter::HandleConverter() {
+}
+
+bool HandleConverter::ConvertNativeHandlesToPosix(
+    const IPC::Message& msg,
+    std::vector<SerializedHandle>* handles,
+    scoped_ptr<IPC::Message>* new_msg_ptr) {
+  DCHECK(handles);
+  DCHECK(new_msg_ptr);
+  DCHECK(!new_msg_ptr->get());
+
+  // In Windows, we need to re-write the contents of the message. This is
+  // because in Windows IPC code, native HANDLE values are serialized in the
+  // body of the message.
+  //
+  // In POSIX, we only serialize an index in to a FileDescriptorSet, and the
+  // actual file descriptors are sent out-of-band. So on Windows, to make a
+  // message that's compatible with Windows, we need to write a new message that
+  // has simple indices in the message body instead of the HANDLEs.
+  //
+  // NOTE: This means on Windows, new_msg_ptr's serialized contents are not
+  // compatible with Windows IPC deserialization code; it is intended to be
+  // passed to NaCl.
+#if defined(OS_WIN)
+  new_msg_ptr->reset(
+      new IPC::Message(msg.routing_id(), msg.type(), msg.priority()));
+#else
+  // Even on POSIX, we have to rewrite messages to create channels, because
+  // these contain a handle with an invalid (place holder) descriptor. The
+  // message sending code sees this and doesn't pass the descriptor over
+  // correctly.
+  if (msg.type() == PpapiMsg_CreateNaClChannel::ID) {
+    new_msg_ptr->reset(
+        new IPC::Message(msg.routing_id(), msg.type(), msg.priority()));
+  }
+#endif
+
+  switch (msg.type()) {
+    CASE_FOR_MESSAGE(PpapiMsg_CreateNaClChannel)
+    CASE_FOR_MESSAGE(PpapiMsg_PPBAudio_NotifyAudioStreamCreated)
+    CASE_FOR_MESSAGE(PpapiMsg_PPPMessaging_HandleMessage)
+    CASE_FOR_MESSAGE(PpapiPluginMsg_ResourceReply)
+    case IPC_REPLY_ID: {
+      int id = IPC::SyncMessage::GetMessageId(msg);
+      PendingSyncMsgMap::iterator iter(pending_sync_msgs_.find(id));
+      if (iter == pending_sync_msgs_.end()) {
+        NOTREACHED();
+        return false;
+      }
+      uint32_t type = iter->second;
+      pending_sync_msgs_.erase(iter);
+      switch (type) {
+        CASE_FOR_REPLY(PpapiHostMsg_PPBGraphics3D_GetTransferBuffer)
+        CASE_FOR_REPLY(PpapiHostMsg_PPBImageData_CreateNaCl)
+        CASE_FOR_REPLY(PpapiHostMsg_ResourceSyncCall)
+        CASE_FOR_REPLY(PpapiHostMsg_SharedMemory_CreateSharedMemory)
+        default:
+          // Do nothing for messages we don't know.
+          break;
+      }
+      break;
+    }
+    default:
+      // Do nothing for messages we don't know.
+      break;
+  }
+  return true;
+}
+
+void HandleConverter::RegisterSyncMessageForReply(const IPC::Message& msg) {
+  DCHECK(msg.is_sync());
+
+  int msg_id = IPC::SyncMessage::GetMessageId(msg);
+  DCHECK(pending_sync_msgs_.find(msg_id) == pending_sync_msgs_.end());
+
+  pending_sync_msgs_[msg_id] = msg.type();
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/handle_converter.h b/ppapi/proxy/handle_converter.h
new file mode 100644
index 0000000..456ee8d
--- /dev/null
+++ b/ppapi/proxy/handle_converter.h
@@ -0,0 +1,62 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_HANDLE_CONVERTER_H_
+#define PPAPI_PROXY_HANDLE_CONVERTER_H_
+
+#include <map>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+
+namespace IPC {
+class Message;
+}
+
+namespace ppapi {
+namespace proxy {
+
+class SerializedHandle;
+
+class PPAPI_PROXY_EXPORT HandleConverter {
+ public:
+  HandleConverter();
+
+  // Convert the native handles in |msg| to NaCl style.
+  // In some cases (e.g., Windows), we need to re-write the contents of the
+  // message; in those cases, |new_msg_ptr| will be set to the new message.
+  // If |msg| is already in a good form for NaCl, |new_msg_ptr| is left NULL.
+  // See the explanation in the body of the method.
+  //
+  // In either case, all the handles in |msg| are extracted into |handles| so
+  // that they can be converted to NaClDesc handles.
+  // See chrome/nacl/nacl_ipc_adapter.cc for where this gets used.
+  bool ConvertNativeHandlesToPosix(const IPC::Message& msg,
+                                   std::vector<SerializedHandle>* handles,
+                                   scoped_ptr<IPC::Message>* new_msg_ptr);
+
+  // This method informs HandleConverter that a sync message is being sent so
+  // that it can associate reply messages with their type.
+  //
+  // Users of HandleConverter must call this when they send a synchronous
+  // message, otherwise HandleConverter won't be able to convert handles in
+  // replies.
+  void RegisterSyncMessageForReply(const IPC::Message& msg);
+
+ private:
+  // When we send a synchronous message (from untrusted to trusted), we store
+  // its type here, so that later we can associate the reply with its type
+  // and potentially translate handles in the message.
+  typedef std::map<int, uint32> PendingSyncMsgMap;
+  PendingSyncMsgMap pending_sync_msgs_;
+
+  DISALLOW_COPY_AND_ASSIGN(HandleConverter);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_HANDLE_CONVERTER_H_
diff --git a/ppapi/proxy/host_dispatcher.cc b/ppapi/proxy/host_dispatcher.cc
index 82568ab..cea7ab3 100644
--- a/ppapi/proxy/host_dispatcher.cc
+++ b/ppapi/proxy/host_dispatcher.cc
@@ -87,10 +87,12 @@
 
 bool HostDispatcher::InitHostWithChannel(
     Delegate* delegate,
+    base::ProcessId peer_pid,
     const IPC::ChannelHandle& channel_handle,
     bool is_client,
     const ppapi::Preferences& preferences) {
-  if (!Dispatcher::InitWithChannel(delegate, channel_handle, is_client))
+  if (!Dispatcher::InitWithChannel(delegate, peer_pid, channel_handle,
+                                   is_client))
     return false;
   AddIOThreadMessageFilter(sync_status_.get());
 
@@ -247,7 +249,7 @@
                                             int int_log_level,
                                             const std::string& source,
                                             const std::string& value) {
-  PP_LogLevel_Dev level = static_cast<PP_LogLevel_Dev>(int_log_level);
+  PP_LogLevel level = static_cast<PP_LogLevel>(int_log_level);
   if (instance) {
     PpapiGlobals::Get()->LogWithSource(instance, level, source, value);
   } else {
diff --git a/ppapi/proxy/host_dispatcher.h b/ppapi/proxy/host_dispatcher.h
index 98a7ad5..1b0c9a7 100644
--- a/ppapi/proxy/host_dispatcher.h
+++ b/ppapi/proxy/host_dispatcher.h
@@ -58,6 +58,7 @@
   // The delegate pointer must outlive this class, ownership is not
   // transferred.
   virtual bool InitHostWithChannel(Delegate* delegate,
+                                   base::ProcessId peer_pid,
                                    const IPC::ChannelHandle& channel_handle,
                                    bool is_client,
                                    const Preferences& preferences);
diff --git a/ppapi/proxy/host_resolver_private_resource.cc b/ppapi/proxy/host_resolver_private_resource.cc
new file mode 100644
index 0000000..68cf831
--- /dev/null
+++ b/ppapi/proxy/host_resolver_private_resource.cc
@@ -0,0 +1,97 @@
+// 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 "ppapi/proxy/host_resolver_private_resource.h"
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/var.h"
+
+namespace ppapi {
+namespace proxy {
+
+HostResolverPrivateResource::HostResolverPrivateResource(Connection connection,
+                                                         PP_Instance instance)
+    : PluginResource(connection, instance) {
+  SendCreate(BROWSER, PpapiHostMsg_HostResolverPrivate_Create());
+}
+
+HostResolverPrivateResource::~HostResolverPrivateResource() {
+}
+
+thunk::PPB_HostResolver_Private_API*
+HostResolverPrivateResource::AsPPB_HostResolver_Private_API() {
+  return this;
+}
+
+int32_t HostResolverPrivateResource::Resolve(
+    const char* host,
+    uint16_t port,
+    const PP_HostResolver_Private_Hint* hint,
+    scoped_refptr<TrackedCallback> callback) {
+  if (!host)
+    return PP_ERROR_BADARGUMENT;
+  if (ResolveInProgress())
+    return PP_ERROR_INPROGRESS;
+
+  resolve_callback_ = callback;
+
+  HostPortPair host_port;
+  host_port.host = host;
+  host_port.port = port;
+
+  SendResolve(host_port, hint);
+  return PP_OK_COMPLETIONPENDING;
+}
+
+PP_Var HostResolverPrivateResource::GetCanonicalName() {
+  return StringVar::StringToPPVar(canonical_name_);
+}
+
+uint32_t HostResolverPrivateResource::GetSize() {
+  if (ResolveInProgress())
+    return 0;
+  return static_cast<uint32_t>(net_address_list_.size());
+}
+
+bool HostResolverPrivateResource::GetNetAddress(
+    uint32 index,
+    PP_NetAddress_Private* address) {
+  if (ResolveInProgress() || index >= GetSize())
+    return false;
+  *address = net_address_list_[index];
+  return true;
+}
+
+void HostResolverPrivateResource::OnPluginMsgResolveReply(
+    const ResourceMessageReplyParams& params,
+    const std::string& canonical_name,
+    const std::vector<PP_NetAddress_Private>& net_address_list) {
+  if (params.result() == PP_OK) {
+    canonical_name_ = canonical_name;
+    net_address_list_ = net_address_list;
+  } else {
+    canonical_name_.clear();
+    net_address_list_.clear();
+  }
+  resolve_callback_->Run(params.result());
+}
+
+void HostResolverPrivateResource::SendResolve(
+    const HostPortPair& host_port,
+    const PP_HostResolver_Private_Hint* hint) {
+  PpapiHostMsg_HostResolverPrivate_Resolve msg(host_port, *hint);
+  Call<PpapiPluginMsg_HostResolverPrivate_ResolveReply>(
+      BROWSER,
+      msg,
+      base::Bind(&HostResolverPrivateResource::OnPluginMsgResolveReply,
+                 base::Unretained(this)));
+}
+
+bool HostResolverPrivateResource::ResolveInProgress() const {
+  return TrackedCallback::IsPending(resolve_callback_);
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/host_resolver_private_resource.h b/ppapi/proxy/host_resolver_private_resource.h
new file mode 100644
index 0000000..d751603c8
--- /dev/null
+++ b/ppapi/proxy/host_resolver_private_resource.h
@@ -0,0 +1,73 @@
+// 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 PPAPI_PROXY_HOST_RESOLVER_PRIVATE_RESOURCE_H_
+#define PPAPI_PROXY_HOST_RESOLVER_PRIVATE_RESOURCE_H_
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/ref_counted.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/ppb_host_resolver_private_api.h"
+
+namespace ppapi {
+
+struct HostPortPair {
+  std::string host;
+  uint16_t port;
+};
+
+namespace proxy {
+
+class PPAPI_PROXY_EXPORT HostResolverPrivateResource
+    : public PluginResource,
+      public thunk::PPB_HostResolver_Private_API {
+ public:
+  HostResolverPrivateResource(Connection connection,
+                              PP_Instance instance);
+  virtual ~HostResolverPrivateResource();
+
+  // PluginResource overrides.
+  virtual thunk::PPB_HostResolver_Private_API*
+      AsPPB_HostResolver_Private_API() OVERRIDE;
+
+  // PPB_HostResolver_Private_API implementation.
+  virtual int32_t Resolve(const char* host,
+                          uint16_t port,
+                          const PP_HostResolver_Private_Hint* hint,
+                          scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual PP_Var GetCanonicalName() OVERRIDE;
+  virtual uint32_t GetSize() OVERRIDE;
+  virtual bool GetNetAddress(uint32_t index,
+                             PP_NetAddress_Private* address) OVERRIDE;
+
+ private:
+  // IPC message handlers.
+  void OnPluginMsgResolveReply(
+      const ResourceMessageReplyParams& params,
+      const std::string& canonical_name,
+      const std::vector<PP_NetAddress_Private>& net_address_list);
+
+  void SendResolve(const HostPortPair& host_port,
+                   const PP_HostResolver_Private_Hint* hint);
+
+  bool ResolveInProgress() const;
+
+  scoped_refptr<TrackedCallback> resolve_callback_;
+
+  std::string canonical_name_;
+  std::vector<PP_NetAddress_Private> net_address_list_;
+
+  DISALLOW_COPY_AND_ASSIGN(HostResolverPrivateResource);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_HOST_RESOLVER_PRIVATE_RESOURCE_H_
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index 89de5b4..ac8a6d4 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -9,28 +9,32 @@
 #include "ppapi/c/dev/ppb_audio_input_dev.h"
 #include "ppapi/c/dev/ppb_buffer_dev.h"
 #include "ppapi/c/dev/ppb_char_set_dev.h"
-#include "ppapi/c/dev/ppb_console_dev.h"
 #include "ppapi/c/dev/ppb_crypto_dev.h"
 #include "ppapi/c/dev/ppb_cursor_control_dev.h"
 #include "ppapi/c/dev/ppb_device_ref_dev.h"
+#include "ppapi/c/dev/ppb_directory_reader_dev.h"
 #include "ppapi/c/dev/ppb_font_dev.h"
 #include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
 #include "ppapi/c/dev/ppb_graphics_2d_dev.h"
 #include "ppapi/c/dev/ppb_ime_input_event_dev.h"
 #include "ppapi/c/dev/ppb_keyboard_input_event_dev.h"
 #include "ppapi/c/dev/ppb_memory_dev.h"
-#include "ppapi/c/dev/ppb_message_loop_dev.h"
 #include "ppapi/c/dev/ppb_opengles2ext_dev.h"
 #include "ppapi/c/dev/ppb_printing_dev.h"
 #include "ppapi/c/dev/ppb_resource_array_dev.h"
 #include "ppapi/c/dev/ppb_testing_dev.h"
 #include "ppapi/c/dev/ppb_text_input_dev.h"
+#include "ppapi/c/dev/ppb_trace_event_dev.h"
+#include "ppapi/c/dev/ppb_truetype_font_dev.h"
 #include "ppapi/c/dev/ppb_url_util_dev.h"
+#include "ppapi/c/dev/ppb_var_array_dev.h"
 #include "ppapi/c/dev/ppb_var_deprecated.h"
+#include "ppapi/c/dev/ppb_var_dictionary_dev.h"
 #include "ppapi/c/dev/ppb_video_capture_dev.h"
 #include "ppapi/c/dev/ppb_view_dev.h"
 #include "ppapi/c/ppb_audio_config.h"
 #include "ppapi/c/ppb_audio.h"
+#include "ppapi/c/ppb_console.h"
 #include "ppapi/c/ppb_core.h"
 #include "ppapi/c/ppb_file_io.h"
 #include "ppapi/c/ppb_file_ref.h"
@@ -40,6 +44,7 @@
 #include "ppapi/c/ppb_image_data.h"
 #include "ppapi/c/ppb_input_event.h"
 #include "ppapi/c/ppb_instance.h"
+#include "ppapi/c/ppb_message_loop.h"
 #include "ppapi/c/ppb_messaging.h"
 #include "ppapi/c/ppb_mouse_lock.h"
 #include "ppapi/c/ppb_opengles2.h"
@@ -62,11 +67,13 @@
 #include "ppapi/c/private/ppb_flash_menu.h"
 #include "ppapi/c/private/ppb_flash_message_loop.h"
 #include "ppapi/c/private/ppb_flash_print.h"
+#include "ppapi/c/private/ppb_host_resolver_private.h"
 #include "ppapi/c/private/ppb_net_address_private.h"
 #include "ppapi/c/private/ppb_network_list_private.h"
 #include "ppapi/c/private/ppb_network_monitor_private.h"
 #include "ppapi/c/private/ppb_pdf.h"
 #include "ppapi/c/private/ppb_talk_private.h"
+#include "ppapi/c/private/ppb_tcp_server_socket_private.h"
 #include "ppapi/c/private/ppb_tcp_socket_private.h"
 #include "ppapi/c/private/ppb_udp_socket_private.h"
 #include "ppapi/c/private/ppb_x509_certificate_private.h"
@@ -74,6 +81,7 @@
 #include "ppapi/c/trusted/ppb_broker_trusted.h"
 #include "ppapi/c/trusted/ppb_browser_font_trusted.h"
 #include "ppapi/c/trusted/ppb_char_set_trusted.h"
+#include "ppapi/c/trusted/ppb_file_chooser_trusted.h"
 #include "ppapi/c/trusted/ppb_file_io_trusted.h"
 #include "ppapi/c/trusted/ppb_url_loader_trusted.h"
 #include "ppapi/proxy/interface_proxy.h"
@@ -81,29 +89,19 @@
 #include "ppapi/proxy/ppb_broker_proxy.h"
 #include "ppapi/proxy/ppb_buffer_proxy.h"
 #include "ppapi/proxy/ppb_core_proxy.h"
-#include "ppapi/proxy/ppb_file_io_proxy.h"
 #include "ppapi/proxy/ppb_file_ref_proxy.h"
 #include "ppapi/proxy/ppb_file_system_proxy.h"
-#include "ppapi/proxy/ppb_flash_menu_proxy.h"
 #include "ppapi/proxy/ppb_flash_message_loop_proxy.h"
-#include "ppapi/proxy/ppb_flash_proxy.h"
-#include "ppapi/proxy/ppb_graphics_2d_proxy.h"
 #include "ppapi/proxy/ppb_graphics_3d_proxy.h"
-#include "ppapi/proxy/ppb_host_resolver_private_proxy.h"
 #include "ppapi/proxy/ppb_image_data_proxy.h"
 #include "ppapi/proxy/ppb_instance_proxy.h"
 #include "ppapi/proxy/ppb_message_loop_proxy.h"
 #include "ppapi/proxy/ppb_network_monitor_private_proxy.h"
-#include "ppapi/proxy/ppb_pdf_proxy.h"
-#include "ppapi/proxy/ppb_talk_private_proxy.h"
 #include "ppapi/proxy/ppb_tcp_server_socket_private_proxy.h"
 #include "ppapi/proxy/ppb_tcp_socket_private_proxy.h"
 #include "ppapi/proxy/ppb_testing_proxy.h"
-#include "ppapi/proxy/ppb_udp_socket_private_proxy.h"
 #include "ppapi/proxy/ppb_url_loader_proxy.h"
-#include "ppapi/proxy/ppb_url_response_info_proxy.h"
 #include "ppapi/proxy/ppb_var_deprecated_proxy.h"
-#include "ppapi/proxy/ppb_video_capture_proxy.h"
 #include "ppapi/proxy/ppb_video_decoder_proxy.h"
 #include "ppapi/proxy/ppb_x509_certificate_private_proxy.h"
 #include "ppapi/proxy/ppp_class_proxy.h"
@@ -209,8 +207,8 @@
   AddProxy(API_ID_PPP_CLASS, &PPP_Class_Proxy::Create);
   AddPPB(PPB_CORE_INTERFACE_1_0, API_ID_PPB_CORE,
          PPB_Core_Proxy::GetPPB_Core_Interface(), PERMISSION_NONE);
-  AddPPB(PPB_MESSAGELOOP_DEV_INTERFACE_0_1, API_ID_NONE,
-         PPB_MessageLoop_Proxy::GetInterface(), PERMISSION_DEV);
+  AddPPB(PPB_MESSAGELOOP_INTERFACE_1_0, API_ID_NONE,
+         PPB_MessageLoop_Proxy::GetInterface(), PERMISSION_NONE);
   AddPPB(PPB_OPENGLES2_INTERFACE_1_0, API_ID_NONE,
          PPB_OpenGLES2_Shared::GetInterface(), PERMISSION_NONE);
   AddPPB(PPB_OPENGLES2_INSTANCEDARRAYS_INTERFACE_1_0, API_ID_NONE,
@@ -229,11 +227,6 @@
          PPB_OpenGLES2_Shared::GetChromiumMapSubInterface(), PERMISSION_NONE);
   AddPPB(PPB_OPENGLES2_QUERY_INTERFACE_1_0, API_ID_NONE,
          PPB_OpenGLES2_Shared::GetQueryInterface(), PERMISSION_NONE);
-#if !defined(OS_NACL)
-  AddPPB(PPB_FLASH_PRINT_INTERFACE_1_0, API_ID_PPB_FLASH,
-         PPB_Flash_Proxy::GetFlashPrintInterface(),
-         PERMISSION_FLASH);
-#endif
   AddPPB(PPB_VAR_ARRAY_BUFFER_INTERFACE_1_0, API_ID_NONE,
          PPB_Var_Shared::GetVarArrayBufferInterface1_0(),
          PERMISSION_NONE);
@@ -247,7 +240,6 @@
   // Do not add more stuff here, they should be added to interface_list*.h
   // TODO(brettw) remove these.
   AddPPB(PPB_Instance_Proxy::GetInfoPrivate(), PERMISSION_PRIVATE);
-  AddPPB(PPB_PDF_Proxy::GetInfo(), PERMISSION_PRIVATE);
   AddPPB(PPB_URLLoader_Proxy::GetTrustedInfo(), PERMISSION_PRIVATE);
   AddPPB(PPB_Var_Deprecated_Proxy::GetInfo(), PERMISSION_DEV);
 
@@ -264,8 +256,10 @@
   // PPP (plugin) interfaces.
   // TODO(brettw) move these to interface_list*.h
   AddProxy(API_ID_PPP_INSTANCE, &ProxyFactory<PPP_Instance_Proxy>);
+  #if !defined(OS_NACL)
   AddPPP(PPP_INSTANCE_INTERFACE_1_1, API_ID_PPP_INSTANCE,
          PPP_Instance_Proxy::GetInstanceInterface());
+  #endif
   AddProxy(API_ID_PPP_PRINTING, &ProxyFactory<PPP_Printing_Proxy>);
   AddPPP(PPP_PRINTING_DEV_INTERFACE, API_ID_PPP_PRINTING,
          PPP_Printing_Proxy::GetProxyInterface());
@@ -282,7 +276,6 @@
   AddPPP(PPP_Graphics3D_Proxy::GetInfo());
 #if !defined(OS_NACL)
   AddPPP(PPP_Instance_Private_Proxy::GetInfo());
-  AddPPP(PPP_VideoCapture_Proxy::GetInfo());
   AddPPP(PPP_VideoDecoder_Proxy::GetInfo());
 #endif
 }
diff --git a/ppapi/proxy/pepper_file_messages.cc b/ppapi/proxy/pepper_file_messages.cc
deleted file mode 100644
index 53b4fcb..0000000
--- a/ppapi/proxy/pepper_file_messages.cc
+++ /dev/null
@@ -1,68 +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.
-
-
-// Get basic type definitions.
-#define IPC_MESSAGE_IMPL
-#include "ppapi/proxy/pepper_file_messages.h"
-
-// Generate constructors.
-#include "ipc/struct_constructor_macros.h"
-#include "ppapi/proxy/pepper_file_messages.h"
-
-// Generate destructors.
-#include "ipc/struct_destructor_macros.h"
-#include "ppapi/proxy/pepper_file_messages.h"
-
-// Generate param traits write methods.
-#include "ipc/param_traits_write_macros.h"
-namespace IPC {
-#include "ppapi/proxy/pepper_file_messages.h"
-}  // namespace IPC
-
-// Generate param traits read methods.
-#include "ipc/param_traits_read_macros.h"
-namespace IPC {
-#include "ppapi/proxy/pepper_file_messages.h"
-}  // namespace IPC
-
-// Generate param traits log methods.
-#include "ipc/param_traits_log_macros.h"
-namespace IPC {
-#include "ppapi/proxy/pepper_file_messages.h"
-}  // namespace IPC
-
-namespace IPC {
-
-void ParamTraits<ppapi::PepperFilePath>::Write(Message* m,
-                                               const param_type& p) {
-  WriteParam(m, static_cast<unsigned>(p.domain()));
-  WriteParam(m, p.path());
-}
-
-bool ParamTraits<ppapi::PepperFilePath>::Read(const Message* m,
-                                              PickleIterator* iter,
-                                              param_type* p) {
-  unsigned domain;
-  FilePath path;
-  if (!ReadParam(m, iter, &domain) || !ReadParam(m, iter, &path))
-    return false;
-  if (domain > ppapi::PepperFilePath::DOMAIN_MAX_VALID)
-    return false;
-
-  *p = ppapi::PepperFilePath(
-      static_cast<ppapi::PepperFilePath::Domain>(domain), path);
-  return true;
-}
-
-void ParamTraits<ppapi::PepperFilePath>::Log(const param_type& p,
-                                             std::string* l) {
-  l->append("(");
-  LogParam(static_cast<unsigned>(p.domain()), l);
-  l->append(", ");
-  LogParam(p.path(), l);
-  l->append(")");
-}
-
-}  // namespace IPC
diff --git a/ppapi/proxy/pepper_file_messages.h b/ppapi/proxy/pepper_file_messages.h
deleted file mode 100644
index 3edd490..0000000
--- a/ppapi/proxy/pepper_file_messages.h
+++ /dev/null
@@ -1,82 +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.
-
-// Multiply-included message file, no traditional include guard.
-#include "ipc/ipc_message_macros.h"
-#include "ipc/ipc_param_traits.h"
-#include "ipc/ipc_platform_file.h"
-#include "ppapi/proxy/ppapi_proxy_export.h"
-#include "ppapi/shared_impl/dir_contents.h"
-#include "ppapi/shared_impl/file_path.h"
-
-// Singly-included section since need custom serialization.
-#ifndef PPAPI_SHARED_IMPL_PEPPER_FILE_MESSAGES_H_
-#define PPAPI_SHARED_IMPL_PEPPER_FILE_MESSAGES_H_
-
-namespace IPC {
-
-template <>
-struct ParamTraits<ppapi::PepperFilePath> {
-  typedef ppapi::PepperFilePath param_type;
-  static void Write(Message* m, const param_type& p);
-  static bool Read(const Message* m, PickleIterator* iter, param_type* p);
-  static void Log(const param_type& p, std::string* l);
-};
-
-}  // namespace IPC
-
-#endif  // PPAPI_SHARED_IMPL_PEPPER_FILE_MESSAGES_H_
-
-#undef IPC_MESSAGE_EXPORT
-#define IPC_MESSAGE_EXPORT PPAPI_PROXY_EXPORT
-
-#define IPC_MESSAGE_START PepperFileMsgStart
-
-IPC_STRUCT_TRAITS_BEGIN(ppapi::DirEntry)
-  IPC_STRUCT_TRAITS_MEMBER(name)
-  IPC_STRUCT_TRAITS_MEMBER(is_dir)
-IPC_STRUCT_TRAITS_END()
-
-// Trusted Pepper Filesystem messages from the renderer to the browser.
-
-// Open the file.
-IPC_SYNC_MESSAGE_CONTROL2_2(PepperFileMsg_OpenFile,
-                            ppapi::PepperFilePath /* path */,
-                            int /* flags */,
-                            base::PlatformFileError /* error_code */,
-                            IPC::PlatformFileForTransit /* result */)
-
-// Rename the file.
-IPC_SYNC_MESSAGE_CONTROL2_1(PepperFileMsg_RenameFile,
-                            ppapi::PepperFilePath /* from_path */,
-                            ppapi::PepperFilePath /* to_path */,
-                            base::PlatformFileError /* error_code */)
-
-// Delete the file.
-IPC_SYNC_MESSAGE_CONTROL2_1(PepperFileMsg_DeleteFileOrDir,
-                            ppapi::PepperFilePath /* path */,
-                            bool /* recursive */,
-                            base::PlatformFileError /* error_code */)
-
-// Create the directory.
-IPC_SYNC_MESSAGE_CONTROL1_1(PepperFileMsg_CreateDir,
-                            ppapi::PepperFilePath /* path */,
-                            base::PlatformFileError /* error_code */)
-
-// Query the file's info.
-IPC_SYNC_MESSAGE_CONTROL1_2(PepperFileMsg_QueryFile,
-                            ppapi::PepperFilePath /* path */,
-                            base::PlatformFileInfo, /* info */
-                            base::PlatformFileError /* error_code */)
-
-// Get the directory's contents.
-IPC_SYNC_MESSAGE_CONTROL1_2(PepperFileMsg_GetDirContents,
-                            ppapi::PepperFilePath /* path */,
-                            ppapi::DirContents, /* contents */
-                            base::PlatformFileError /* error_code */)
-
-// Create a temporary file.
-IPC_SYNC_MESSAGE_CONTROL0_2(PepperFileMsg_CreateTemporaryFile,
-                            base::PlatformFileError /* error_code */,
-                            IPC::PlatformFileForTransit /* file */)
diff --git a/ppapi/proxy/plugin_array_buffer_var.cc b/ppapi/proxy/plugin_array_buffer_var.cc
index c9d302f..e990ed8 100644
--- a/ppapi/proxy/plugin_array_buffer_var.cc
+++ b/ppapi/proxy/plugin_array_buffer_var.cc
@@ -8,28 +8,104 @@
 
 #include <limits>
 
+#include "base/process_util.h"
+#include "base/shared_memory.h"
+#include "ppapi/c/dev/ppb_buffer_dev.h"
+#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/plugin_globals.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/serialized_structs.h"
+#include "ppapi/shared_impl/host_resource.h"
+#include "ppapi/shared_impl/resource.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_buffer_api.h"
+
+using base::SharedMemory;
+using base::SharedMemoryHandle;
+using ppapi::proxy::PluginGlobals;
+using ppapi::proxy::PluginResourceTracker;
+
 namespace ppapi {
 
 PluginArrayBufferVar::PluginArrayBufferVar(uint32 size_in_bytes)
-    : buffer_(size_in_bytes) {
+    : buffer_(size_in_bytes),
+      plugin_handle_(base::SharedMemory::NULLHandle()),
+      size_in_bytes_(size_in_bytes) {
+}
+
+PluginArrayBufferVar::PluginArrayBufferVar(uint32 size_in_bytes,
+                                           SharedMemoryHandle plugin_handle)
+    : plugin_handle_(plugin_handle),
+      size_in_bytes_(size_in_bytes) {
 }
 
 PluginArrayBufferVar::~PluginArrayBufferVar() {
+  Unmap();
+
+  if (shmem_.get() == NULL) {
+    // The SharedMemory destuctor can't close the handle for us.
+    if (SharedMemory::IsHandleValid(plugin_handle_))
+      SharedMemory::CloseHandle(plugin_handle_);
+  } else {
+    // Delete SharedMemory, if we have one.
+    shmem_.reset();
+  }
 }
 
 void* PluginArrayBufferVar::Map() {
+  if (shmem_.get())
+    return shmem_->memory();
+  if (SharedMemory::IsHandleValid(plugin_handle_)) {
+    shmem_.reset(new SharedMemory(plugin_handle_, false));
+    if (!shmem_->Map(size_in_bytes_)) {
+      shmem_.reset();
+      return NULL;
+    }
+    return shmem_->memory();
+  }
   if (buffer_.empty())
     return NULL;
   return &(buffer_[0]);
 }
 
 void PluginArrayBufferVar::Unmap() {
-  // We don't actually use shared memory yet, so do nothing.
+  if (shmem_.get())
+    shmem_->Unmap();
 }
 
 uint32 PluginArrayBufferVar::ByteLength() {
-  return static_cast<uint32>(buffer_.size());
+  return size_in_bytes_;
+}
+
+bool PluginArrayBufferVar::CopyToNewShmem(
+    PP_Instance instance,
+    int* host_handle_id,
+    SharedMemoryHandle* plugin_out_handle) {
+  ppapi::proxy::PluginDispatcher* dispatcher =
+      ppapi::proxy::PluginDispatcher::GetForInstance(instance);
+  if (!dispatcher)
+    return false;
+
+  ppapi::proxy::SerializedHandle plugin_handle;
+  dispatcher->Send(new PpapiHostMsg_SharedMemory_CreateSharedMemory(
+      instance, ByteLength(), host_handle_id, &plugin_handle));
+  if (!plugin_handle.IsHandleValid() || !plugin_handle.is_shmem() ||
+      *host_handle_id == -1)
+    return false;
+
+  base::SharedMemoryHandle tmp_handle = plugin_handle.shmem();
+  SharedMemory s(tmp_handle, false);
+  if (!s.Map(ByteLength()))
+    return false;
+  memcpy(s.memory(), Map(), ByteLength());
+  s.Unmap();
+
+  // We don't need to keep the shared memory around on the plugin side;
+  // we've already copied all our data into it. We'll make it invalid
+  // just to be safe.
+  *plugin_out_handle = base::SharedMemory::NULLHandle();
+
+  return true;
 }
 
 }  // namespace ppapi
-
diff --git a/ppapi/proxy/plugin_array_buffer_var.h b/ppapi/proxy/plugin_array_buffer_var.h
index 2eed216..bcafe8c 100644
--- a/ppapi/proxy/plugin_array_buffer_var.h
+++ b/ppapi/proxy/plugin_array_buffer_var.h
@@ -8,6 +8,9 @@
 #include <vector>
 
 #include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/shared_memory.h"
+#include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_stdint.h"
 #include "ppapi/shared_impl/var.h"
 
@@ -18,17 +21,28 @@
 class PluginArrayBufferVar : public ArrayBufferVar {
  public:
   explicit PluginArrayBufferVar(uint32 size_in_bytes);
+  PluginArrayBufferVar(uint32 size_in_bytes,
+                       base::SharedMemoryHandle plugin_handle);
   virtual ~PluginArrayBufferVar();
 
   // ArrayBufferVar implementation.
   virtual void* Map() OVERRIDE;
   virtual void Unmap() OVERRIDE;
   virtual uint32 ByteLength() OVERRIDE;
+  virtual bool CopyToNewShmem(
+      PP_Instance instance,
+      int* host_handle,
+      base::SharedMemoryHandle* plugin_handle) OVERRIDE;
 
  private:
-  // TODO(dmichael): Use shared memory for this.
+  // Non-shared memory
   std::vector<uint8> buffer_;
 
+  // Shared memory
+  base::SharedMemoryHandle plugin_handle_;
+  scoped_ptr<base::SharedMemory> shmem_;
+  uint32 size_in_bytes_;
+
   DISALLOW_COPY_AND_ASSIGN(PluginArrayBufferVar);
 };
 
diff --git a/ppapi/proxy/plugin_dispatcher.cc b/ppapi/proxy/plugin_dispatcher.cc
index 37f1f1f..812b2e9 100644
--- a/ppapi/proxy/plugin_dispatcher.cc
+++ b/ppapi/proxy/plugin_dispatcher.cc
@@ -16,6 +16,7 @@
 #include "ppapi/c/ppp_instance.h"
 #include "ppapi/proxy/flash_resource.h"
 #include "ppapi/proxy/flash_clipboard_resource.h"
+#include "ppapi/proxy/flash_file_resource.h"
 #include "ppapi/proxy/gamepad_resource.h"
 #include "ppapi/proxy/interface_list.h"
 #include "ppapi/proxy/interface_proxy.h"
@@ -32,7 +33,7 @@
 #include "ppapi/shared_impl/resource.h"
 
 #if defined(OS_POSIX) && !defined(OS_NACL)
-#include "base/eintr_wrapper.h"
+#include "base/posix/eintr_wrapper.h"
 #include "ipc/ipc_channel_posix.h"
 #endif
 
@@ -50,8 +51,7 @@
 }  // namespace
 
 InstanceData::InstanceData()
-    : flash_fullscreen(PP_FALSE),
-      is_request_surrounding_text_pending(false),
+    : is_request_surrounding_text_pending(false),
       should_do_request_surrounding_text(false) {
 }
 
@@ -117,7 +117,7 @@
 
 // static
 void PluginDispatcher::LogWithSource(PP_Instance instance,
-                                     PP_LogLevel_Dev level,
+                                     PP_LogLevel level,
                                      const std::string& source,
                                      const std::string& value) {
   if (!g_live_dispatchers || !g_instance_to_dispatcher)
@@ -155,9 +155,11 @@
 
 bool PluginDispatcher::InitPluginWithChannel(
     PluginDelegate* delegate,
+    base::ProcessId peer_pid,
     const IPC::ChannelHandle& channel_handle,
     bool is_client) {
-  if (!Dispatcher::InitWithChannel(delegate, channel_handle, is_client))
+  if (!Dispatcher::InitWithChannel(delegate, peer_pid, channel_handle,
+                                   is_client))
     return false;
   plugin_delegate_ = delegate;
   plugin_dispatcher_id_ = plugin_delegate_->Register(this);
@@ -192,6 +194,10 @@
   if (msg->is_sync()) {
     // Synchronous messages might be re-entrant, so we need to drop the lock.
     ProxyAutoUnlock unlock;
+
+    // TODO(yzshen): Make sending message thread-safe. It may be accessed from
+    // non-main threads. Moreover, since the proxy lock has been released, it
+    // may be accessed by multiple threads at the same time.
     return Dispatcher::Send(msg);
   }
   return Dispatcher::Send(msg);
@@ -339,8 +345,9 @@
   Resource* resource = PpapiGlobals::Get()->GetResourceTracker()->GetResource(
       reply_params.pp_resource());
   if (!resource) {
-    if (reply_params.sequence())
-      NOTREACHED();
+    DLOG_IF(INFO, reply_params.sequence() != 0)
+        << "Pepper resource reply message received but the resource doesn't "
+           "exist (probably has been destroyed).";
     return;
   }
   resource->OnReplyReceived(reply_params, nested_msg);
diff --git a/ppapi/proxy/plugin_dispatcher.h b/ppapi/proxy/plugin_dispatcher.h
index a6cc720..1c213b6 100644
--- a/ppapi/proxy/plugin_dispatcher.h
+++ b/ppapi/proxy/plugin_dispatcher.h
@@ -14,12 +14,13 @@
 #include "base/memory/weak_ptr.h"
 #include "base/process.h"
 #include "build/build_config.h"
-#include "ppapi/c/dev/ppb_console_dev.h"
 #include "ppapi/c/pp_rect.h"
 #include "ppapi/c/pp_instance.h"
+#include "ppapi/c/ppb_console.h"
 #include "ppapi/proxy/dispatcher.h"
 #include "ppapi/shared_impl/ppapi_preferences.h"
 #include "ppapi/shared_impl/ppb_view_shared.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
 #include "ppapi/shared_impl/tracked_callback.h"
 
 namespace ppapi {
@@ -34,9 +35,6 @@
 
 namespace proxy {
 
-class FlashClipboardResource;
-class FlashResource;
-class GamepadResource;
 class ResourceMessageReplyParams;
 
 // Used to keep track of per-instance data.
@@ -46,16 +44,13 @@
 
   ViewData view;
 
-  PP_Bool flash_fullscreen;  // Used for PPB_FlashFullscreen.
-
   // When non-NULL, indicates the callback to execute when mouse lock is lost.
   scoped_refptr<TrackedCallback> mouse_lock_callback;
 
-  // The following are lazily created the first time the plugin requests them.
-  // (These are singleton-style resources).
-  scoped_refptr<GamepadResource> gamepad_resource;
-  scoped_refptr<FlashResource> flash_resource;
-  scoped_refptr<FlashClipboardResource> flash_clipboard_resource;
+  // A map of singleton resources which are lazily created.
+  typedef std::map<SingletonResourceID, scoped_refptr<Resource> >
+      SingletonResourceMap;
+  SingletonResourceMap singleton_resources;
 
   // Calls to |RequestSurroundingText()| are done by posted tasks. Track whether
   // a) a task is pending, to avoid redundant calls, and b) whether we should
@@ -121,7 +116,7 @@
   // invalid, to all instances associated with all dispatchers. Used for
   // global log messages.
   static void LogWithSource(PP_Instance instance,
-                            PP_LogLevel_Dev level,
+                            PP_LogLevel level,
                             const std::string& source,
                             const std::string& value);
 
@@ -131,6 +126,7 @@
   // The delegate pointer must outlive this class, ownership is not
   // transferred.
   bool InitPluginWithChannel(PluginDelegate* delegate,
+                             base::ProcessId peer_pid,
                              const IPC::ChannelHandle& channel_handle,
                              bool is_client);
 
diff --git a/ppapi/proxy/plugin_globals.cc b/ppapi/proxy/plugin_globals.cc
index 75369d0..2e18ac5 100644
--- a/ppapi/proxy/plugin_globals.cc
+++ b/ppapi/proxy/plugin_globals.cc
@@ -4,14 +4,46 @@
 
 #include "ppapi/proxy/plugin_globals.h"
 
+#include "ipc/ipc_message.h"
+#include "ipc/ipc_sender.h"
 #include "ppapi/proxy/plugin_dispatcher.h"
 #include "ppapi/proxy/plugin_proxy_delegate.h"
 #include "ppapi/proxy/ppb_message_loop_proxy.h"
+#include "ppapi/shared_impl/proxy_lock.h"
 #include "ppapi/thunk/enter.h"
 
 namespace ppapi {
 namespace proxy {
 
+// It performs necessary locking/unlocking of the proxy lock, and forwards all
+// messages to the underlying sender.
+class PluginGlobals::BrowserSender : public IPC::Sender {
+ public:
+  // |underlying_sender| must outlive this object.
+  explicit BrowserSender(IPC::Sender* underlying_sender)
+      : underlying_sender_(underlying_sender) {
+  }
+
+  virtual ~BrowserSender() {}
+
+  // IPC::Sender implementation.
+  virtual bool Send(IPC::Message* msg) OVERRIDE {
+    if (msg->is_sync()) {
+      // Synchronous messages might be re-entrant, so we need to drop the lock.
+      ProxyAutoUnlock unlock;
+      return underlying_sender_->Send(msg);
+    }
+
+    return underlying_sender_->Send(msg);
+  }
+
+ private:
+  // Non-owning pointer.
+  IPC::Sender* underlying_sender_;
+
+  DISALLOW_COPY_AND_ASSIGN(BrowserSender);
+};
+
 PluginGlobals* PluginGlobals::plugin_globals_ = NULL;
 
 PluginGlobals::PluginGlobals()
@@ -20,19 +52,37 @@
       callback_tracker_(new CallbackTracker),
       loop_for_main_thread_(
           new MessageLoopResource(MessageLoopResource::ForMainThread())) {
+#if defined(ENABLE_PEPPER_THREADING)
+  enable_threading_ = true;
+#else
+  enable_threading_ = false;
+#endif
+
   DCHECK(!plugin_globals_);
   plugin_globals_ = this;
 }
 
-PluginGlobals::PluginGlobals(ForTest for_test)
-    : ppapi::PpapiGlobals(for_test),
+PluginGlobals::PluginGlobals(PerThreadForTest per_thread_for_test)
+    : ppapi::PpapiGlobals(per_thread_for_test),
       plugin_proxy_delegate_(NULL),
       callback_tracker_(new CallbackTracker) {
+#if defined(ENABLE_PEPPER_THREADING)
+  enable_threading_ = true;
+#else
+  enable_threading_ = false;
+#endif
   DCHECK(!plugin_globals_);
 }
 
 PluginGlobals::~PluginGlobals() {
   DCHECK(plugin_globals_ == this || !plugin_globals_);
+  // Release the main-thread message loop. We should have the last reference
+  // count, so this will delete the MessageLoop resource. We do this before
+  // we clear plugin_globals_, because the Resource destructor tries to access
+  // this PluginGlobals.
+  DCHECK(!loop_for_main_thread_ || loop_for_main_thread_->HasOneRef());
+  loop_for_main_thread_ = NULL;
+
   plugin_globals_ = NULL;
 }
 
@@ -76,19 +126,18 @@
 }
 
 void PluginGlobals::PreCacheFontForFlash(const void* logfontw) {
+  ProxyAutoUnlock unlock;
   plugin_proxy_delegate_->PreCacheFont(logfontw);
 }
 
 base::Lock* PluginGlobals::GetProxyLock() {
-#ifdef ENABLE_PEPPER_THREADING
-  return &proxy_lock_;
-#else
+  if (enable_threading_)
+    return &proxy_lock_;
   return NULL;
-#endif
 }
 
 void PluginGlobals::LogWithSource(PP_Instance instance,
-                                  PP_LogLevel_Dev level,
+                                  PP_LogLevel level,
                                   const std::string& source,
                                   const std::string& value) {
   const std::string& fixed_up_source = source.empty() ? plugin_name_ : source;
@@ -96,7 +145,7 @@
 }
 
 void PluginGlobals::BroadcastLogWithSource(PP_Module /* module */,
-                                           PP_LogLevel_Dev level,
+                                           PP_LogLevel level,
                                            const std::string& source,
                                            const std::string& value) {
   // Since we have only one module in a plugin process, broadcast is always
@@ -109,6 +158,23 @@
   return MessageLoopResource::GetCurrent();
 }
 
+IPC::Sender* PluginGlobals::GetBrowserSender() {
+  if (!browser_sender_.get()) {
+    browser_sender_.reset(
+        new BrowserSender(plugin_proxy_delegate_->GetBrowserSender()));
+  }
+
+  return browser_sender_.get();
+}
+
+std::string PluginGlobals::GetUILanguage() {
+  return plugin_proxy_delegate_->GetUILanguage();
+}
+
+void PluginGlobals::SetActiveURL(const std::string& url) {
+  plugin_proxy_delegate_->SetActiveURL(url);
+}
+
 MessageLoopResource* PluginGlobals::loop_for_main_thread() {
   return loop_for_main_thread_.get();
 }
diff --git a/ppapi/proxy/plugin_globals.h b/ppapi/proxy/plugin_globals.h
index 215ad63..4da6d5f 100644
--- a/ppapi/proxy/plugin_globals.h
+++ b/ppapi/proxy/plugin_globals.h
@@ -5,6 +5,8 @@
 #ifndef PPAPI_PROXY_PLUGIN_GLOBALS_H_
 #define PPAPI_PROXY_PLUGIN_GLOBALS_H_
 
+#include <string>
+
 #include "base/compiler_specific.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/synchronization/lock.h"
@@ -15,6 +17,10 @@
 #include "ppapi/shared_impl/callback_tracker.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
 
+namespace IPC {
+class Sender;
+}
+
 namespace ppapi {
 namespace proxy {
 
@@ -24,14 +30,16 @@
 class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals {
  public:
   PluginGlobals();
-  PluginGlobals(PpapiGlobals::ForTest);
+  explicit PluginGlobals(PpapiGlobals::PerThreadForTest);
   virtual ~PluginGlobals();
 
   // Getter for the global singleton. Generally, you should use
   // PpapiGlobals::Get() when possible. Use this only when you need some
   // plugin-specific functionality.
   inline static PluginGlobals* Get() {
-    DCHECK(PpapiGlobals::Get()->IsPluginGlobals());
+    // Explicitly crash if this is the wrong process type, we want to get
+    // crash reports.
+    CHECK(PpapiGlobals::Get()->IsPluginGlobals());
     return static_cast<PluginGlobals*>(PpapiGlobals::Get());
   }
 
@@ -49,15 +57,24 @@
   virtual void PreCacheFontForFlash(const void* logfontw) OVERRIDE;
   virtual base::Lock* GetProxyLock() OVERRIDE;
   virtual void LogWithSource(PP_Instance instance,
-                             PP_LogLevel_Dev level,
+                             PP_LogLevel level,
                              const std::string& source,
                              const std::string& value) OVERRIDE;
   virtual void BroadcastLogWithSource(PP_Module module,
-                                      PP_LogLevel_Dev level,
+                                      PP_LogLevel level,
                                       const std::string& source,
                                       const std::string& value) OVERRIDE;
   virtual MessageLoopShared* GetCurrentMessageLoop() OVERRIDE;
 
+  // Returns the channel for sending to the browser.
+  IPC::Sender* GetBrowserSender();
+
+  // Returns the language code of the current UI language.
+  std::string GetUILanguage();
+
+  // Sets the active url which is reported by breakpad.
+  void SetActiveURL(const std::string& url);
+
   // Getters for the plugin-specific versions.
   PluginResourceTracker* plugin_resource_tracker() {
     return &plugin_resource_tracker_;
@@ -67,9 +84,6 @@
   }
 
   // The embedder should call set_proxy_delegate during startup.
-  PluginProxyDelegate* plugin_proxy_delegate() {
-    return plugin_proxy_delegate_;
-  }
   void set_plugin_proxy_delegate(PluginProxyDelegate* d) {
     plugin_proxy_delegate_ = d;
   }
@@ -100,7 +114,13 @@
   // The embedder should call this function when the command line is known.
   void set_command_line(const std::string& c) { command_line_ = c; }
 
+  // Sets whether threadsafety is supported. Defaults to whether the
+  // ENABLE_PEPPER_THREADING build flag is set.
+  void set_enable_threading(bool enable) { enable_threading_ = enable; }
+
  private:
+  class BrowserSender;
+
   // PpapiGlobals overrides.
   virtual bool IsPluginGlobals() const OVERRIDE;
 
@@ -110,6 +130,8 @@
   PluginResourceTracker plugin_resource_tracker_;
   PluginVarTracker plugin_var_tracker_;
   scoped_refptr<CallbackTracker> callback_tracker_;
+
+  bool enable_threading_;  // Indicates whether we'll use the lock.
   base::Lock proxy_lock_;
 
   scoped_ptr<base::ThreadLocalStorage::Slot> msg_loop_slot_;
@@ -125,6 +147,8 @@
   // called.
   std::string command_line_;
 
+  scoped_ptr<BrowserSender> browser_sender_;
+
   DISALLOW_COPY_AND_ASSIGN(PluginGlobals);
 };
 
diff --git a/ppapi/proxy/plugin_main_nacl.cc b/ppapi/proxy/plugin_main_nacl.cc
index 67470fe..8733b9c 100644
--- a/ppapi/proxy/plugin_main_nacl.cc
+++ b/ppapi/proxy/plugin_main_nacl.cc
@@ -14,6 +14,7 @@
 #include "base/message_loop.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/threading/thread.h"
+#include "components/tracing/child_trace_message_filter.h"
 #include "ipc/ipc_channel_handle.h"
 #include "ipc/ipc_logging.h"
 #include "ipc/ipc_message.h"
@@ -65,14 +66,13 @@
   virtual base::WaitableEvent* GetShutdownEvent() OVERRIDE;
   virtual IPC::PlatformFileForTransit ShareHandleWithRemote(
       base::PlatformFile handle,
-      const IPC::SyncChannel& channel,
+      base::ProcessId peer_pid,
       bool should_close_source) OVERRIDE;
   virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet() OVERRIDE;
   virtual uint32 Register(PluginDispatcher* plugin_dispatcher) OVERRIDE;
   virtual void Unregister(uint32 plugin_dispatcher_id) OVERRIDE;
 
   // PluginProxyDelegate implementation.
-  virtual bool SendToBrowser(IPC::Message* msg) OVERRIDE;
   virtual IPC::Sender* GetBrowserSender() OVERRIDE;
   virtual std::string GetUILanguage() OVERRIDE;
   virtual void PreCacheFont(const void* logfontw) OVERRIDE;
@@ -86,6 +86,9 @@
                               const ppapi::PpapiPermissions& permissions,
                               bool incognito,
                               SerializedHandle handle);
+  void OnMsgResourceReply(
+      const ppapi::proxy::ResourceMessageReplyParams& reply_params,
+      const IPC::Message& nested_msg);
   void OnPluginDispatcherMessageReceived(const IPC::Message& msg);
 
   std::set<PP_Instance> instances_;
@@ -101,7 +104,12 @@
       shutdown_event_(true, false) {
   IPC::ChannelHandle channel_handle(
       "NaCl IPC", base::FileDescriptor(NACL_IPC_FD, false));
-  InitWithChannel(this, channel_handle, false);  // Channel is server.
+  // We don't have/need a PID since handle sharing happens outside of the
+  // NaCl sandbox.
+  InitWithChannel(this, base::kNullProcessId, channel_handle,
+                  false);  // Channel is server.
+  channel()->AddFilter(
+      new components::ChildTraceMessageFilter(message_loop_));
 }
 
 base::MessageLoopProxy* PpapiDispatcher::GetIPCMessageLoop() {
@@ -114,7 +122,7 @@
 
 IPC::PlatformFileForTransit PpapiDispatcher::ShareHandleWithRemote(
     base::PlatformFile handle,
-    const IPC::SyncChannel& channel,
+    base::ProcessId peer_pid,
     bool should_close_source) {
   return IPC::InvalidPlatformFileForTransit();
 }
@@ -144,10 +152,6 @@
   plugin_dispatchers_.erase(plugin_dispatcher_id);
 }
 
-bool PpapiDispatcher::SendToBrowser(IPC::Message* msg) {
-  return Send(msg);
-}
-
 IPC::Sender* PpapiDispatcher::GetBrowserSender() {
   return this;
 }
@@ -168,6 +172,7 @@
 bool PpapiDispatcher::OnMessageReceived(const IPC::Message& msg) {
   IPC_BEGIN_MESSAGE_MAP(PpapiDispatcher, msg)
     IPC_MESSAGE_HANDLER(PpapiMsg_CreateNaClChannel, OnMsgCreateNaClChannel)
+    IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnMsgResourceReply)
     // All other messages are simply forwarded to a PluginDispatcher.
     IPC_MESSAGE_UNHANDLED(OnPluginDispatcherMessageReceived(msg))
   IPC_END_MESSAGE_MAP()
@@ -188,7 +193,8 @@
       new PluginDispatcher(::PPP_GetInterface, permissions, incognito);
   // The channel handle's true name is not revealed here.
   IPC::ChannelHandle channel_handle("nacl", handle.descriptor());
-  if (!dispatcher->InitPluginWithChannel(this, channel_handle, false)) {
+  if (!dispatcher->InitPluginWithChannel(this, base::kNullProcessId,
+                                         channel_handle, false)) {
     delete dispatcher;
     return;
   }
@@ -196,6 +202,13 @@
   // lifetime of the attached channel.
 }
 
+void PpapiDispatcher::OnMsgResourceReply(
+    const ppapi::proxy::ResourceMessageReplyParams& reply_params,
+    const IPC::Message& nested_msg) {
+  ppapi::proxy::PluginDispatcher::DispatchResourceReply(reply_params,
+                                                        nested_msg);
+}
+
 void PpapiDispatcher::OnPluginDispatcherMessageReceived(
     const IPC::Message& msg) {
   // The first parameter should be a plugin dispatcher ID.
@@ -233,6 +246,8 @@
 }
 
 int PpapiPluginMain() {
+  IrtInit();
+
   // Though it isn't referenced here, we must instantiate an AtExitManager.
   base::AtExitManager exit_manager;
   MessageLoop loop;
diff --git a/ppapi/proxy/plugin_proxy_delegate.h b/ppapi/proxy/plugin_proxy_delegate.h
index de0c397..f2d7759 100644
--- a/ppapi/proxy/plugin_proxy_delegate.h
+++ b/ppapi/proxy/plugin_proxy_delegate.h
@@ -18,12 +18,10 @@
  public:
   virtual ~PluginProxyDelegate() {}
 
-  // Sends the given message to the browser. Identical semantics to IPC::Sender
-  // interface. New code should use GetBrowserSender instead.
-  // TODO(brettw) remove this.
-  virtual bool SendToBrowser(IPC::Message* msg) = 0;
-
   // Returns the channel for sending to the browser.
+  // Note: The returned sender must be thread-safe. It might be used while the
+  // proxy lock is not acquired. Please see the implementation of
+  // PluginGlobals::BrowserSender.
   virtual IPC::Sender* GetBrowserSender() = 0;
 
   // Returns the language code of the current UI language.
@@ -31,6 +29,7 @@
 
   // Performs Windows-specific font caching in the browser for the given
   // LOGFONTW. Does nothing on non-Windows platforms.
+  // Note: This method must be thread-safe.
   virtual void PreCacheFont(const void* logfontw) = 0;
 
   // Sets the active url which is reported by breakpad.
diff --git a/ppapi/proxy/plugin_resource.cc b/ppapi/proxy/plugin_resource.cc
index 3a02309..3dd47ba 100644
--- a/ppapi/proxy/plugin_resource.cc
+++ b/ppapi/proxy/plugin_resource.cc
@@ -81,6 +81,20 @@
       new PpapiHostMsg_ResourceCreated(params, pp_instance(), msg));
 }
 
+void PluginResource::AttachToPendingHost(Destination dest,
+                                         int pending_host_id) {
+  // Connecting to a pending host is a replacement for "create".
+  if (dest == RENDERER) {
+    DCHECK(!sent_create_to_renderer_);
+    sent_create_to_renderer_ = true;
+  } else {
+    DCHECK(!sent_create_to_browser_);
+    sent_create_to_browser_ = true;
+  }
+  GetSender(dest)->Send(
+      new PpapiHostMsg_AttachToPendingHost(pp_resource(), pending_host_id));
+}
+
 void PluginResource::Post(Destination dest, const IPC::Message& msg) {
   ResourceMessageCallParams params(pp_resource(), GetNextSequence());
   SendResourceCall(dest, params, msg);
@@ -94,16 +108,17 @@
       new PpapiHostMsg_ResourceCall(call_params, nested_msg));
 }
 
-int32_t PluginResource::GenericSyncCall(Destination dest,
-                                        const IPC::Message& msg,
-                                        IPC::Message* reply) {
+int32_t PluginResource::GenericSyncCall(
+    Destination dest,
+    const IPC::Message& msg,
+    IPC::Message* reply,
+    ResourceMessageReplyParams* reply_params) {
   ResourceMessageCallParams params(pp_resource(), GetNextSequence());
   params.set_has_callback();
-  ResourceMessageReplyParams reply_params;
   bool success = GetSender(dest)->Send(new PpapiHostMsg_ResourceSyncCall(
-      params, msg, &reply_params, reply));
+      params, msg, reply_params, reply));
   if (success)
-    return reply_params.result();
+    return reply_params->result();
   return PP_ERROR_FAILED;
 }
 
diff --git a/ppapi/proxy/plugin_resource.h b/ppapi/proxy/plugin_resource.h
index 33d1996..2e2e10f 100644
--- a/ppapi/proxy/plugin_resource.h
+++ b/ppapi/proxy/plugin_resource.h
@@ -26,6 +26,11 @@
 
 class PPAPI_PROXY_EXPORT PluginResource : public Resource {
  public:
+  enum Destination {
+    RENDERER = 0,
+    BROWSER = 1
+  };
+
   PluginResource(Connection connection, PP_Instance instance);
   virtual ~PluginResource();
 
@@ -48,20 +53,17 @@
   virtual void NotifyLastPluginRefWasDeleted() OVERRIDE;
   virtual void NotifyInstanceWasDeleted() OVERRIDE;
 
- protected:
-  enum Destination {
-    RENDERER = 0,
-    BROWSER = 1
-  };
-
-  IPC::Sender* GetSender(Destination dest) {
-    return dest == RENDERER ? connection_.renderer_sender :
-                              connection_.browser_sender;
-  }
 
   // Sends a create message to the browser or renderer for the current resource.
   void SendCreate(Destination dest, const IPC::Message& msg);
 
+  // When the host returnes a resource to the plugin, it will create a pending
+  // ResourceHost and send an ID back to the plugin that identifies the pending
+  // object. The plugin uses this function to connect the plugin resource with
+  // the pending host resource. See also PpapiHostMsg_AttachToPendingHost. This
+  // is in lieu of sending a create message.
+  void AttachToPendingHost(Destination dest, int pending_host_id);
+
   // Sends the given IPC message as a resource request to the host
   // corresponding to this resource object and does not expect a reply.
   void Post(Destination dest, const IPC::Message& msg);
@@ -124,17 +126,23 @@
   int32_t SyncCall(
       Destination dest, const IPC::Message& msg, A* a, B* b, C* c, D* d, E* e);
 
+  int32_t GenericSyncCall(Destination dest,
+                          const IPC::Message& msg,
+                          IPC::Message* reply_msg,
+                          ResourceMessageReplyParams* reply_params);
+
  private:
+  IPC::Sender* GetSender(Destination dest) {
+    return dest == RENDERER ? connection_.renderer_sender :
+                              connection_.browser_sender;
+  }
+
   // Helper function to send a |PpapiHostMsg_ResourceCall| to the given
   // destination with |nested_msg| and |call_params|.
   bool SendResourceCall(Destination dest,
                         const ResourceMessageCallParams& call_params,
                         const IPC::Message& nested_msg);
 
-  int32_t GenericSyncCall(Destination dest,
-                          const IPC::Message& msg,
-                          IPC::Message* reply_msg);
-
   int32_t GetNextSequence();
 
   Connection connection_;
@@ -170,14 +178,16 @@
 template <class ReplyMsgClass>
 int32_t PluginResource::SyncCall(Destination dest, const IPC::Message& msg) {
   IPC::Message reply;
-  return GenericSyncCall(dest, msg, &reply);
+  ResourceMessageReplyParams reply_params;
+  return GenericSyncCall(dest, msg, &reply, &reply_params);
 }
 
 template <class ReplyMsgClass, class A>
 int32_t PluginResource::SyncCall(
     Destination dest, const IPC::Message& msg, A* a) {
   IPC::Message reply;
-  int32_t result = GenericSyncCall(dest, msg, &reply);
+  ResourceMessageReplyParams reply_params;
+  int32_t result = GenericSyncCall(dest, msg, &reply, &reply_params);
 
   if (UnpackMessage<ReplyMsgClass>(reply, a))
     return result;
@@ -188,7 +198,8 @@
 int32_t PluginResource::SyncCall(
     Destination dest, const IPC::Message& msg, A* a, B* b) {
   IPC::Message reply;
-  int32_t result = GenericSyncCall(dest, msg, &reply);
+  ResourceMessageReplyParams reply_params;
+  int32_t result = GenericSyncCall(dest, msg, &reply, &reply_params);
 
   if (UnpackMessage<ReplyMsgClass>(reply, a, b))
     return result;
@@ -199,7 +210,8 @@
 int32_t PluginResource::SyncCall(
     Destination dest, const IPC::Message& msg, A* a, B* b, C* c) {
   IPC::Message reply;
-  int32_t result = GenericSyncCall(dest, msg, &reply);
+  ResourceMessageReplyParams reply_params;
+  int32_t result = GenericSyncCall(dest, msg, &reply, &reply_params);
 
   if (UnpackMessage<ReplyMsgClass>(reply, a, b, c))
     return result;
@@ -210,7 +222,8 @@
 int32_t PluginResource::SyncCall(
     Destination dest, const IPC::Message& msg, A* a, B* b, C* c, D* d) {
   IPC::Message reply;
-  int32_t result = GenericSyncCall(dest, msg, &reply);
+  ResourceMessageReplyParams reply_params;
+  int32_t result = GenericSyncCall(dest, msg, &reply, &reply_params);
 
   if (UnpackMessage<ReplyMsgClass>(reply, a, b, c, d))
     return result;
@@ -221,7 +234,8 @@
 int32_t PluginResource::SyncCall(
     Destination dest, const IPC::Message& msg, A* a, B* b, C* c, D* d, E* e) {
   IPC::Message reply;
-  int32_t result = GenericSyncCall(dest, msg, &reply);
+  ResourceMessageReplyParams reply_params;
+  int32_t result = GenericSyncCall(dest, msg, &reply, &reply_params);
 
   if (UnpackMessage<ReplyMsgClass>(reply, a, b, c, d, e))
     return result;
diff --git a/ppapi/proxy/plugin_resource_tracker.cc b/ppapi/proxy/plugin_resource_tracker.cc
index ac28de3..fb81857 100644
--- a/ppapi/proxy/plugin_resource_tracker.cc
+++ b/ppapi/proxy/plugin_resource_tracker.cc
@@ -32,6 +32,11 @@
 }
 
 PP_Resource PluginResourceTracker::AddResource(Resource* object) {
+  // If there's a HostResource, it must not be added twice.
+  DCHECK(!object->host_resource().host_resource() ||
+         (host_resource_map_.find(object->host_resource()) ==
+          host_resource_map_.end()));
+
   PP_Resource ret = ResourceTracker::AddResource(object);
 
   // Some resources are plugin-only, so they don't have a host resource.
diff --git a/ppapi/proxy/plugin_var_tracker.cc b/ppapi/proxy/plugin_var_tracker.cc
index 384eb3ec..cff8fa1 100644
--- a/ppapi/proxy/plugin_var_tracker.cc
+++ b/ppapi/proxy/plugin_var_tracker.cc
@@ -194,6 +194,12 @@
   return new PluginArrayBufferVar(size_in_bytes);
 }
 
+ArrayBufferVar* PluginVarTracker::CreateShmArrayBuffer(
+    uint32 size_in_bytes,
+    base::SharedMemoryHandle handle) {
+  return new PluginArrayBufferVar(size_in_bytes, handle);
+}
+
 void PluginVarTracker::PluginImplementedObjectCreated(
     PP_Instance instance,
     const PP_Var& created_var,
@@ -369,5 +375,21 @@
   return scoped_refptr<ProxyObjectVar>(ret->second.var->AsProxyObjectVar());
 }
 
+int PluginVarTracker::TrackSharedMemoryHandle(PP_Instance instance,
+                                              base::SharedMemoryHandle handle,
+                                              uint32 size_in_bytes) {
+  NOTREACHED();
+  return -1;
+}
+
+bool PluginVarTracker::StopTrackingSharedMemoryHandle(
+    int id,
+    PP_Instance instance,
+    base::SharedMemoryHandle* handle,
+    uint32* size_in_bytes) {
+  NOTREACHED();
+  return false;
+}
+
 }  // namesace proxy
 }  // namespace ppapi
diff --git a/ppapi/proxy/plugin_var_tracker.h b/ppapi/proxy/plugin_var_tracker.h
index 3e287be..a8b2293 100644
--- a/ppapi/proxy/plugin_var_tracker.h
+++ b/ppapi/proxy/plugin_var_tracker.h
@@ -11,6 +11,7 @@
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
 #include "base/memory/ref_counted.h"
+#include "base/shared_memory.h"
 #include "ppapi/c/pp_stdint.h"
 #include "ppapi/c/pp_var.h"
 #include "ppapi/proxy/ppapi_proxy_export.h"
@@ -59,6 +60,13 @@
 
   // VarTracker public overrides.
   void DidDeleteInstance(PP_Instance instance) OVERRIDE;
+  virtual int TrackSharedMemoryHandle(PP_Instance instance,
+                                      base::SharedMemoryHandle file,
+                                      uint32 size_in_bytes) OVERRIDE;
+  virtual bool StopTrackingSharedMemoryHandle(int id,
+                                              PP_Instance instance,
+                                              base::SharedMemoryHandle* handle,
+                                              uint32* size_in_bytes) OVERRIDE;
 
   // Notification that a plugin-implemented object (PPP_Class) was created by
   // the plugin or deallocated by WebKit over IPC.
@@ -86,6 +94,9 @@
   virtual void ObjectGettingZeroRef(VarMap::iterator iter) OVERRIDE;
   virtual bool DeleteObjectInfoIfNecessary(VarMap::iterator iter) OVERRIDE;
   virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) OVERRIDE;
+  virtual ArrayBufferVar* CreateShmArrayBuffer(
+      uint32 size_in_bytes,
+      base::SharedMemoryHandle handle) OVERRIDE;
 
  private:
   friend struct DefaultSingletonTraits<PluginVarTracker>;
diff --git a/ppapi/proxy/plugin_var_tracker_unittest.cc b/ppapi/proxy/plugin_var_tracker_unittest.cc
index 10a7c50..83ce6be 100644
--- a/ppapi/proxy/plugin_var_tracker_unittest.cc
+++ b/ppapi/proxy/plugin_var_tracker_unittest.cc
@@ -8,6 +8,7 @@
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/proxy/ppapi_proxy_test.h"
 #include "ppapi/proxy/proxy_object_var.h"
+#include "ppapi/shared_impl/proxy_lock.h"
 
 namespace ppapi {
 namespace proxy {
@@ -62,6 +63,7 @@
 };
 
 TEST_F(PluginVarTrackerTest, GetHostObject) {
+  ProxyAutoLock lock;
   PP_Var host_object = MakeObject(12345);
 
   // Round-trip through the tracker to make sure the host object comes out the
@@ -76,6 +78,7 @@
 }
 
 TEST_F(PluginVarTrackerTest, ReceiveObjectPassRef) {
+  ProxyAutoLock lock;
   PP_Var host_object = MakeObject(12345);
 
   // Receive the object, we should have one ref and no messages.
@@ -111,6 +114,7 @@
 
 // Tests freeing objects that have both refcounts and "tracked with no ref".
 TEST_F(PluginVarTrackerTest, FreeTrackedAndReferencedObject) {
+  ProxyAutoLock lock;
   PP_Var host_object = MakeObject(12345);
 
   // Phase one: First receive via a "pass ref", then a tracked with no ref.
@@ -158,6 +162,7 @@
 }
 
 TEST_F(PluginVarTrackerTest, RecursiveTrackWithNoRef) {
+  ProxyAutoLock lock;
   PP_Var host_object = MakeObject(12345);
 
   // Receive a tracked object twice.
@@ -184,6 +189,7 @@
 // Tests that objects implemented by the plugin that have no references by
 // the plugin get their Deallocate function called on destruction.
 TEST_F(PluginVarTrackerTest, PluginObjectInstanceDeleted) {
+  ProxyAutoLock lock;
   PP_Var host_object = MakeObject(12345);
   PP_Instance pp_instance = 0x12345;
 
@@ -214,6 +220,7 @@
 // object var longer than the instance. We should not call the destructor until
 // the plugin releases its last ref.
 TEST_F(PluginVarTrackerTest, PluginObjectLeaked) {
+  ProxyAutoLock lock;
   PP_Var host_object = MakeObject(12345);
   PP_Instance pp_instance = 0x12345;
 
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.cc b/ppapi/proxy/ppapi_command_buffer_proxy.cc
index ad80a27..98c2353 100644
--- a/ppapi/proxy/ppapi_command_buffer_proxy.cc
+++ b/ppapi/proxy/ppapi_command_buffer_proxy.cc
@@ -84,6 +84,12 @@
   return last_state_;
 }
 
+int32 PpapiCommandBufferProxy::GetLastToken() {
+  // Note: The locking command buffer wrapper does not take a global lock before
+  // calling this function.
+  return last_state_.token;
+}
+
 void PpapiCommandBufferProxy::Flush(int32 put_offset) {
   if (last_state_.error != gpu::error::kNoError)
     return;
@@ -129,26 +135,22 @@
   NOTREACHED();
 }
 
-int32 PpapiCommandBufferProxy::CreateTransferBuffer(
-    size_t size,
-    int32 id_request) {
-  if (last_state_.error == gpu::error::kNoError) {
-    int32 id;
-    if (Send(new PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer(
-             ppapi::API_ID_PPB_GRAPHICS_3D, resource_, size, &id))) {
-      return id;
-    }
-  }
-  return -1;
-}
+gpu::Buffer PpapiCommandBufferProxy::CreateTransferBuffer(size_t size,
+                                                          int32* id) {
+  *id = -1;
 
-int32 PpapiCommandBufferProxy::RegisterTransferBuffer(
-    base::SharedMemory* shared_memory,
-    size_t size,
-    int32 id_request) {
-  // Not implemented in proxy.
-  NOTREACHED();
-  return -1;
+  if (last_state_.error != gpu::error::kNoError)
+    return gpu::Buffer();
+
+  if (!Send(new PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer(
+            ppapi::API_ID_PPB_GRAPHICS_3D, resource_, size, id))) {
+    return gpu::Buffer();
+  }
+
+  if ((*id) <= 0)
+    return gpu::Buffer();
+
+  return GetTransferBuffer(*id);
 }
 
 void PpapiCommandBufferProxy::DestroyTransferBuffer(int32 id) {
@@ -224,6 +226,15 @@
   NOTREACHED();
 }
 
+uint32 PpapiCommandBufferProxy::InsertSyncPoint() {
+  uint32 sync_point = 0;
+  if (last_state_.error == gpu::error::kNoError) {
+    Send(new PpapiHostMsg_PPBGraphics3D_InsertSyncPoint(
+         ppapi::API_ID_PPB_GRAPHICS_3D, resource_, &sync_point));
+  }
+  return sync_point;
+}
+
 bool PpapiCommandBufferProxy::Send(IPC::Message* msg) {
   DCHECK(last_state_.error == gpu::error::kNoError);
 
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.h b/ppapi/proxy/ppapi_command_buffer_proxy.h
index 716d3f3..eef8d12 100644
--- a/ppapi/proxy/ppapi_command_buffer_proxy.h
+++ b/ppapi/proxy/ppapi_command_buffer_proxy.h
@@ -40,19 +40,18 @@
   virtual bool Initialize();
   virtual State GetState();
   virtual State GetLastState();
+  virtual int32 GetLastToken();
   virtual void Flush(int32 put_offset);
   virtual State FlushSync(int32 put_offset, int32 last_known_get);
   virtual void SetGetBuffer(int32 transfer_buffer_id);
   virtual void SetGetOffset(int32 get_offset);
-  virtual int32 CreateTransferBuffer(size_t size, int32 id_request);
-  virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory,
-                                       size_t size,
-                                       int32 id_request);
+  virtual gpu::Buffer CreateTransferBuffer(size_t size, int32* id);
   virtual void DestroyTransferBuffer(int32 id);
-  virtual gpu::Buffer GetTransferBuffer(int32 handle);
+  virtual gpu::Buffer GetTransferBuffer(int32 id);
   virtual void SetToken(int32 token);
   virtual void SetParseError(gpu::error::Error error);
   virtual void SetContextLostReason(gpu::error::ContextLostReason reason);
+  virtual uint32 InsertSyncPoint();
 
  private:
   bool Send(IPC::Message* msg);
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index ca95e8c..6ae94ab 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -7,7 +7,7 @@
 #include <vector>
 
 #include "base/basictypes.h"
-#include "base/file_path.h"
+#include "base/files/file_path.h"
 #include "base/process.h"
 #include "base/shared_memory.h"
 #include "base/string16.h"
@@ -20,7 +20,9 @@
 #include "ipc/ipc_platform_file.h"
 #include "ppapi/c/dev/pp_video_capture_dev.h"
 #include "ppapi/c/dev/pp_video_dev.h"
+#include "ppapi/c/dev/ppb_directory_reader_dev.h"
 #include "ppapi/c/dev/ppb_text_input_dev.h"
+#include "ppapi/c/dev/ppb_truetype_font_dev.h"
 #include "ppapi/c/dev/ppb_url_util_dev.h"
 #include "ppapi/c/dev/ppp_printing_dev.h"
 #include "ppapi/c/pp_bool.h"
@@ -41,21 +43,25 @@
 #include "ppapi/c/private/ppb_tcp_socket_private.h"
 #include "ppapi/c/private/ppb_udp_socket_private.h"
 #include "ppapi/c/private/ppp_flash_browser_operations.h"
+#include "ppapi/proxy/host_resolver_private_resource.h"
 #include "ppapi/proxy/ppapi_param_traits.h"
 #include "ppapi/proxy/ppapi_proxy_export.h"
 #include "ppapi/proxy/resource_message_params.h"
 #include "ppapi/proxy/serialized_flash_menu.h"
+#include "ppapi/proxy/serialized_handle.h"
 #include "ppapi/proxy/serialized_structs.h"
 #include "ppapi/proxy/serialized_var.h"
+#include "ppapi/shared_impl/dir_contents.h"
+#include "ppapi/shared_impl/file_path.h"
 #include "ppapi/shared_impl/ppapi_preferences.h"
 #include "ppapi/shared_impl/ppb_device_ref_shared.h"
 #include "ppapi/shared_impl/ppb_input_event_shared.h"
 #include "ppapi/shared_impl/ppb_network_list_private_shared.h"
 #include "ppapi/shared_impl/ppb_view_shared.h"
 #include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h"
-#include "ppapi/shared_impl/private/ppb_host_resolver_shared.h"
 #include "ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h"
 #include "ppapi/shared_impl/url_request_info_data.h"
+#include "ppapi/shared_impl/url_response_info_data.h"
 
 #undef IPC_MESSAGE_EXPORT
 #define IPC_MESSAGE_EXPORT PPAPI_PROXY_EXPORT
@@ -65,6 +71,7 @@
 IPC_ENUM_TRAITS(PP_AudioSampleRate)
 IPC_ENUM_TRAITS(PP_DeviceType_Dev)
 IPC_ENUM_TRAITS(PP_DecryptorStreamType)
+IPC_ENUM_TRAITS(PP_FileType)
 IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_Permission)
 IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_SettingType)
 IPC_ENUM_TRAITS(PP_FlashSetting)
@@ -78,6 +85,11 @@
 IPC_ENUM_TRAITS(PP_PrintScalingOption_Dev)
 IPC_ENUM_TRAITS(PP_PrivateFontCharset)
 IPC_ENUM_TRAITS(PP_TextInput_Type)
+IPC_ENUM_TRAITS(PP_TrueTypeFontFamily_Dev)
+IPC_ENUM_TRAITS(PP_TrueTypeFontStyle_Dev)
+IPC_ENUM_TRAITS(PP_TrueTypeFontWeight_Dev)
+IPC_ENUM_TRAITS(PP_TrueTypeFontWidth_Dev)
+IPC_ENUM_TRAITS(PP_TrueTypeFontCharset_Dev)
 IPC_ENUM_TRAITS(PP_VideoDecodeError_Dev)
 IPC_ENUM_TRAITS(PP_VideoDecoder_Profile)
 
@@ -161,6 +173,11 @@
   IPC_STRUCT_TRAITS_MEMBER(id)
 IPC_STRUCT_TRAITS_END()
 
+IPC_STRUCT_TRAITS_BEGIN(ppapi::DirEntry)
+  IPC_STRUCT_TRAITS_MEMBER(name)
+  IPC_STRUCT_TRAITS_MEMBER(is_dir)
+IPC_STRUCT_TRAITS_END()
+
 IPC_STRUCT_TRAITS_BEGIN(ppapi::FlashSiteSetting)
   IPC_STRUCT_TRAITS_MEMBER(site)
   IPC_STRUCT_TRAITS_MEMBER(permission)
@@ -193,6 +210,7 @@
   IPC_STRUCT_TRAITS_MEMBER(number_of_cpu_cores)
   IPC_STRUCT_TRAITS_MEMBER(is_3d_supported)
   IPC_STRUCT_TRAITS_MEMBER(is_stage3d_supported)
+  IPC_STRUCT_TRAITS_MEMBER(is_stage3d_baseline_supported)
 IPC_STRUCT_TRAITS_END()
 
 IPC_STRUCT_TRAITS_BEGIN(ppapi::InputEventData)
@@ -255,6 +273,15 @@
   IPC_STRUCT_TRAITS_MEMBER(expected_last_modified_time)
 IPC_STRUCT_TRAITS_END()
 
+IPC_STRUCT_TRAITS_BEGIN(ppapi::URLResponseInfoData)
+  IPC_STRUCT_TRAITS_MEMBER(url)
+  IPC_STRUCT_TRAITS_MEMBER(headers)
+  IPC_STRUCT_TRAITS_MEMBER(status_code)
+  IPC_STRUCT_TRAITS_MEMBER(status_text)
+  IPC_STRUCT_TRAITS_MEMBER(redirect_url)
+  IPC_STRUCT_TRAITS_MEMBER(body_as_file_ref)
+IPC_STRUCT_TRAITS_END()
+
 IPC_STRUCT_TRAITS_BEGIN(ppapi::NetworkInfo)
   IPC_STRUCT_TRAITS_MEMBER(name)
   IPC_STRUCT_TRAITS_MEMBER(type)
@@ -265,14 +292,7 @@
 IPC_STRUCT_TRAITS_END()
 
 #if !defined(OS_NACL) && !defined(NACL_WIN64)
-IPC_STRUCT_TRAITS_BEGIN(ppapi::proxy::PPPVideoCapture_Buffer)
-  IPC_STRUCT_TRAITS_MEMBER(resource)
-  IPC_STRUCT_TRAITS_MEMBER(handle)
-  IPC_STRUCT_TRAITS_MEMBER(size)
-IPC_STRUCT_TRAITS_END()
 
-// TODO(tomfinegan): This is identical to PPPVideoCapture_Buffer, maybe replace
-// both with a single type?
 IPC_STRUCT_TRAITS_BEGIN(ppapi::proxy::PPPDecryptor_Buffer)
   IPC_STRUCT_TRAITS_MEMBER(resource)
   IPC_STRUCT_TRAITS_MEMBER(handle)
@@ -284,13 +304,14 @@
 // These are from the browser to the plugin.
 // Loads the given plugin.
 IPC_MESSAGE_CONTROL2(PpapiMsg_LoadPlugin,
-                     FilePath /* path */,
+                     base::FilePath /* path */,
                      ppapi::PpapiPermissions /* permissions */)
 
 // Creates a channel to talk to a renderer. The plugin will respond with
 // PpapiHostMsg_ChannelCreated.
-IPC_MESSAGE_CONTROL2(PpapiMsg_CreateChannel,
-                     int /* renderer_id */,
+IPC_MESSAGE_CONTROL3(PpapiMsg_CreateChannel,
+                     base::ProcessId /* renderer_pid */,
+                     int /* renderer_child_id */,
                      bool /* incognito */)
 
 // Creates a channel to talk to a renderer. This message is only used by the
@@ -302,6 +323,12 @@
                      bool /* incognito */,
                      ppapi::proxy::SerializedHandle /* channel_handle */)
 
+// Instructs the plugin process to crash.
+IPC_MESSAGE_CONTROL0(PpapiMsg_Crash)
+
+// Instructs the plugin process to hang.
+IPC_MESSAGE_CONTROL0(PpapiMsg_Hang)
+
 // Each plugin may be referenced by multiple renderers. We need the instance
 // IDs to be unique within a plugin, despite coming from different renderers,
 // and unique within a renderer, despite going to different plugins. This means
@@ -341,7 +368,7 @@
 // for Flash.
 IPC_MESSAGE_CONTROL2(PpapiMsg_GetSitesWithData,
                      uint32 /* request_id */,
-                     FilePath /* plugin_data_path */)
+                     base::FilePath /* plugin_data_path */)
 IPC_MESSAGE_CONTROL2(PpapiHostMsg_GetSitesWithDataResult,
                      uint32 /* request_id */,
                      std::vector<std::string> /* sites */)
@@ -351,7 +378,7 @@
 // for Flash.
 IPC_MESSAGE_CONTROL5(PpapiMsg_ClearSiteData,
                      uint32 /* request_id */,
-                     FilePath /* plugin_data_path */,
+                     base::FilePath /* plugin_data_path */,
                      std::string /* site */,
                      uint64 /* flags */,
                      uint64 /* max_age */)
@@ -361,14 +388,14 @@
 
 IPC_MESSAGE_CONTROL2(PpapiMsg_DeauthorizeContentLicenses,
                      uint32 /* request_id */,
-                     FilePath /* plugin_data_path */)
+                     base::FilePath /* plugin_data_path */)
 IPC_MESSAGE_CONTROL2(PpapiHostMsg_DeauthorizeContentLicensesResult,
                      uint32 /* request_id */,
                      bool /* success */)
 
 IPC_MESSAGE_CONTROL3(PpapiMsg_GetPermissionSettings,
                      uint32 /* request_id */,
-                     FilePath /* plugin_data_path */,
+                     base::FilePath /* plugin_data_path */,
                      PP_Flash_BrowserOperations_SettingType /* setting_type */)
 IPC_MESSAGE_CONTROL4(
     PpapiHostMsg_GetPermissionSettingsResult,
@@ -379,7 +406,7 @@
 
 IPC_MESSAGE_CONTROL5(PpapiMsg_SetDefaultPermission,
                      uint32 /* request_id */,
-                     FilePath /* plugin_data_path */,
+                     base::FilePath /* plugin_data_path */,
                      PP_Flash_BrowserOperations_SettingType /* setting_type */,
                      PP_Flash_BrowserOperations_Permission /* permission */,
                      bool /* clear_site_specific */)
@@ -389,7 +416,7 @@
 
 IPC_MESSAGE_CONTROL4(PpapiMsg_SetSitePermission,
                      uint32 /* request_id */,
-                     FilePath /* plugin_data_path */,
+                     base::FilePath /* plugin_data_path */,
                      PP_Flash_BrowserOperations_SettingType /* setting_type */,
                      ppapi::FlashSiteSettings /* sites */)
 IPC_MESSAGE_CONTROL2(PpapiHostMsg_SetSitePermissionResult,
@@ -418,22 +445,6 @@
                     ppapi::proxy::SerializedHandle /* socket_handle */,
                     ppapi::proxy::SerializedHandle /* handle */)
 
-// PPB_FileIO.
-IPC_MESSAGE_ROUTED2(PpapiMsg_PPBFileIO_GeneralComplete,
-                    ppapi::HostResource /* file_io */,
-                    int32_t /* result */)
-IPC_MESSAGE_ROUTED2(PpapiMsg_PPBFileIO_OpenFileComplete,
-                    ppapi::HostResource /* file_io */,
-                    int32_t /* result */)
-IPC_MESSAGE_ROUTED3(PpapiMsg_PPBFileIO_QueryComplete,
-                    ppapi::HostResource /* file_io */,
-                    int32_t /* result */,
-                    PP_FileInfo /* info */)
-IPC_MESSAGE_ROUTED3(PpapiMsg_PPBFileIO_ReadComplete,
-                    ppapi::HostResource /* file_io */,
-                    int32_t /* result */,
-                    std::string /* data */)
-
 // PPB_FileRef.
 IPC_MESSAGE_ROUTED3(
     PpapiMsg_PPBFileRef_CallbackComplete,
@@ -447,11 +458,6 @@
     ppapi::HostResource /* filesystem */,
     int32_t /* result */)
 
-// PPB_Graphics2D.
-IPC_MESSAGE_ROUTED2(PpapiMsg_PPBGraphics2D_FlushACK,
-                    ppapi::HostResource /* graphics_2d */,
-                    int32_t /* pp_error */)
-
 // PPB_Graphics3D.
 IPC_MESSAGE_ROUTED2(PpapiMsg_PPBGraphics3D_SwapBuffersACK,
                     ppapi::HostResource /* graphics_3d */,
@@ -518,13 +524,6 @@
                     int64 /* ppp_class */,
                     int64 /* object */)
 
-// PPB_Flash_DeviceID.
-IPC_MESSAGE_ROUTED4(PpapiMsg_PPBFlashDeviceID_GetReply,
-                    int32 /* routing_id */,
-                    PP_Resource /* resource */,
-                    int32 /* result */,
-                    std::string /* value */)
-
 // PPP_Graphics3D_Dev.
 IPC_MESSAGE_ROUTED1(PpapiMsg_PPPGraphics3D_ContextLost,
                     PP_Instance /* instance */)
@@ -537,10 +536,6 @@
                            PP_Instance /* instance */,
                            ppapi::InputEventData /* data */,
                            PP_Bool /* result */)
-// (Message from the plugin to the browser that it handled an input event.)
-IPC_MESSAGE_ROUTED2(PpapiMsg_PPPInputEvent_HandleInputEvent_ACK,
-                    PP_Instance /* instance */,
-                    PP_TimeTicks /* timestamp */)
 
 // PPP_Instance.
 IPC_SYNC_MESSAGE_ROUTED3_1(PpapiMsg_PPPInstance_DidCreate,
@@ -661,13 +656,6 @@
                     PP_DecryptorStreamType /* decoder_type */,
                     ppapi::proxy::PPPDecryptor_Buffer /* buffer */,
                     std::string /* serialized_block_info */)
-
-// PPB_Talk
-IPC_MESSAGE_ROUTED3(
-    PpapiMsg_PPBTalk_GetPermissionACK,
-    uint32 /* plugin_dispatcher_id */,
-    PP_Resource /* resource */,
-    int32_t /* result */)
 #endif  // !defined(OS_NACL) && !defined(NACL_WIN64)
 
 // PPB_TCPSocket_Private.
@@ -692,24 +680,10 @@
                     uint32 /* socket_id */,
                     bool /* succeeded */,
                     int32_t /* bytes_written */)
-
-// PPB_UDPSocket_Private.
-IPC_MESSAGE_ROUTED4(PpapiMsg_PPBUDPSocket_BindACK,
+IPC_MESSAGE_ROUTED3(PpapiMsg_PPBTCPSocket_SetBoolOptionACK,
                     uint32 /* plugin_dispatcher_id */,
                     uint32 /* socket_id */,
-                    bool /* succeeded */,
-                    PP_NetAddress_Private /* bound_addr */)
-IPC_MESSAGE_ROUTED5(PpapiMsg_PPBUDPSocket_RecvFromACK,
-                    uint32 /* plugin_dispatcher_id */,
-                    uint32 /* socket_id */,
-                    bool /* succeeded */,
-                    std::string /* data */,
-                    PP_NetAddress_Private /* remote_addr */)
-IPC_MESSAGE_ROUTED4(PpapiMsg_PPBUDPSocket_SendToACK,
-                    uint32 /* plugin_dispatcher_id */,
-                    uint32 /* socket_id */,
-                    bool /* succeeded */,
-                    int32_t /* bytes_written */)
+                    bool /* succeeded */)
 
 // PPB_URLLoader_Trusted
 IPC_MESSAGE_ROUTED1(
@@ -738,45 +712,12 @@
                     PP_NetAddress_Private /* local_addr */,
                     PP_NetAddress_Private /* remote_addr */)
 
-// PPB_HostResolver_Private.
-IPC_MESSAGE_ROUTED5(PpapiMsg_PPBHostResolver_ResolveACK,
-                    uint32 /* plugin_dispatcher_id */,
-                    uint32 /* host_resolver_id */,
-                    bool /* succeeded */,
-                    std::string /* canonical_name */,
-                    std::vector<PP_NetAddress_Private> /* net_address_list */)
-
 #if !defined(OS_NACL) && !defined(NACL_WIN64)
 // PPP_Instance_Private.
 IPC_SYNC_MESSAGE_ROUTED1_1(PpapiMsg_PPPInstancePrivate_GetInstanceObject,
                            PP_Instance /* instance */,
                            ppapi::proxy::SerializedVar /* result */)
 
-// PPB_VideoCapture_Dev
-IPC_MESSAGE_ROUTED3(PpapiMsg_PPBVideoCapture_EnumerateDevicesACK,
-                    ppapi::HostResource /* video_capture */,
-                    int32_t /* result */,
-                    std::vector<ppapi::DeviceRefData> /* devices */)
-IPC_MESSAGE_ROUTED2(PpapiMsg_PPBVideoCapture_OpenACK,
-                    ppapi::HostResource /* video_capture */,
-                    int32_t /* result */)
-
-// PPP_VideoCapture_Dev
-IPC_MESSAGE_ROUTED3(
-    PpapiMsg_PPPVideoCapture_OnDeviceInfo,
-    ppapi::HostResource /* video_capture */,
-    PP_VideoCaptureDeviceInfo_Dev /* info */,
-    std::vector<ppapi::proxy::PPPVideoCapture_Buffer> /* buffers */)
-IPC_MESSAGE_ROUTED2(PpapiMsg_PPPVideoCapture_OnStatus,
-                    ppapi::HostResource /* video_capture */,
-                    uint32_t /* status */)
-IPC_MESSAGE_ROUTED2(PpapiMsg_PPPVideoCapture_OnError,
-                    ppapi::HostResource /* video_capture */,
-                    uint32_t /* error_code */)
-IPC_MESSAGE_ROUTED2(PpapiMsg_PPPVideoCapture_OnBufferReady,
-                    ppapi::HostResource /* video_capture */,
-                    uint32_t /* buffer */)
-
 // PPB_VideoDecoder_Dev.
 // (Messages from renderer to plugin to notify it to run callbacks.)
 IPC_MESSAGE_ROUTED3(PpapiMsg_PPBVideoDecoder_EndOfBitstreamACK,
@@ -840,43 +781,6 @@
 IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBCore_ReleaseResource,
                     ppapi::HostResource)
 
-// PPB_FileIO.
-IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBFileIO_Create,
-                           PP_Instance /* instance */,
-                           ppapi::HostResource /* result */)
-IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBFileIO_Open,
-                    ppapi::HostResource /* host_resource */,
-                    ppapi::HostResource /* file_ref_resource */,
-                    int32_t /* open_flags */)
-IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBFileIO_Close,
-                    ppapi::HostResource /* host_resource */)
-IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBFileIO_Query,
-                    ppapi::HostResource /* host_resource */)
-IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBFileIO_Touch,
-                    ppapi::HostResource /* host_resource */,
-                    PP_Time /* last_access_time */,
-                    PP_Time /* last_modified_time */)
-IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBFileIO_Read,
-                    ppapi::HostResource /* host_resource */,
-                    int64_t /* offset */,
-                    int32_t /* bytes_to_read */)
-IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBFileIO_Write,
-                    ppapi::HostResource /* host_resource */,
-                    int64_t /* offset */,
-                    std::string /* data */)
-IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBFileIO_SetLength,
-                    ppapi::HostResource /* host_resource */,
-                    int64_t /* length */)
-IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBFileIO_Flush,
-                    ppapi::HostResource /* host_resource */)
-IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBFileIO_WillWrite,
-                    ppapi::HostResource /* host_resource */,
-                    int64_t /* offset */,
-                    int32_t /* bytes_to_write */)
-IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBFileIO_WillSetLength,
-                    ppapi::HostResource /* host_resource */,
-                    int64_t /* length */)
-
 // PPB_FileRef.
 IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFileRef_Create,
                            ppapi::HostResource /* file_system */,
@@ -914,32 +818,6 @@
                     ppapi::HostResource /* result */,
                     int64_t /* expected_size */)
 
-// PPB_Graphics2D.
-IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBGraphics2D_Create,
-                           PP_Instance /* instance */,
-                           PP_Size /* size */,
-                           PP_Bool /* is_always_opaque */,
-                           ppapi::HostResource /* result */)
-IPC_MESSAGE_ROUTED5(PpapiHostMsg_PPBGraphics2D_PaintImageData,
-                    ppapi::HostResource /* graphics_2d */,
-                    ppapi::HostResource /* image_data */,
-                    PP_Point /* top_left */,
-                    bool /* src_rect_specified */,
-                    PP_Rect /* src_rect */)
-IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBGraphics2D_Scroll,
-                    ppapi::HostResource /* graphics_2d */,
-                    bool /* clip_specified */,
-                    PP_Rect /* clip */,
-                    PP_Point /* amount */)
-IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBGraphics2D_ReplaceContents,
-                    ppapi::HostResource /* graphics_2d */,
-                    ppapi::HostResource /* image_data */)
-IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBGraphics2D_Flush,
-                    ppapi::HostResource /* graphics_2d */)
-IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBGraphics2D_Dev_SetScale,
-                    ppapi::HostResource /* graphics_2d */,
-                    float /* scale */)
-
 // PPB_Graphics3D.
 IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBGraphics3D_Create,
                            PP_Instance /* instance */,
@@ -966,7 +844,7 @@
                     int32 /* put_offset */)
 IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer,
                            ppapi::HostResource /* context */,
-                           int32 /* size */,
+                           uint32 /* size */,
                            int32 /* id */)
 IPC_SYNC_MESSAGE_ROUTED2_0(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer,
                            ppapi::HostResource /* context */,
@@ -977,6 +855,9 @@
                            ppapi::proxy::SerializedHandle /* transfer_buffer */)
 IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBGraphics3D_SwapBuffers,
                     ppapi::HostResource /* graphics_3d */)
+IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBGraphics3D_InsertSyncPoint,
+                           ppapi::HostResource /* context */,
+                           uint32 /* sync_point */)
 
 // PPB_ImageData.
 IPC_SYNC_MESSAGE_ROUTED4_3(PpapiHostMsg_PPBImageData_Create,
@@ -1003,10 +884,9 @@
 IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBInstance_GetOwnerElementObject,
                            PP_Instance /* instance */,
                            ppapi::proxy::SerializedVar /* result */)
-IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBInstance_BindGraphics,
-                           PP_Instance /* instance */,
-                           ppapi::HostResource /* device */,
-                           PP_Bool /* result */)
+IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBInstance_BindGraphics,
+                    PP_Instance /* instance */,
+                    PP_Resource /* device */)
 IPC_SYNC_MESSAGE_ROUTED1_1(
     PpapiHostMsg_PPBInstance_GetAudioHardwareOutputSampleRate,
                            PP_Instance /* instance */,
@@ -1026,8 +906,6 @@
 IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBInstance_GetDefaultCharSet,
                            PP_Instance /* instance */,
                            ppapi::proxy::SerializedVar /* result */)
-IPC_SYNC_MESSAGE_CONTROL0_1(PpapiHostMsg_PPBInstance_GetFontFamilies,
-                            std::string /* result */)
 IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBInstance_SetFullscreen,
                            PP_Instance /* instance */,
                            PP_Bool /* fullscreen */,
@@ -1098,10 +976,11 @@
                     ppapi::URLRequestInfoData /* request_data */)
 IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBURLLoader_FollowRedirect,
                     ppapi::HostResource /* loader */)
-IPC_SYNC_MESSAGE_ROUTED1_1(
+IPC_SYNC_MESSAGE_ROUTED1_2(
     PpapiHostMsg_PPBURLLoader_GetResponseInfo,
     ppapi::HostResource /* loader */,
-    ppapi::HostResource /* response_info_out */)
+    bool /* success */,
+    ppapi::URLResponseInfoData /* result */)
 IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBURLLoader_ReadResponseBody,
                     ppapi::HostResource /* loader */,
                     int32_t /* bytes_to_read */)
@@ -1112,27 +991,12 @@
 IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBURLLoader_GrantUniversalAccess,
                     ppapi::HostResource /* loader */)
 
-// PPB_URLResponseInfo.
-IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBURLResponseInfo_GetProperty,
-                           ppapi::HostResource /* response */,
-                           int32_t /* property */,
-                           ppapi::proxy::SerializedVar /* result */)
-IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef,
-                           ppapi::HostResource /* response */,
-                           ppapi::PPB_FileRef_CreateInfo /* result */)
-
 // PPB_Var.
 IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBVar_AddRefObject,
                            int64 /* object_id */,
                            int /* unused - need a return value for sync msgs */)
 IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBVar_ReleaseObject,
                     int64 /* object_id */)
-IPC_SYNC_MESSAGE_ROUTED3_2(PpapiHostMsg_PPBVar_ConvertType,
-                           PP_Instance /* instance */,
-                           ppapi::proxy::SerializedVar /* var */,
-                           int /* new_type */,
-                           ppapi::proxy::SerializedVar /* exception */,
-                           ppapi::proxy::SerializedVar /* result */)
 IPC_SYNC_MESSAGE_ROUTED2_2(PpapiHostMsg_PPBVar_HasProperty,
                            ppapi::proxy::SerializedVar /* object */,
                            ppapi::proxy::SerializedVar /* property */,
@@ -1214,7 +1078,7 @@
                     PP_Instance /* instance */,
                     ppapi::proxy::SerializedVar /* key_system, String */,
                     ppapi::proxy::SerializedVar /* session_id, String */,
-                    PP_Resource /* message, PPB_Buffer_Dev */,
+                    ppapi::proxy::SerializedVar /* message, ArrayBuffer */,
                     ppapi::proxy::SerializedVar /* default_url, String */)
 IPC_MESSAGE_ROUTED5(PpapiHostMsg_PPBInstance_KeyError,
                     PP_Instance /* instance */,
@@ -1255,14 +1119,6 @@
 IPC_MESSAGE_CONTROL1(PpapiHostMsg_PPBNetworkMonitor_Stop,
                      uint32 /* plugin_dispatcher_id */)
 
-// PPB_HostResolver_Private.
-IPC_MESSAGE_CONTROL5(PpapiHostMsg_PPBHostResolver_Resolve,
-                     int32 /* routing_id */,
-                     uint32 /* plugin_dispatcher_id */,
-                     uint32 /* host_resolver_id */,
-                     ppapi::HostPortPair /* host_port */,
-                     PP_HostResolver_Private_Hint /* hint */)
-
 #if !defined(OS_NACL) && !defined(NACL_WIN64)
 // PPB_PDF
 IPC_SYNC_MESSAGE_ROUTED3_1(
@@ -1276,13 +1132,6 @@
     ppapi::HostResource /* font_file */,
     uint32_t /* table */,
     std::string /* result */)
-
-
-// PPB_Talk.
-IPC_MESSAGE_ROUTED2(
-    PpapiHostMsg_PPBTalk_GetPermission,
-    uint32 /* plugin_dispatcher_id */,
-    PP_Resource /* resource */)
 #endif  // !defined(OS_NACL) && !defined(NACL_WIN64)
 
 // PPB_Testing.
@@ -1300,30 +1149,6 @@
                     ppapi::InputEventData /* input_event */)
 
 #if !defined(OS_NACL) && !defined(NACL_WIN64)
-// PPB_VideoCapture_Dev.
-IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBVideoCapture_Create,
-                           PP_Instance /* instance */,
-                           ppapi::HostResource /* result */)
-IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBVideoCapture_EnumerateDevices,
-                    ppapi::HostResource /* video_capture */)
-IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBVideoCapture_Open,
-                    ppapi::HostResource /* video_capture */,
-                    std::string /* device_id */,
-                    PP_VideoCaptureDeviceInfo_Dev /* requested_info */,
-                    uint32_t /* buffer_count */)
-IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBVideoCapture_StartCapture,
-                    ppapi::HostResource /* video_capture */)
-IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBVideoCapture_ReuseBuffer,
-                    ppapi::HostResource /* video_capture */,
-                    uint32_t /* buffer */)
-IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBVideoCapture_StopCapture,
-                    ppapi::HostResource /* video_capture */)
-IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBVideoCapture_Close,
-                    ppapi::HostResource /* video_capture */)
-IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBVideoCapture_StartCapture0_1,
-                    ppapi::HostResource /* video_capture */,
-                    PP_VideoCaptureDeviceInfo_Dev /* requested_info */,
-                    uint32_t /* buffer_count */)
 
 // PPB_VideoDecoder.
 IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBVideoDecoder_Create,
@@ -1335,7 +1160,7 @@
                     ppapi::HostResource /* video_decoder */,
                     ppapi::HostResource /* bitstream buffer */,
                     int32 /* bitstream buffer id */,
-                    int32 /* size of buffer */)
+                    uint32 /* size of buffer */)
 IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBVideoDecoder_AssignPictureBuffers,
                     ppapi::HostResource /* video_decoder */,
                     std::vector<PP_PictureBuffer_Dev> /* picture buffers */)
@@ -1349,87 +1174,6 @@
 IPC_SYNC_MESSAGE_ROUTED1_0(PpapiHostMsg_PPBVideoDecoder_Destroy,
                            ppapi::HostResource /* video_decoder */)
 
-// PPB_Flash.
-IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop,
-                    PP_Instance /* instance */,
-                    PP_Bool /* on_top */)
-// This has to be synchronous becuase the caller may want to composite on
-// top of the resulting text after the call is complete.
-IPC_SYNC_MESSAGE_ROUTED2_1(
-    PpapiHostMsg_PPBFlash_DrawGlyphs,
-    PP_Instance /* instance */,
-    ppapi::proxy::PPBFlash_DrawGlyphs_Params /* params */,
-    PP_Bool /* result */)
-IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlash_GetProxyForURL,
-                           PP_Instance /* instance */,
-                           std::string /* url */,
-                           ppapi::proxy::SerializedVar /* result */)
-IPC_SYNC_MESSAGE_ROUTED4_1(PpapiHostMsg_PPBFlash_Navigate,
-                           PP_Instance /* instance */,
-                           ppapi::URLRequestInfoData /* request_data */,
-                           std::string /* target */,
-                           PP_Bool /* from_user_action */,
-                           int32_t /* result */)
-IPC_SYNC_MESSAGE_ROUTED1_0(PpapiHostMsg_PPBFlash_RunMessageLoop,
-                           PP_Instance /* instance */)
-IPC_SYNC_MESSAGE_ROUTED1_0(PpapiHostMsg_PPBFlash_QuitMessageLoop,
-                           PP_Instance /* instance */)
-IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset,
-                           PP_Instance /* instance */,
-                           PP_Time /* t */,
-                           double /* offset */)
-IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlash_IsRectTopmost,
-                           PP_Instance /* instance */,
-                           PP_Rect /* rect */,
-                           PP_Bool /* result */)
-IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlash_FlashSetFullscreen,
-                           PP_Instance /* instance */,
-                           PP_Bool /* fullscreen */,
-                           PP_Bool /* result */)
-IPC_SYNC_MESSAGE_ROUTED1_2(PpapiHostMsg_PPBFlash_FlashGetScreenSize,
-                           PP_Instance /* instance */,
-                           PP_Bool /* result */,
-                           PP_Size /* size */)
-IPC_MESSAGE_ROUTED0(PpapiHostMsg_PPBFlash_UpdateActivity)
-IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBFlash_GetDeviceID,
-                           PP_Instance /* instance */,
-                           ppapi::proxy::SerializedVar /* id */)
-IPC_SYNC_MESSAGE_ROUTED3_2(PpapiHostMsg_PPBFlash_OpenFileRef,
-                           PP_Instance /* instance */,
-                           ppapi::HostResource /* file_ref */,
-                           int32_t /* mode */,
-                           IPC::PlatformFileForTransit /* file_handle */,
-                           int32_t /* result */)
-IPC_SYNC_MESSAGE_ROUTED2_2(PpapiHostMsg_PPBFlash_QueryFileRef,
-                           PP_Instance /* instance */,
-                           ppapi::HostResource /* file_ref */,
-                           PP_FileInfo /* info */,
-                           int32_t /* result */)
-IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlash_GetSetting,
-                           PP_Instance /* instance */,
-                           PP_FlashSetting /* setting */,
-                           ppapi::proxy::SerializedVar /* result */)
-IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBFlash_InvokePrinting,
-                    PP_Instance /* instance */)
-
-// PPB_Flash_DeviceID.
-IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBFlashDeviceID_Get,
-                    int32 /* routing_id */,
-                    PP_Resource /* resource */)
-
-// PPB_Flash_Menu
-IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlashMenu_Create,
-                           PP_Instance /* instance */,
-                           ppapi::proxy::SerializedFlashMenu /* menu_data */,
-                           ppapi::HostResource /* result */)
-IPC_SYNC_MESSAGE_ROUTED2_0(PpapiHostMsg_PPBFlashMenu_Show,
-                           ppapi::HostResource /* menu */,
-                           PP_Point /* location */)
-IPC_MESSAGE_ROUTED3(PpapiMsg_PPBFlashMenu_ShowACK,
-                    ppapi::HostResource /* menu */,
-                    int32_t /* selected_id */,
-                    int32_t /* result */)
-
 // PPB_Flash_MessageLoop.
 IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBFlashMessageLoop_Create,
                            PP_Instance /* instance */,
@@ -1469,31 +1213,31 @@
                      std::string /* data */)
 IPC_MESSAGE_CONTROL1(PpapiHostMsg_PPBTCPSocket_Disconnect,
                      uint32 /* socket_id */)
-
-// PPB_UDPSocket_Private.
-IPC_SYNC_MESSAGE_CONTROL2_1(PpapiHostMsg_PPBUDPSocket_Create,
-                            int32 /* routing_id */,
-                            uint32 /* plugin_dispatcher_id */,
-                            uint32 /* socket_id */)
-IPC_MESSAGE_CONTROL4(PpapiHostMsg_PPBUDPSocket_SetBoolSocketFeature,
-                     int32 /* routing_id */,
+IPC_MESSAGE_CONTROL3(PpapiHostMsg_PPBTCPSocket_SetBoolOption,
                      uint32 /* socket_id */,
+                     uint32 /* name */,
+                     bool /* value */)
+
+// UDPSocketPrivate.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_UDPSocketPrivate_Create)
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_UDPSocketPrivate_SetBoolSocketFeature,
                      int32_t /* name */,
                      bool /* value */)
-IPC_MESSAGE_CONTROL3(PpapiHostMsg_PPBUDPSocket_Bind,
-                     int32 /* routing_id */,
-                     uint32 /* socket_id */,
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_UDPSocketPrivate_Bind,
                      PP_NetAddress_Private /* net_addr */)
-IPC_MESSAGE_CONTROL2(PpapiHostMsg_PPBUDPSocket_RecvFrom,
-                     uint32 /* socket_id */,
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_UDPSocketPrivate_RecvFrom,
                      int32_t /* num_bytes */)
-IPC_MESSAGE_CONTROL4(PpapiHostMsg_PPBUDPSocket_SendTo,
-                     int32 /* routing_id */,
-                     uint32 /* socket_id */,
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_UDPSocketPrivate_SendTo,
                      std::string /* data */,
                      PP_NetAddress_Private /* net_addr */)
-IPC_MESSAGE_CONTROL1(PpapiHostMsg_PPBUDPSocket_Close,
-                     uint32 /* socket_id */)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_UDPSocketPrivate_Close)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_UDPSocketPrivate_BindReply,
+                     PP_NetAddress_Private /* bound_addr */)
+IPC_MESSAGE_CONTROL2(PpapiPluginMsg_UDPSocketPrivate_RecvFromReply,
+                     std::string /* data */,
+                     PP_NetAddress_Private /* remote_addr */)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_UDPSocketPrivate_SendToReply,
+                     int32_t /* bytes_written */)
 
 // PPB_TCPServerSocket_Private.
 IPC_MESSAGE_CONTROL5(PpapiHostMsg_PPBTCPServerSocket_Listen,
@@ -1514,13 +1258,6 @@
                             bool /* succeeded */,
                             ppapi::PPB_X509Certificate_Fields /* result */)
 
-#if !defined(OS_NACL) && !defined(NACL_WIN64)
-// PPB_Font.
-IPC_SYNC_MESSAGE_CONTROL0_1(PpapiHostMsg_PPBFont_GetFontFamilies,
-                            std::string /* result */)
-
-#endif  // !defined(OS_NACL) && !defined(NACL_WIN64)
-
 //-----------------------------------------------------------------------------
 // Resource call/reply messages.
 //
@@ -1542,6 +1279,20 @@
 IPC_MESSAGE_CONTROL1(PpapiHostMsg_ResourceDestroyed,
                      PP_Resource /* resource */)
 
+// Most resources are created by the plugin, which then sends a ResourceCreated
+// message to create a corresponding ResourceHost in the renderer or browser
+// host process. However, some resources are first created in the host and
+// "pushed" or returned to the plugin.
+//
+// In this case, the host will create a "pending" ResourceHost object which
+// is identified by an ID. The ID is sent to the plugin process and the
+// PluginResource object is created. This message is sent from the plugin to
+// the host process to connect the PluginResource and the pending ResourceHost
+// (at which point, it's no longer pending).
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_AttachToPendingHost,
+                     PP_Resource /* resource */,
+                     int /* pending_host_id */)
+
 // A resource call is a request from the plugin to the host. It may or may not
 // require a reply, depending on the params. The nested message will be
 // resource-type-specific.
@@ -1566,6 +1317,22 @@
 //-----------------------------------------------------------------------------
 // Messages for resources using call/reply above.
 
+// Broker ----------------------------------------------------------------------
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_Broker_Create)
+
+// Queries whether the plugin has permission to connect to the Pepper broker.
+// The response is contained in the error value of the
+// ResourceMessageReplyParams in the reply message.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_Broker_IsAllowed)
+
+// Directory reader.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_DirectoryReader_Create)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_DirectoryReader_GetEntries,
+                     ppapi::HostResource /* file_ref_resource */)
+IPC_MESSAGE_CONTROL2(PpapiPluginMsg_DirectoryReader_GetEntriesReply,
+                     std::vector<ppapi::PPB_FileRef_CreateInfo> /* files */,
+                     std::vector<PP_FileType> /* file_types */)
+
 // File chooser.
 IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileChooser_Create)
 IPC_MESSAGE_CONTROL4(PpapiHostMsg_FileChooser_Show,
@@ -1576,6 +1343,38 @@
 IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FileChooser_ShowReply,
                      std::vector<ppapi::PPB_FileRef_CreateInfo> /* files */)
 
+// FileIO
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileIO_Create)
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_FileIO_Open,
+                     PP_Resource /* file_ref_resource */,
+                     int32_t /* open_flags */)
+IPC_MESSAGE_CONTROL0(PpapiPluginMsg_FileIO_OpenReply)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileIO_Close)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileIO_Query)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FileIO_QueryReply, PP_FileInfo /* info */)
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_FileIO_Touch,
+                     PP_Time /* last_access_time */,
+                     PP_Time /* last_modified_time */)
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_FileIO_Read,
+                     int64_t /* offset */,
+                     int32_t /* bytes_to_read */)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FileIO_ReadReply, std::string /* data */)
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_FileIO_Write,
+                     int64_t /* offset */,
+                     std::string /* data */)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileIO_SetLength,
+                     int64_t /* length */)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileIO_Flush)
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_FileIO_WillWrite,
+                     int64_t /* offset */,
+                     int32_t /* bytes_to_write */)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileIO_WillSetLength,
+                     int64_t /* length */)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileIO_GetOSFileDescriptor)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FileIO_GetOSFileDescriptorReply,
+                     int32_t /* file descriptor */)
+IPC_MESSAGE_CONTROL0(PpapiPluginMsg_FileIO_GeneralReply)
+
 // Flash device ID.
 IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashDeviceID_Create)
 IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashDeviceID_GetDeviceID)
@@ -1593,12 +1392,80 @@
 // actual handle is passed in the ReplyParams struct.
 IPC_MESSAGE_CONTROL0(PpapiPluginMsg_Gamepad_SendMemory)
 
+
+// Graphics2D, plugin -> host
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_Graphics2D_Create,
+                     PP_Size /* size */,
+                     PP_Bool /* is_always_opaque */)
+IPC_MESSAGE_CONTROL4(PpapiHostMsg_Graphics2D_PaintImageData,
+                     ppapi::HostResource /* image_data */,
+                     PP_Point /* top_left */,
+                     bool /* src_rect_specified */,
+                     PP_Rect /* src_rect */)
+IPC_MESSAGE_CONTROL3(PpapiHostMsg_Graphics2D_Scroll,
+                     bool /* clip_specified */,
+                     PP_Rect /* clip */,
+                     PP_Point /* amount */)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_ReplaceContents,
+                     ppapi::HostResource /* image_data */)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_Dev_SetScale,
+                     float /* scale */)
+
+// Graphics2D, plugin -> host -> plugin
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_Graphics2D_Flush)
+IPC_MESSAGE_CONTROL0(PpapiPluginMsg_Graphics2D_FlushAck)
+
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_Graphics2D_ReadImageData,
+                     PP_Resource /* image */,
+                     PP_Point /* top_left */)
+IPC_MESSAGE_CONTROL0(PpapiPluginMsg_Graphics2D_ReadImageDataAck)
+
+// TrueTypeFont.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_TrueTypeFontSingleton_Create)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_TrueTypeFontSingleton_GetFontFamilies)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_TrueTypeFontSingleton_GetFontFamiliesReply,
+                     std::vector<std::string> /* font_families */)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_TrueTypeFont_Create,
+                     ppapi::proxy::SerializedTrueTypeFontDesc /* desc */)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_TrueTypeFont_Describe)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_TrueTypeFont_DescribeReply,
+                     ppapi::proxy::SerializedTrueTypeFontDesc /* desc */)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_TrueTypeFont_GetTableTags)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_TrueTypeFont_GetTableTagsReply,
+                     std::vector<uint32_t> /* tags */)
+IPC_MESSAGE_CONTROL3(PpapiHostMsg_TrueTypeFont_GetTable,
+                     uint32_t /* table */,
+                     int32_t /* offset */,
+                     int32_t /* max_data_length */)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_TrueTypeFont_GetTableReply,
+                     std::string /* data */)
+
+// HostResolverPrivate, plugin -> host -> plugin
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_HostResolverPrivate_Create)
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_HostResolverPrivate_Resolve,
+                     ppapi::HostPortPair /* host_port */,
+                     PP_HostResolver_Private_Hint /* hint */)
+IPC_MESSAGE_CONTROL2(PpapiPluginMsg_HostResolverPrivate_ResolveReply,
+                     std::string /* canonical_name */,
+                     std::vector<PP_NetAddress_Private> /* net_address_list */)
+
 // Printing.
 IPC_MESSAGE_CONTROL0(PpapiHostMsg_Printing_Create)
 IPC_MESSAGE_CONTROL0(PpapiHostMsg_Printing_GetDefaultPrintSettings)
 IPC_MESSAGE_CONTROL1(PpapiPluginMsg_Printing_GetDefaultPrintSettingsReply,
                      PP_PrintSettings_Dev /* print_settings */)
 
+// Shared memory ---------------------------------------------------------------
+// Creates shared memory on the host side, returning a handle to the shared
+// memory on the plugin and keeping the memory mapped in on the host.
+// We return a "host handle_id" that can be mapped back to the
+// handle on the host side by PpapiGlobals::UntrackSharedMemoryHandle().
+IPC_SYNC_MESSAGE_CONTROL2_2(PpapiHostMsg_SharedMemory_CreateSharedMemory,
+                            PP_Instance /* instance */,
+                            uint32_t /* size */,
+                            int /* host_handle_id */,
+                            ppapi::proxy::SerializedHandle /* plugin_handle */)
+
 // WebSocket ------------------------------------------------------------------
 IPC_MESSAGE_CONTROL0(PpapiHostMsg_WebSocket_Create)
 
@@ -1682,9 +1549,6 @@
 
 // Audio input.
 IPC_MESSAGE_CONTROL0(PpapiHostMsg_AudioInput_Create)
-IPC_MESSAGE_CONTROL0(PpapiHostMsg_AudioInput_EnumerateDevices)
-IPC_MESSAGE_CONTROL1(PpapiPluginMsg_AudioInput_EnumerateDevicesReply,
-                     std::vector<ppapi::DeviceRefData> /* devices */)
 IPC_MESSAGE_CONTROL3(PpapiHostMsg_AudioInput_Open,
                      std::string /* device_id */,
                      PP_AudioSampleRate /* sample_rate */,
@@ -1695,6 +1559,90 @@
 IPC_MESSAGE_CONTROL1(PpapiHostMsg_AudioInput_StartOrStop, bool /* capture */)
 IPC_MESSAGE_CONTROL0(PpapiHostMsg_AudioInput_Close)
 
+// BrowserFont -----------------------------------------------------------------
+
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_BrowserFontSingleton_Create)
+
+// Requests that the browser reply with the list of font families via
+// PpapiPluginMsg_BrowserFontSingleton_GetFontFamiliesReply.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_BrowserFontSingleton_GetFontFamilies)
+
+// Reply to PpapiHostMsg_BrowserFontSingleton_GetFontFamilies with the font
+// family list. The |families| result is encoded by separating each family name
+// by a null character.
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_BrowserFontSingleton_GetFontFamiliesReply,
+                     std::string /* families */)
+
+// Flash -----------------------------------------------------------------------
+
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_Flash_Create)
+
+// Message to notify the browser to register an update in system activity.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_Flash_UpdateActivity)
+
+// Query the browser for the proxy server to use for the given URL.
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_Flash_GetProxyForURL, std::string /* url */)
+// Reply message for GetProxyForURL containing the proxy server.
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_Flash_GetProxyForURLReply,
+                     std::string /* proxy */)
+
+// Queries the browser for the local time zone offset for a given time.
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_Flash_GetLocalTimeZoneOffset,
+                     base::Time /* time */)
+// Reply to GetLocalTimeZoneOffset containing the time zone offset as a double.
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_Flash_GetLocalTimeZoneOffsetReply,
+                     double /* offset */)
+
+// Query the browser for the restrictions on storing Flash LSOs.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_Flash_GetLocalDataRestrictions)
+// Reply message for GetLocalDataRestrictions containing the restrictions to
+// use. These are PP_FlashLSORestrictions cast to an int32_t.
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_Flash_GetLocalDataRestrictionsReply,
+                     int32_t /* restrictions */)
+
+// Notifies the renderer whether the Flash instance is in windowed mode. No
+// reply is sent.
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_Flash_SetInstanceAlwaysOnTop,
+                     bool /* on_top */)
+
+// Notifies the renderer to draw text to the given PP_ImageData resource. All
+// parmeters for drawing (including the resource to draw to) are contianed in
+// the PPBFlash_DrawGlyphs_Params structure. An error code is sent in a reply
+// message indicating success.
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_Flash_DrawGlyphs,
+                     ppapi::proxy::PPBFlash_DrawGlyphs_Params /* params */)
+
+// Notifies the renderer to navigate to the given URL contained in the
+// URLRequestInfoData. An error code is sent in a reply message indicating
+// success.
+IPC_MESSAGE_CONTROL3(PpapiHostMsg_Flash_Navigate,
+                     ppapi::URLRequestInfoData /* data */,
+                     std::string /* target */,
+                     bool /* from_user_action */)
+
+// Queries the renderer on whether the plugin instance is the topmost element
+// in the area of the instance specified by the given PP_Rect. PP_OK is sent as
+// the error code in a reply message if the rect is topmost otherwise
+// PP_ERROR_FAILED is sent.
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_Flash_IsRectTopmost,
+                     PP_Rect /* rect */)
+
+// Notifies the renderer to invoke printing for the given plugin instance. No
+// reply is sent.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_Flash_InvokePrinting)
+
+// DeviceEnumeration -----------------------------------------------------------
+// Device enumeration messages used by audio input and video capture.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_DeviceEnumeration_EnumerateDevices)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_DeviceEnumeration_EnumerateDevicesReply,
+                     std::vector<ppapi::DeviceRefData> /* devices */)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_DeviceEnumeration_MonitorDeviceChange,
+                     uint32_t /* callback_id */)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_DeviceEnumeration_StopMonitoringDeviceChange)
+IPC_MESSAGE_CONTROL2(PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange,
+                     uint32_t /* callback_id */,
+                     std::vector<ppapi::DeviceRefData> /* devices */)
+
 // Flash clipboard.
 IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashClipboard_Create)
 IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashClipboard_RegisterCustomFormat,
@@ -1714,6 +1662,29 @@
                      std::vector<uint32_t> /* formats */,
                      std::vector<std::string> /* data */)
 
+// Flash file.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashFile_Create)
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_FlashFile_OpenFile,
+                     ppapi::PepperFilePath /* path */,
+                     int /* flags */)
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_FlashFile_RenameFile,
+                     ppapi::PepperFilePath /* from_path */,
+                     ppapi::PepperFilePath /* to_path */)
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_FlashFile_DeleteFileOrDir,
+                     ppapi::PepperFilePath /* path */,
+                     bool /* recursive */)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashFile_CreateDir,
+                     ppapi::PepperFilePath /* path */)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashFile_QueryFile,
+                     ppapi::PepperFilePath /* path */)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FlashFile_QueryFileReply,
+                     base::PlatformFileInfo /* file_info */)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashFile_GetDirContents,
+                     ppapi::PepperFilePath /* path */)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FlashFile_GetDirContentsReply,
+                     ppapi::DirContents /* entries */)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashFile_CreateTemporaryFile)
+
 // Flash font file.
 IPC_MESSAGE_CONTROL2(PpapiHostMsg_FlashFontFile_Create,
                      ppapi::proxy::SerializedFontDescription /* description */,
@@ -1723,10 +1694,63 @@
 IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FlashFontFile_GetFontTableReply,
                      std::string /* output */)
 
-// Flash functions.
-IPC_MESSAGE_CONTROL0(PpapiHostMsg_Flash_Create)
-IPC_MESSAGE_CONTROL1(PpapiHostMsg_Flash_EnumerateVideoCaptureDevices,
-                     ppapi::HostResource /* video_capture */)
-IPC_MESSAGE_CONTROL1(PpapiPluginMsg_Flash_EnumerateVideoCaptureDevicesReply,
-                     std::vector<ppapi::DeviceRefData> /* devices */)
+// Flash fullscreen.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashFullscreen_Create)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashFullscreen_SetFullscreen,
+                     bool /* fullscreen */)
+
+// FlashMenu ------------------------------------------------------------------
+
+// Creates the flash menu with the given data.
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashMenu_Create,
+                     ppapi::proxy::SerializedFlashMenu /* menu_data */)
+
+// Shows the menu at the given location relative to the plugin instance.
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashMenu_Show,
+                     PP_Point /* location */)
+
+// Reply to a show command. If the resource reply is PP_OK, the selected_id
+// will be the menu item ID chosen by the user.
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FlashMenu_ShowReply,
+                     int32_t /* selected_id */)
+
+// VideoCapture_Dev, plugin -> host
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoCapture_Create)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoCapture_StartCapture)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_VideoCapture_ReuseBuffer,
+                     uint32_t /* buffer */)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoCapture_StopCapture)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoCapture_Close)
+
+// VideoCapture_Dev, plugin -> host -> plugin
+IPC_MESSAGE_CONTROL3(PpapiHostMsg_VideoCapture_Open,
+                     std::string /* device_id */,
+                     PP_VideoCaptureDeviceInfo_Dev /* requested_info */,
+                     uint32_t /* buffer_count */)
+IPC_MESSAGE_CONTROL0(PpapiPluginMsg_VideoCapture_OpenReply)
+
+// Talk ------------------------------------------------------------------------
+
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_Talk_Create)
+
+// Requests talk permissions. The host will respond with GetPermissionReply.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_Talk_GetPermission)
+
+// Response to GetPermission.
+//
+// The result of this message is the general Pepper "result" in the ReplyParams.
+IPC_MESSAGE_CONTROL0(PpapiPluginMsg_Talk_GetPermissionReply)
+
+// VideoCapture_Dev, host -> plugin
+IPC_MESSAGE_CONTROL3(PpapiPluginMsg_VideoCapture_OnDeviceInfo,
+                     PP_VideoCaptureDeviceInfo_Dev /* info */,
+                     std::vector<ppapi::HostResource> /* buffers */,
+                     uint32_t /* buffer_size */)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_VideoCapture_OnStatus,
+                     uint32_t /* status */)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_VideoCapture_OnError,
+                     uint32_t /* error */)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_VideoCapture_OnBufferReady,
+                     uint32_t /* buffer */)
+
 #endif  // !defined(OS_NACL) && !defined(NACL_WIN64)
diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc
index 763d05c..b654b22 100644
--- a/ppapi/proxy/ppapi_param_traits.cc
+++ b/ppapi/proxy/ppapi_param_traits.cc
@@ -346,6 +346,7 @@
       break;
     case ppapi::proxy::SerializedHandle::SOCKET:
     case ppapi::proxy::SerializedHandle::CHANNEL_HANDLE:
+    case ppapi::proxy::SerializedHandle::FILE:
       ParamTraits<IPC::PlatformFileForTransit>::Write(m, p.descriptor());
       break;
     case ppapi::proxy::SerializedHandle::INVALID:
@@ -386,6 +387,14 @@
       }
       break;
     }
+    case ppapi::proxy::SerializedHandle::FILE: {
+      IPC::PlatformFileForTransit desc;
+      if (ParamTraits<IPC::PlatformFileForTransit>::Read(m, iter, &desc)) {
+        r->set_file_handle(desc);
+        return true;
+      }
+      break;
+    }
     case ppapi::proxy::SerializedHandle::INVALID:
       return true;
     // No default so the compiler will warn us if a new type is added.
@@ -551,6 +560,78 @@
     const param_type& p,
     std::string* l) {
 }
+#endif  // !defined(OS_NACL) && !defined(NACL_WIN64)
+
+// ppapi::proxy::SerializedTrueTypeFontDesc ------------------------------------
+
+// static
+void ParamTraits<ppapi::proxy::SerializedTrueTypeFontDesc>::Write(
+    Message* m,
+    const param_type& p) {
+  ParamTraits<std::string>::Write(m, p.family);
+  ParamTraits<PP_TrueTypeFontFamily_Dev>::Write(m, p.generic_family);
+  ParamTraits<PP_TrueTypeFontStyle_Dev>::Write(m, p.style);
+  ParamTraits<PP_TrueTypeFontWeight_Dev>::Write(m, p.weight);
+  ParamTraits<PP_TrueTypeFontWidth_Dev>::Write(m, p.width);
+  ParamTraits<PP_TrueTypeFontCharset_Dev>::Write(m, p.charset);
+}
+
+// static
+bool ParamTraits<ppapi::proxy::SerializedTrueTypeFontDesc>::Read(
+    const Message* m,
+    PickleIterator* iter,
+    param_type* r) {
+  return
+      ParamTraits<std::string>::Read(m, iter, &r->family) &&
+      ParamTraits<PP_TrueTypeFontFamily_Dev>::Read(m, iter,
+                                                   &r->generic_family) &&
+      ParamTraits<PP_TrueTypeFontStyle_Dev>::Read(m, iter, &r->style) &&
+      ParamTraits<PP_TrueTypeFontWeight_Dev>::Read(m, iter, &r->weight) &&
+      ParamTraits<PP_TrueTypeFontWidth_Dev>::Read(m, iter, &r->width) &&
+      ParamTraits<PP_TrueTypeFontCharset_Dev>::Read(m, iter, &r->charset);
+}
+
+// static
+void ParamTraits<ppapi::proxy::SerializedTrueTypeFontDesc>::Log(
+    const param_type& p,
+    std::string* l) {
+}
+
+#if !defined(OS_NACL) && !defined(NACL_WIN64)
+// ppapi::PepperFilePath -------------------------------------------------------
+
+// static
+void ParamTraits<ppapi::PepperFilePath>::Write(Message* m,
+                                               const param_type& p) {
+  WriteParam(m, static_cast<unsigned>(p.domain()));
+  WriteParam(m, p.path());
+}
+
+// static
+bool ParamTraits<ppapi::PepperFilePath>::Read(const Message* m,
+                                              PickleIterator* iter,
+                                              param_type* p) {
+  unsigned domain;
+  base::FilePath path;
+  if (!ReadParam(m, iter, &domain) || !ReadParam(m, iter, &path))
+    return false;
+  if (domain > ppapi::PepperFilePath::DOMAIN_MAX_VALID)
+    return false;
+
+  *p = ppapi::PepperFilePath(
+      static_cast<ppapi::PepperFilePath::Domain>(domain), path);
+  return true;
+}
+
+// static
+void ParamTraits<ppapi::PepperFilePath>::Log(const param_type& p,
+                                             std::string* l) {
+  l->append("(");
+  LogParam(static_cast<unsigned>(p.domain()), l);
+  l->append(", ");
+  LogParam(p.path(), l);
+  l->append(")");
+}
 
 // SerializedFlashMenu ---------------------------------------------------------
 
diff --git a/ppapi/proxy/ppapi_param_traits.h b/ppapi/proxy/ppapi_param_traits.h
index 13f7351..38ec6f3 100644
--- a/ppapi/proxy/ppapi_param_traits.h
+++ b/ppapi/proxy/ppapi_param_traits.h
@@ -14,6 +14,7 @@
 #include "ppapi/c/pp_rect.h"
 #include "ppapi/c/pp_var.h"
 #include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/shared_impl/file_path.h"
 #include "ppapi/shared_impl/ppapi_permissions.h"
 #include "ppapi/shared_impl/ppb_file_ref_shared.h"
 
@@ -32,6 +33,7 @@
 struct PPBURLLoader_UpdateProgress_Params;
 struct SerializedDirEntry;
 struct SerializedFontDescription;
+struct SerializedTrueTypeFontDesc;
 class SerializedFlashMenu;
 class SerializedHandle;
 class SerializedVar;
@@ -116,6 +118,15 @@
 };
 
 template<>
+struct PPAPI_PROXY_EXPORT
+    ParamTraits<ppapi::proxy::SerializedTrueTypeFontDesc> {
+  typedef ppapi::proxy::SerializedTrueTypeFontDesc param_type;
+  static void Write(Message* m, const param_type& p);
+  static bool Read(const Message* m, PickleIterator* iter, param_type* r);
+  static void Log(const param_type& p, std::string* l);
+};
+
+template<>
 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedHandle> {
   typedef ppapi::proxy::SerializedHandle param_type;
   static void Write(Message* m, const param_type& p);
@@ -166,6 +177,14 @@
 };
 
 #if !defined(OS_NACL) && !defined(NACL_WIN64)
+template <>
+struct ParamTraits<ppapi::PepperFilePath> {
+  typedef ppapi::PepperFilePath param_type;
+  static void Write(Message* m, const param_type& p);
+  static bool Read(const Message* m, PickleIterator* iter, param_type* p);
+  static void Log(const param_type& p, std::string* l);
+};
+
 template<>
 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedFlashMenu> {
   typedef ppapi::proxy::SerializedFlashMenu param_type;
diff --git a/ppapi/proxy/ppapi_proxy_test.cc b/ppapi/proxy/ppapi_proxy_test.cc
index 06658e3..00947e3 100644
--- a/ppapi/proxy/ppapi_proxy_test.cc
+++ b/ppapi/proxy/ppapi_proxy_test.cc
@@ -7,14 +7,17 @@
 #include <sstream>
 
 #include "base/bind.h"
-#include "base/compiler_specific.h"
+#include "base/bind_helpers.h"
 #include "base/message_loop_proxy.h"
 #include "base/observer_list.h"
 #include "base/process_util.h"
+#include "base/run_loop.h"
 #include "ipc/ipc_sync_channel.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/c/private/ppb_proxy_private.h"
 #include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/ppb_message_loop_proxy.h"
+#include "ppapi/shared_impl/proxy_lock.h"
 
 namespace ppapi {
 namespace proxy {
@@ -149,7 +152,9 @@
 
 // PluginProxyTestHarness ------------------------------------------------------
 
-PluginProxyTestHarness::PluginProxyTestHarness() {
+PluginProxyTestHarness::PluginProxyTestHarness(
+    GlobalsConfiguration globals_config)
+    : globals_config_(globals_config) {
 }
 
 PluginProxyTestHarness::~PluginProxyTestHarness() {
@@ -164,10 +169,9 @@
 }
 
 void PluginProxyTestHarness::SetUpHarness() {
-  plugin_globals_.reset(new PluginGlobals(PpapiGlobals::ForTest()));
-
   // These must be first since the dispatcher set-up uses them.
-  PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals());
+  CreatePluginGlobals();
+
   resource_tracker().DidCreateInstance(pp_instance());
 
   plugin_dispatcher_.reset(new PluginDispatcher(
@@ -175,7 +179,6 @@
       PpapiPermissions(),
       false));
   plugin_dispatcher_->InitWithTestSink(&sink());
-  plugin_dispatcher_->DidCreateInstance(pp_instance());
   // The plugin proxy delegate is needed for
   // |PluginProxyDelegate::GetBrowserSender| which is used
   // in |ResourceCreationProxy::GetConnection| to get the channel to the
@@ -183,6 +186,7 @@
   // for test purposes.
   plugin_delegate_mock_.set_browser_sender(plugin_dispatcher_.get());
   PluginGlobals::Get()->set_plugin_proxy_delegate(&plugin_delegate_mock_);
+  plugin_dispatcher_->DidCreateInstance(pp_instance());
 }
 
 void PluginProxyTestHarness::SetUpHarnessWithChannel(
@@ -190,10 +194,9 @@
     base::MessageLoopProxy* ipc_message_loop,
     base::WaitableEvent* shutdown_event,
     bool is_client) {
-  plugin_globals_.reset(new PluginGlobals(PpapiGlobals::ForTest()));
-
   // These must be first since the dispatcher set-up uses them.
-  PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals());
+  CreatePluginGlobals();
+
   resource_tracker().DidCreateInstance(pp_instance());
   plugin_delegate_mock_.Init(ipc_message_loop, shutdown_event);
 
@@ -202,8 +205,11 @@
       PpapiPermissions(),
       false));
   plugin_dispatcher_->InitPluginWithChannel(&plugin_delegate_mock_,
+                                            base::kNullProcessId,
                                             channel_handle,
                                             is_client);
+  plugin_delegate_mock_.set_browser_sender(plugin_dispatcher_.get());
+  PluginGlobals::Get()->set_plugin_proxy_delegate(&plugin_delegate_mock_);
   plugin_dispatcher_->DidCreateInstance(pp_instance());
 }
 
@@ -215,6 +221,15 @@
   plugin_globals_.reset();
 }
 
+void PluginProxyTestHarness::CreatePluginGlobals() {
+  if (globals_config_ == PER_THREAD_GLOBALS) {
+    plugin_globals_.reset(new PluginGlobals(PpapiGlobals::PerThreadForTest()));
+    PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals());
+  } else {
+    plugin_globals_.reset(new PluginGlobals());
+  }
+}
+
 base::MessageLoopProxy*
 PluginProxyTestHarness::PluginDelegateMock::GetIPCMessageLoop() {
   return ipc_message_loop_;
@@ -228,7 +243,7 @@
 IPC::PlatformFileForTransit
 PluginProxyTestHarness::PluginDelegateMock::ShareHandleWithRemote(
     base::PlatformFile handle,
-    const IPC::SyncChannel& /* channel */,
+    base::ProcessId /* remote_pid */,
     bool should_close_source) {
   return IPC::GetFileHandleForProcess(handle,
                                       base::Process::Current().handle(),
@@ -249,12 +264,6 @@
     uint32 plugin_dispatcher_id) {
 }
 
-bool PluginProxyTestHarness::PluginDelegateMock::SendToBrowser(
-    IPC::Message* msg) {
-  NOTREACHED();
-  return false;
-}
-
 IPC::Sender* PluginProxyTestHarness::PluginDelegateMock::GetBrowserSender() {
   return browser_sender_;
 }
@@ -273,7 +282,7 @@
 
 // PluginProxyTest -------------------------------------------------------------
 
-PluginProxyTest::PluginProxyTest() {
+PluginProxyTest::PluginProxyTest() : PluginProxyTestHarness(SINGLETON_GLOBALS) {
 }
 
 PluginProxyTest::~PluginProxyTest() {
@@ -287,6 +296,100 @@
   TearDownHarness();
 }
 
+// PluginProxyMultiThreadTest --------------------------------------------------
+
+PluginProxyMultiThreadTest::PluginProxyMultiThreadTest() {
+}
+
+PluginProxyMultiThreadTest::~PluginProxyMultiThreadTest() {
+}
+
+void PluginProxyMultiThreadTest::RunTest() {
+  main_thread_message_loop_proxy_ =
+      PpapiGlobals::Get()->GetMainThreadMessageLoop();
+  ASSERT_EQ(main_thread_message_loop_proxy_.get(),
+            base::MessageLoopProxy::current());
+  nested_main_thread_message_loop_.reset(new base::RunLoop());
+
+  secondary_thread_.reset(new base::DelegateSimpleThread(
+      this, "PluginProxyMultiThreadTest"));
+
+  {
+    ProxyAutoLock auto_lock;
+
+    // MessageLoopResource assumes that the proxy lock has been acquired.
+    secondary_thread_message_loop_ = new MessageLoopResource(pp_instance());
+
+    ASSERT_EQ(PP_OK,
+        secondary_thread_message_loop_->PostWork(
+            PP_MakeCompletionCallback(
+                &PluginProxyMultiThreadTest::InternalSetUpTestOnSecondaryThread,
+                this),
+            0));
+  }
+
+  SetUpTestOnMainThread();
+
+  secondary_thread_->Start();
+  nested_main_thread_message_loop_->Run();
+  secondary_thread_->Join();
+
+  {
+    ProxyAutoLock auto_lock;
+
+    // The destruction requires a valid PpapiGlobals instance, so we should
+    // explicitly release it.
+    secondary_thread_message_loop_ = NULL;
+  }
+
+  secondary_thread_.reset(NULL);
+  nested_main_thread_message_loop_.reset(NULL);
+  main_thread_message_loop_proxy_ = NULL;
+}
+
+void PluginProxyMultiThreadTest::CheckOnThread(ThreadType thread_type) {
+  ProxyAutoLock auto_lock;
+  if (thread_type == MAIN_THREAD) {
+    ASSERT_TRUE(MessageLoopResource::GetCurrent()->is_main_thread_loop());
+  } else {
+    ASSERT_EQ(secondary_thread_message_loop_.get(),
+              MessageLoopResource::GetCurrent());
+  }
+}
+
+void PluginProxyMultiThreadTest::PostQuitForMainThread() {
+  main_thread_message_loop_proxy_->PostTask(
+      FROM_HERE,
+      base::Bind(&PluginProxyMultiThreadTest::QuitNestedLoop,
+                 base::Unretained(this)));
+}
+
+void PluginProxyMultiThreadTest::PostQuitForSecondaryThread() {
+  ProxyAutoLock auto_lock;
+  secondary_thread_message_loop_->PostQuit(PP_TRUE);
+}
+
+void PluginProxyMultiThreadTest::Run() {
+  ProxyAutoLock auto_lock;
+  ASSERT_EQ(PP_OK, secondary_thread_message_loop_->AttachToCurrentThread());
+  ASSERT_EQ(PP_OK, secondary_thread_message_loop_->Run());
+}
+
+void PluginProxyMultiThreadTest::QuitNestedLoop() {
+  nested_main_thread_message_loop_->Quit();
+}
+
+// static
+void PluginProxyMultiThreadTest::InternalSetUpTestOnSecondaryThread(
+    void* user_data,
+    int32_t result) {
+  EXPECT_EQ(PP_OK, result);
+  PluginProxyMultiThreadTest* thiz =
+      static_cast<PluginProxyMultiThreadTest*>(user_data);
+  thiz->CheckOnThread(SECONDARY_THREAD);
+  thiz->SetUpTestOnSecondaryThread();
+}
+
 // HostProxyTestHarness --------------------------------------------------------
 
 class HostProxyTestHarness::MockSyncMessageStatusReceiver
@@ -296,8 +399,9 @@
   virtual void EndBlockOnSyncMessage() OVERRIDE {}
 };
 
-HostProxyTestHarness::HostProxyTestHarness()
-    : status_receiver_(new MockSyncMessageStatusReceiver) {
+HostProxyTestHarness::HostProxyTestHarness(GlobalsConfiguration globals_config)
+    : globals_config_(globals_config),
+      status_receiver_(new MockSyncMessageStatusReceiver) {
 }
 
 HostProxyTestHarness::~HostProxyTestHarness() {
@@ -312,15 +416,14 @@
 }
 
 void HostProxyTestHarness::SetUpHarness() {
-  host_globals_.reset(new ppapi::TestGlobals(PpapiGlobals::ForTest()));
-
   // These must be first since the dispatcher set-up uses them.
-  PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals());
+  CreateHostGlobals();
+
   host_dispatcher_.reset(new HostDispatcher(
       pp_module(),
       &MockGetInterface,
       status_receiver_.release(),
-      PpapiPermissions()));
+      PpapiPermissions::AllPermissions()));
   host_dispatcher_->InitWithTestSink(&sink());
   HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get());
 }
@@ -330,19 +433,19 @@
     base::MessageLoopProxy* ipc_message_loop,
     base::WaitableEvent* shutdown_event,
     bool is_client) {
-  host_globals_.reset(new ppapi::TestGlobals(PpapiGlobals::ForTest()));
-
   // These must be first since the dispatcher set-up uses them.
-  PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals());
+  CreateHostGlobals();
+
   delegate_mock_.Init(ipc_message_loop, shutdown_event);
 
   host_dispatcher_.reset(new HostDispatcher(
       pp_module(),
       &MockGetInterface,
       status_receiver_.release(),
-      PpapiPermissions()));
+      PpapiPermissions::AllPermissions()));
   ppapi::Preferences preferences;
-  host_dispatcher_->InitHostWithChannel(&delegate_mock_, channel_handle,
+  host_dispatcher_->InitHostWithChannel(&delegate_mock_,
+                                        base::kNullProcessId, channel_handle,
                                         is_client, preferences);
   HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get());
 }
@@ -353,6 +456,15 @@
   host_globals_.reset();
 }
 
+void HostProxyTestHarness::CreateHostGlobals() {
+  if (globals_config_ == PER_THREAD_GLOBALS) {
+    host_globals_.reset(new TestGlobals(PpapiGlobals::PerThreadForTest()));
+    PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals());
+  } else {
+    host_globals_.reset(new TestGlobals());
+  }
+}
+
 base::MessageLoopProxy*
 HostProxyTestHarness::DelegateMock::GetIPCMessageLoop() {
   return ipc_message_loop_;
@@ -365,7 +477,7 @@
 IPC::PlatformFileForTransit
 HostProxyTestHarness::DelegateMock::ShareHandleWithRemote(
     base::PlatformFile handle,
-    const IPC::SyncChannel& /* channel */,
+    base::ProcessId /* remote_pid */,
     bool should_close_source) {
   return IPC::GetFileHandleForProcess(handle,
                                       base::Process::Current().handle(),
@@ -375,7 +487,7 @@
 
 // HostProxyTest ---------------------------------------------------------------
 
-HostProxyTest::HostProxyTest() {
+HostProxyTest::HostProxyTest() : HostProxyTestHarness(SINGLETON_GLOBALS) {
 }
 
 HostProxyTest::~HostProxyTest() {
@@ -393,6 +505,8 @@
 
 TwoWayTest::TwoWayTest(TwoWayTest::TwoWayTestMode test_mode)
     : test_mode_(test_mode),
+      host_(ProxyTestHarnessBase::PER_THREAD_GLOBALS),
+      plugin_(ProxyTestHarnessBase::PER_THREAD_GLOBALS),
       io_thread_("TwoWayTest_IOThread"),
       plugin_thread_("TwoWayTest_PluginThread"),
       remote_harness_(NULL),
diff --git a/ppapi/proxy/ppapi_proxy_test.h b/ppapi/proxy/ppapi_proxy_test.h
index 667a60f..0882790 100644
--- a/ppapi/proxy/ppapi_proxy_test.h
+++ b/ppapi/proxy/ppapi_proxy_test.h
@@ -5,9 +5,12 @@
 #include <map>
 #include <string>
 
-#include "base/message_loop.h"
+#include "base/compiler_specific.h"
+#include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
+#include "base/message_loop.h"
 #include "base/synchronization/waitable_event.h"
+#include "base/threading/simple_thread.h"
 #include "base/threading/thread.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/proxy/host_dispatcher.h"
@@ -20,13 +23,25 @@
 #include "ppapi/shared_impl/test_globals.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+namespace base {
+class MessageLoopProxy;
+class RunLoop;
+}
+
 namespace ppapi {
 namespace proxy {
 
+class MessageLoopResource;
+
 // Base class for plugin and host test harnesses. Tests will not use this
 // directly. Instead, use the PluginProxyTest, HostProxyTest, or TwoWayTest.
 class ProxyTestHarnessBase {
  public:
+  enum GlobalsConfiguration {
+    PER_THREAD_GLOBALS,
+    SINGLETON_GLOBALS
+  };
+
   ProxyTestHarnessBase();
   virtual ~ProxyTestHarnessBase();
 
@@ -78,7 +93,7 @@
 // Test harness for the plugin side of the proxy.
 class PluginProxyTestHarness : public ProxyTestHarnessBase {
  public:
-  PluginProxyTestHarness();
+  explicit PluginProxyTestHarness(GlobalsConfiguration globals_config);
   virtual ~PluginProxyTestHarness();
 
   PluginDispatcher* plugin_dispatcher() { return plugin_dispatcher_.get(); }
@@ -120,7 +135,7 @@
     virtual base::WaitableEvent* GetShutdownEvent() OVERRIDE;
     virtual IPC::PlatformFileForTransit ShareHandleWithRemote(
         base::PlatformFile handle,
-        const IPC::SyncChannel& /* channel */,
+        base::ProcessId remote_pid,
         bool should_close_source) OVERRIDE;
 
     // PluginDispatcher::PluginDelegate implementation.
@@ -129,7 +144,6 @@
     virtual void Unregister(uint32 plugin_dispatcher_id) OVERRIDE;
 
     // PluginProxyDelegate implementation.
-    virtual bool SendToBrowser(IPC::Message* msg) OVERRIDE;
     virtual IPC::Sender* GetBrowserSender() OVERRIDE;
     virtual std::string GetUILanguage() OVERRIDE;
     virtual void PreCacheFont(const void* logfontw) OVERRIDE;
@@ -145,6 +159,9 @@
   };
 
  private:
+  void CreatePluginGlobals();
+
+  GlobalsConfiguration globals_config_;
   scoped_ptr<PluginGlobals> plugin_globals_;
 
   scoped_ptr<PluginDispatcher> plugin_dispatcher_;
@@ -163,9 +180,58 @@
   MessageLoop message_loop_;
 };
 
+// This class provides support for multi-thread testing. A secondary thread is
+// created with a Pepper message loop.
+// Subclasses need to implement the two SetUpTestOn*Thread() methods to do the
+// actual testing work; and call both PostQuitFor*Thread() when testing is
+// done.
+class PluginProxyMultiThreadTest
+    : public PluginProxyTest,
+      public base::DelegateSimpleThread::Delegate {
+ public:
+  PluginProxyMultiThreadTest();
+  virtual ~PluginProxyMultiThreadTest();
+
+  // Called before the secondary thread is started, but after all the member
+  // variables, including |secondary_thread_| and
+  // |secondary_thread_message_loop_|, are initialized.
+  virtual void SetUpTestOnMainThread() = 0;
+
+  virtual void SetUpTestOnSecondaryThread() = 0;
+
+  // TEST_F() should call this method.
+  void RunTest();
+
+  enum ThreadType {
+    MAIN_THREAD,
+    SECONDARY_THREAD
+  };
+  void CheckOnThread(ThreadType thread_type);
+
+  // These can be called on any thread.
+  void PostQuitForMainThread();
+  void PostQuitForSecondaryThread();
+
+ protected:
+  scoped_refptr<MessageLoopResource> secondary_thread_message_loop_;
+  scoped_refptr<base::MessageLoopProxy> main_thread_message_loop_proxy_;
+
+ private:
+  // base::DelegateSimpleThread::Delegate implementation.
+  virtual void Run() OVERRIDE;
+
+  void QuitNestedLoop();
+
+  static void InternalSetUpTestOnSecondaryThread(void* user_data,
+                                                 int32_t result);
+
+  scoped_ptr<base::DelegateSimpleThread> secondary_thread_;
+  scoped_ptr<base::RunLoop> nested_main_thread_message_loop_;
+};
+
 class HostProxyTestHarness : public ProxyTestHarnessBase {
  public:
-  HostProxyTestHarness();
+  explicit HostProxyTestHarness(GlobalsConfiguration globals_config);
   virtual ~HostProxyTestHarness();
 
   HostDispatcher* host_dispatcher() { return host_dispatcher_.get(); }
@@ -203,7 +269,7 @@
     virtual base::WaitableEvent* GetShutdownEvent();
     virtual IPC::PlatformFileForTransit ShareHandleWithRemote(
         base::PlatformFile handle,
-        const IPC::SyncChannel& /* channel */,
+        base::ProcessId remote_pid,
         bool should_close_source) OVERRIDE;
 
    private:
@@ -216,6 +282,9 @@
  private:
   class MockSyncMessageStatusReceiver;
 
+  void CreateHostGlobals();
+
+  GlobalsConfiguration globals_config_;
   scoped_ptr<ppapi::TestGlobals> host_globals_;
   scoped_ptr<HostDispatcher> host_dispatcher_;
   DelegateMock delegate_mock_;
diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc
index 5a6b43a..30d323f 100644
--- a/ppapi/proxy/ppb_audio_proxy.cc
+++ b/ppapi/proxy/ppb_audio_proxy.cc
@@ -180,6 +180,7 @@
   return handled;
 }
 
+#if !defined(OS_NACL)
 void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id,
                                   int32_t sample_rate,
                                   uint32_t sample_frame_count,
@@ -312,6 +313,7 @@
 
   return PP_OK;
 }
+#endif  // !defined(OS_NACL)
 
 // Processed in the plugin (message from host).
 void PPB_Audio_Proxy::OnMsgNotifyAudioStreamCreated(
diff --git a/ppapi/proxy/ppb_audio_proxy.h b/ppapi/proxy/ppb_audio_proxy.h
index 2f85a83..757bdeb 100644
--- a/ppapi/proxy/ppb_audio_proxy.h
+++ b/ppapi/proxy/ppb_audio_proxy.h
@@ -17,7 +17,6 @@
 #include "ppapi/c/ppb_audio_config.h"
 #include "ppapi/proxy/interface_proxy.h"
 #include "ppapi/proxy/proxy_completion_callback_factory.h"
-#include "ppapi/proxy/serialized_structs.h"
 #include "ppapi/utility/completion_callback_factory.h"
 
 namespace ppapi {
@@ -26,6 +25,8 @@
 
 namespace proxy {
 
+class SerializedHandle;
+
 class PPB_Audio_Proxy : public InterfaceProxy {
  public:
   PPB_Audio_Proxy(Dispatcher* dispatcher);
diff --git a/ppapi/proxy/ppb_broker_proxy.cc b/ppapi/proxy/ppb_broker_proxy.cc
index f7818dc..4e19b66 100644
--- a/ppapi/proxy/ppb_broker_proxy.cc
+++ b/ppapi/proxy/ppb_broker_proxy.cc
@@ -147,6 +147,8 @@
 
 void PPB_Broker_Proxy::OnMsgCreate(PP_Instance instance,
                                    HostResource* result_resource) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+    return;
   thunk::EnterResourceCreation enter(instance);
   if (enter.succeeded()) {
     result_resource->SetHostResource(
@@ -156,6 +158,8 @@
 }
 
 void PPB_Broker_Proxy::OnMsgConnect(const HostResource& broker) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+    return;
   EnterHostFromHostResourceForceCallback<PPB_Broker_API> enter(
       broker, callback_factory_,
       &PPB_Broker_Proxy::ConnectCompleteInHost, broker);
diff --git a/ppapi/proxy/ppb_buffer_proxy.cc b/ppapi/proxy/ppb_buffer_proxy.cc
index 813d340..c6d8cdd 100644
--- a/ppapi/proxy/ppb_buffer_proxy.cc
+++ b/ppapi/proxy/ppb_buffer_proxy.cc
@@ -16,7 +16,6 @@
 #include "ppapi/proxy/plugin_dispatcher.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_buffer_trusted_api.h"
 #include "ppapi/thunk/resource_creation_api.h"
 #include "ppapi/thunk/thunk.h"
 
@@ -60,6 +59,11 @@
     shm_.Unmap();
 }
 
+int32_t Buffer::GetSharedMemory(int* out_handle) {
+  NOTREACHED();
+  return PP_ERROR_NOTSUPPORTED;
+}
+
 PPB_Buffer_Proxy::PPB_Buffer_Proxy(Dispatcher* dispatcher)
     : InterfaceProxy(dispatcher) {
 }
@@ -113,6 +117,8 @@
   HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
   if (!dispatcher)
     return;
+  if (!dispatcher->permissions().HasPermission(ppapi::PERMISSION_DEV))
+    return;
 
   thunk::EnterResourceCreation enter(instance);
   if (enter.failed())
@@ -122,7 +128,7 @@
   if (local_buffer_resource == 0)
     return;
 
-  thunk::EnterResourceNoLock<thunk::PPB_BufferTrusted_API> trusted_buffer(
+  thunk::EnterResourceNoLock<thunk::PPB_Buffer_API> trusted_buffer(
       local_buffer_resource, false);
   if (trusted_buffer.failed())
     return;
diff --git a/ppapi/proxy/ppb_buffer_proxy.h b/ppapi/proxy/ppb_buffer_proxy.h
index 41f5e19..d1e6887 100644
--- a/ppapi/proxy/ppb_buffer_proxy.h
+++ b/ppapi/proxy/ppb_buffer_proxy.h
@@ -8,7 +8,6 @@
 #include "base/shared_memory.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/proxy/serialized_structs.h"
 #include "ppapi/shared_impl/resource.h"
 #include "ppapi/thunk/ppb_buffer_api.h"
 
@@ -18,6 +17,8 @@
 
 namespace proxy {
 
+class SerializedHandle;
+
 class Buffer : public thunk::PPB_Buffer_API, public Resource {
  public:
   Buffer(const HostResource& resource,
@@ -34,6 +35,9 @@
   virtual void* Map() OVERRIDE;
   virtual void Unmap() OVERRIDE;
 
+  // Trusted
+  virtual int32_t GetSharedMemory(int* handle) OVERRIDE;
+
  private:
   base::SharedMemory shm_;
   uint32_t size_;
diff --git a/ppapi/proxy/ppb_core_proxy.cc b/ppapi/proxy/ppb_core_proxy.cc
index 6168f49..0c5f87e 100644
--- a/ppapi/proxy/ppb_core_proxy.cc
+++ b/ppapi/proxy/ppb_core_proxy.cc
@@ -104,16 +104,19 @@
 bool PPB_Core_Proxy::OnMessageReceived(const IPC::Message& msg) {
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPB_Core_Proxy, msg)
+#if !defined(OS_NACL)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_AddRefResource,
                         OnMsgAddRefResource)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_ReleaseResource,
                         OnMsgReleaseResource)
+#endif
     IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()
   // TODO(brettw) handle bad messages!
   return handled;
 }
 
+#if !defined(OS_NACL)
 void PPB_Core_Proxy::OnMsgAddRefResource(const HostResource& resource) {
   ppb_core_impl_->AddRefResource(resource.host_resource());
 }
@@ -121,6 +124,7 @@
 void PPB_Core_Proxy::OnMsgReleaseResource(const HostResource& resource) {
   ppb_core_impl_->ReleaseResource(resource.host_resource());
 }
+#endif  // !defined(OS_NACL)
 
 }  // namespace proxy
 }  // namespace ppapi
diff --git a/ppapi/proxy/ppb_file_io_proxy.cc b/ppapi/proxy/ppb_file_io_proxy.cc
deleted file mode 100644
index 6858655..0000000
--- a/ppapi/proxy/ppb_file_io_proxy.cc
+++ /dev/null
@@ -1,450 +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 "ppapi/proxy/ppb_file_io_proxy.h"
-
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/proxy/enter_proxy.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/ppb_file_ref_proxy.h"
-#include "ppapi/shared_impl/ppapi_globals.h"
-#include "ppapi/shared_impl/ppb_file_io_shared.h"
-#include "ppapi/shared_impl/resource.h"
-#include "ppapi/shared_impl/resource_tracker.h"
-
-using ppapi::thunk::PPB_FileIO_API;
-using ppapi::thunk::PPB_FileRef_API;
-
-namespace ppapi {
-namespace proxy {
-
-namespace {
-
-// The maximum size we'll support reading in one chunk. The renderer process
-// must allocate a buffer sized according to the request of the plugin. To
-// keep things from getting out of control, we cap the read size to this value.
-// This should generally be OK since the API specifies that it may perform a
-// partial read.
-static const int32_t kMaxReadSize = 33554432;  // 32MB
-
-typedef EnterHostFromHostResourceForceCallback<PPB_FileIO_API> EnterHostFileIO;
-typedef EnterPluginFromHostResource<PPB_FileIO_API> EnterPluginFileIO;
-
-class FileIO : public PPB_FileIO_Shared {
- public:
-  explicit FileIO(const HostResource& host_resource);
-  virtual ~FileIO();
-
-  // PPB_FileIO_API implementation (not provided by FileIOImpl).
-  virtual void Close() OVERRIDE;
-  virtual int32_t GetOSFileDescriptor() OVERRIDE;
-  virtual int32_t WillWrite(int64_t offset,
-                            int32_t bytes_to_write,
-                            scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t WillSetLength(
-      int64_t length,
-      scoped_refptr<TrackedCallback> callback) OVERRIDE;
-
- private:
-  // FileIOImpl overrides.
-  virtual int32_t OpenValidated(
-      PP_Resource file_ref_resource,
-      PPB_FileRef_API* file_ref_api,
-      int32_t open_flags,
-      scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t QueryValidated(
-      PP_FileInfo* info,
-      scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t TouchValidated(
-      PP_Time last_access_time,
-      PP_Time last_modified_time,
-      scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t ReadValidated(
-      int64_t offset,
-      char* buffer,
-      int32_t bytes_to_read,
-      scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t WriteValidated(
-      int64_t offset,
-      const char* buffer,
-      int32_t bytes_to_write,
-      scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t SetLengthValidated(
-      int64_t length,
-      scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t FlushValidated(
-      scoped_refptr<TrackedCallback> callback) OVERRIDE;
-
-  PluginDispatcher* GetDispatcher() const {
-    return PluginDispatcher::GetForResource(this);
-  }
-
-  static const ApiID kApiID = API_ID_PPB_FILE_IO;
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(FileIO);
-};
-
-FileIO::FileIO(const HostResource& host_resource)
-    : PPB_FileIO_Shared(host_resource) {
-}
-
-FileIO::~FileIO() {
-  Close();
-}
-
-void FileIO::Close() {
-  if (file_open_) {
-    GetDispatcher()->Send(new PpapiHostMsg_PPBFileIO_Close(kApiID,
-                                                           host_resource()));
-  }
-}
-
-int32_t FileIO::GetOSFileDescriptor() {
-  return -1;
-}
-
-int32_t FileIO::WillWrite(int64_t offset,
-                          int32_t bytes_to_write,
-                          scoped_refptr<TrackedCallback> callback) {
-  GetDispatcher()->Send(new PpapiHostMsg_PPBFileIO_WillWrite(
-      kApiID, host_resource(), offset, bytes_to_write));
-  RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL);
-  return PP_OK_COMPLETIONPENDING;
-}
-
-int32_t FileIO::WillSetLength(int64_t length,
-                              scoped_refptr<TrackedCallback> callback) {
-  GetDispatcher()->Send(new PpapiHostMsg_PPBFileIO_WillSetLength(
-      kApiID, host_resource(), length));
-  RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL);
-  return PP_OK_COMPLETIONPENDING;
-}
-
-int32_t FileIO::OpenValidated(PP_Resource file_ref_resource,
-                              PPB_FileRef_API* file_ref_api,
-                              int32_t open_flags,
-                              scoped_refptr<TrackedCallback> callback) {
-  Resource* file_ref_object =
-      PpapiGlobals::Get()->GetResourceTracker()->GetResource(file_ref_resource);
-
-  GetDispatcher()->Send(new PpapiHostMsg_PPBFileIO_Open(
-      kApiID, host_resource(), file_ref_object->host_resource(), open_flags));
-  RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL);
-  return PP_OK_COMPLETIONPENDING;
-}
-
-int32_t FileIO::QueryValidated(PP_FileInfo* info,
-                               scoped_refptr<TrackedCallback> callback) {
-  GetDispatcher()->Send(new PpapiHostMsg_PPBFileIO_Query(
-      kApiID, host_resource()));
-  RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, info);
-  return PP_OK_COMPLETIONPENDING;
-}
-
-int32_t FileIO::TouchValidated(PP_Time last_access_time,
-                               PP_Time last_modified_time,
-                               scoped_refptr<TrackedCallback> callback) {
-  GetDispatcher()->Send(new PpapiHostMsg_PPBFileIO_Touch(
-      kApiID, host_resource(), last_access_time, last_modified_time));
-  RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL);
-  return PP_OK_COMPLETIONPENDING;
-}
-
-int32_t FileIO::ReadValidated(int64_t offset,
-                              char* buffer,
-                              int32_t bytes_to_read,
-                              scoped_refptr<TrackedCallback> callback) {
-  GetDispatcher()->Send(new PpapiHostMsg_PPBFileIO_Read(
-      kApiID, host_resource(), offset, bytes_to_read));
-  RegisterCallback(OPERATION_READ, callback, buffer, NULL);
-  return PP_OK_COMPLETIONPENDING;
-}
-
-int32_t FileIO::WriteValidated(int64_t offset,
-                               const char* buffer,
-                               int32_t bytes_to_write,
-                               scoped_refptr<TrackedCallback> callback) {
-  // TODO(brettw) it would be nice to use a shared memory buffer for large
-  // writes rather than having to copy to a string (which will involve a number
-  // of extra copies to serialize over IPC).
-  GetDispatcher()->Send(new PpapiHostMsg_PPBFileIO_Write(
-      kApiID, host_resource(), offset, std::string(buffer, bytes_to_write)));
-  RegisterCallback(OPERATION_WRITE, callback, NULL, NULL);
-  return PP_OK_COMPLETIONPENDING;
-}
-
-int32_t FileIO::SetLengthValidated(int64_t length,
-                                   scoped_refptr<TrackedCallback> callback) {
-  GetDispatcher()->Send(new PpapiHostMsg_PPBFileIO_SetLength(
-      kApiID, host_resource(), length));
-  RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL);
-  return PP_OK_COMPLETIONPENDING;
-}
-
-int32_t FileIO::FlushValidated(scoped_refptr<TrackedCallback> callback) {
-  GetDispatcher()->Send(new PpapiHostMsg_PPBFileIO_Flush(
-      kApiID, host_resource()));
-  RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL);
-  return PP_OK_COMPLETIONPENDING;
-}
-
-}  // namespace
-
-// -----------------------------------------------------------------------------
-
-PPB_FileIO_Proxy::PPB_FileIO_Proxy(Dispatcher* dispatcher)
-    : InterfaceProxy(dispatcher),
-      callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
-}
-
-PPB_FileIO_Proxy::~PPB_FileIO_Proxy() {
-}
-
-// static
-PP_Resource PPB_FileIO_Proxy::CreateProxyResource(PP_Instance instance) {
-  PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
-  if (!dispatcher)
-    return 0;
-
-  HostResource result;
-  dispatcher->Send(new PpapiHostMsg_PPBFileIO_Create(kApiID, instance,
-                                                     &result));
-  if (result.is_null())
-    return 0;
-  return (new FileIO(result))->GetReference();
-}
-
-bool PPB_FileIO_Proxy::OnMessageReceived(const IPC::Message& msg) {
-  bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP(PPB_FileIO_Proxy, msg)
-    // Plugin -> host message.
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileIO_Create, OnHostMsgCreate)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileIO_Open, OnHostMsgOpen)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileIO_Close, OnHostMsgClose)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileIO_Query, OnHostMsgQuery)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileIO_Touch, OnHostMsgTouch)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileIO_Read, OnHostMsgRead)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileIO_Write, OnHostMsgWrite)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileIO_SetLength, OnHostMsgSetLength)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileIO_Flush, OnHostMsgFlush)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileIO_WillWrite, OnHostMsgWillWrite)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileIO_WillSetLength,
-                        OnHostMsgWillSetLength)
-
-    // Host -> plugin messages.
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileIO_GeneralComplete,
-                        OnPluginMsgGeneralComplete)
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileIO_OpenFileComplete,
-                        OnPluginMsgOpenFileComplete)
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileIO_QueryComplete,
-                        OnPluginMsgQueryComplete)
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileIO_ReadComplete,
-                        OnPluginMsgReadComplete)
-    IPC_MESSAGE_UNHANDLED(handled = false)
-  IPC_END_MESSAGE_MAP()
-  return handled;
-}
-
-void PPB_FileIO_Proxy::OnHostMsgCreate(PP_Instance instance,
-                                       HostResource* result) {
-  thunk::EnterResourceCreation enter(instance);
-  if (enter.succeeded()) {
-    result->SetHostResource(instance,
-                            enter.functions()->CreateFileIO(instance));
-  }
-}
-
-void PPB_FileIO_Proxy::OnHostMsgOpen(const HostResource& host_resource,
-                                     const HostResource& file_ref_resource,
-                                     int32_t open_flags) {
-  EnterHostFileIO enter(host_resource, callback_factory_,
-      &PPB_FileIO_Proxy::OpenFileCallbackCompleteInHost, host_resource);
-  if (enter.succeeded()) {
-    enter.SetResult(enter.object()->Open(
-        file_ref_resource.host_resource(), open_flags, enter.callback()));
-  }
-}
-
-void PPB_FileIO_Proxy::OnHostMsgClose(const HostResource& host_resource) {
-  EnterHostFromHostResource<PPB_FileIO_API> enter(host_resource);
-  if (enter.succeeded())
-    enter.object()->Close();
-}
-
-void PPB_FileIO_Proxy::OnHostMsgQuery(const HostResource& host_resource) {
-  // The callback will take charge of deleting the FileInfo. The contents must
-  // be defined so we don't send garbage to the plugin in the failure case.
-  PP_FileInfo* info = new PP_FileInfo;
-  memset(info, 0, sizeof(PP_FileInfo));
-  EnterHostFileIO enter(host_resource, callback_factory_,
-                        &PPB_FileIO_Proxy::QueryCallbackCompleteInHost,
-                        host_resource, info);
-  if (enter.succeeded())
-    enter.SetResult(enter.object()->Query(info, enter.callback()));
-}
-
-void PPB_FileIO_Proxy::OnHostMsgTouch(const HostResource& host_resource,
-                                      PP_Time last_access_time,
-                                      PP_Time last_modified_time) {
-  EnterHostFileIO enter(host_resource, callback_factory_,
-                        &PPB_FileIO_Proxy::GeneralCallbackCompleteInHost,
-                        host_resource);
-  if (enter.succeeded()) {
-    enter.SetResult(enter.object()->Touch(last_access_time, last_modified_time,
-                                          enter.callback()));
-  }
-}
-
-void PPB_FileIO_Proxy::OnHostMsgRead(const HostResource& host_resource,
-                                     int64_t offset,
-                                     int32_t bytes_to_read) {
-  // Validate bytes_to_read before allocating below. This value is coming from
-  // the untrusted plugin.
-  bytes_to_read = std::min(bytes_to_read, kMaxReadSize);
-  if (bytes_to_read < 0) {
-    ReadCallbackCompleteInHost(PP_ERROR_FAILED, host_resource,
-                               new std::string());
-    return;
-  }
-
-  // The callback will take charge of deleting the string.
-  std::string* dest = new std::string;
-  dest->resize(bytes_to_read);
-  EnterHostFileIO enter(host_resource, callback_factory_,
-                        &PPB_FileIO_Proxy::ReadCallbackCompleteInHost,
-                        host_resource, dest);
-  if (enter.succeeded()) {
-    enter.SetResult(enter.object()->Read(offset,
-                                         bytes_to_read > 0 ? &(*dest)[0] : NULL,
-                                         bytes_to_read, enter.callback()));
-  }
-}
-
-void PPB_FileIO_Proxy::OnHostMsgWrite(const HostResource& host_resource,
-                                      int64_t offset,
-                                      const std::string& data) {
-  EnterHostFileIO enter(host_resource, callback_factory_,
-                        &PPB_FileIO_Proxy::GeneralCallbackCompleteInHost,
-                        host_resource);
-  if (enter.succeeded()) {
-    enter.SetResult(enter.object()->Write(offset, data.data(), data.size(),
-                                          enter.callback()));
-  }
-}
-
-void PPB_FileIO_Proxy::OnHostMsgSetLength(const HostResource& host_resource,
-                                          int64_t length) {
-  EnterHostFileIO enter(host_resource, callback_factory_,
-                        &PPB_FileIO_Proxy::GeneralCallbackCompleteInHost,
-                        host_resource);
-  if (enter.succeeded())
-    enter.SetResult(enter.object()->SetLength(length, enter.callback()));
-}
-
-void PPB_FileIO_Proxy::OnHostMsgFlush(const HostResource& host_resource) {
-  EnterHostFileIO enter(host_resource, callback_factory_,
-                        &PPB_FileIO_Proxy::GeneralCallbackCompleteInHost,
-                        host_resource);
-  if (enter.succeeded())
-    enter.SetResult(enter.object()->Flush(enter.callback()));
-}
-
-void PPB_FileIO_Proxy::OnHostMsgWillWrite(const HostResource& host_resource,
-                                          int64_t offset,
-                                          int32_t bytes_to_write) {
-  EnterHostFileIO enter(host_resource, callback_factory_,
-                        &PPB_FileIO_Proxy::GeneralCallbackCompleteInHost,
-                        host_resource);
-  if (enter.succeeded()) {
-    enter.SetResult(enter.object()->WillWrite(offset, bytes_to_write,
-                                              enter.callback()));
-  }
-}
-
-void PPB_FileIO_Proxy::OnHostMsgWillSetLength(const HostResource& host_resource,
-                                              int64_t length) {
-  EnterHostFileIO enter(host_resource, callback_factory_,
-                        &PPB_FileIO_Proxy::GeneralCallbackCompleteInHost,
-                        host_resource);
-  if (enter.succeeded())
-    enter.SetResult(enter.object()->WillSetLength(length, enter.callback()));
-}
-
-void PPB_FileIO_Proxy::OnPluginMsgGeneralComplete(
-    const HostResource& host_resource,
-    int32_t result) {
-  EnterPluginFileIO enter(host_resource);
-  if (enter.succeeded())
-    static_cast<FileIO*>(enter.object())->ExecuteGeneralCallback(result);
-}
-
-void PPB_FileIO_Proxy::OnPluginMsgOpenFileComplete(
-    const HostResource& host_resource,
-    int32_t result) {
-  EnterPluginFileIO enter(host_resource);
-  if (enter.succeeded())
-    static_cast<FileIO*>(enter.object())->ExecuteOpenFileCallback(result);
-}
-
-void PPB_FileIO_Proxy::OnPluginMsgQueryComplete(
-    const HostResource& host_resource,
-    int32_t result,
-    const PP_FileInfo& info) {
-  EnterPluginFileIO enter(host_resource);
-  if (enter.succeeded())
-    static_cast<FileIO*>(enter.object())->ExecuteQueryCallback(result, info);
-}
-
-void PPB_FileIO_Proxy::OnPluginMsgReadComplete(
-    const HostResource& host_resource,
-    int32_t result,
-    const std::string& data) {
-  EnterPluginFileIO enter(host_resource);
-  if (enter.succeeded()) {
-    // The result code should contain the data size if it's positive.
-    DCHECK((result < 0 && data.size() == 0) ||
-           result == static_cast<int32_t>(data.size()));
-    static_cast<FileIO*>(enter.object())->ExecuteReadCallback(result,
-                                                              data.data());
-  }
-}
-
-void PPB_FileIO_Proxy::GeneralCallbackCompleteInHost(
-    int32_t pp_error,
-    const HostResource& host_resource) {
-  Send(new PpapiMsg_PPBFileIO_GeneralComplete(kApiID, host_resource, pp_error));
-}
-
-void PPB_FileIO_Proxy::OpenFileCallbackCompleteInHost(
-    int32_t pp_error,
-    const HostResource& host_resource) {
-  Send(new PpapiMsg_PPBFileIO_OpenFileComplete(kApiID, host_resource,
-                                               pp_error));
-}
-
-void PPB_FileIO_Proxy::QueryCallbackCompleteInHost(
-    int32_t pp_error,
-    const HostResource& host_resource,
-    PP_FileInfo* info) {
-  Send(new PpapiMsg_PPBFileIO_QueryComplete(kApiID, host_resource, pp_error,
-                                            *info));
-  delete info;
-}
-
-void PPB_FileIO_Proxy::ReadCallbackCompleteInHost(
-    int32_t pp_error,
-    const HostResource& host_resource,
-    std::string* data) {
-  // Only send the amount of data in the string that was actually read.
-  if (pp_error >= 0) {
-    DCHECK(pp_error <= static_cast<int32_t>(data->size()));
-    data->resize(pp_error);
-  }
-  Send(new PpapiMsg_PPBFileIO_ReadComplete(kApiID, host_resource, pp_error,
-                                           *data));
-  delete data;
-}
-
-}  // namespace proxy
-}  // namespace ppapi
diff --git a/ppapi/proxy/ppb_file_io_proxy.h b/ppapi/proxy/ppb_file_io_proxy.h
deleted file mode 100644
index 10e5313..0000000
--- a/ppapi/proxy/ppb_file_io_proxy.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PPAPI_PROXY_PPB_FILE_IO_PROXY_H_
-#define PPAPI_PROXY_PPB_FILE_IO_PROXY_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "ppapi/c/pp_file_info.h"
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/proxy/proxy_completion_callback_factory.h"
-#include "ppapi/utility/completion_callback_factory.h"
-
-namespace ppapi {
-
-class HostResource;
-namespace proxy {
-
-class PPB_FileIO_Proxy : public InterfaceProxy {
- public:
-  explicit PPB_FileIO_Proxy(Dispatcher* dispatcher);
-  virtual ~PPB_FileIO_Proxy();
-
-  static PP_Resource CreateProxyResource(PP_Instance instance);
-
-  // InterfaceProxy implementation.
-  virtual bool OnMessageReceived(const IPC::Message& msg);
-
-  static const ApiID kApiID = API_ID_PPB_FILE_IO;
-
- private:
-  // Plugin -> Host message handlers.
-  void OnHostMsgCreate(PP_Instance instance, HostResource* result);
-  void OnHostMsgOpen(const HostResource& host_resource,
-                     const HostResource& file_ref_resource,
-                     int32_t open_flags);
-  void OnHostMsgClose(const HostResource& host_resource);
-  void OnHostMsgQuery(const HostResource& host_resource);
-  void OnHostMsgTouch(const HostResource& host_resource,
-                      PP_Time last_access_time,
-                      PP_Time last_modified_time);
-  void OnHostMsgRead(const HostResource& host_resource,
-                     int64_t offset,
-                     int32_t bytes_to_read);
-  void OnHostMsgWrite(const HostResource& host_resource,
-                      int64_t offset,
-                      const std::string& data);
-  void OnHostMsgSetLength(const HostResource& host_resource,
-                          int64_t length);
-  void OnHostMsgFlush(const HostResource& host_resource);
-  void OnHostMsgWillWrite(const HostResource& host_resource,
-                          int64_t offset,
-                          int32_t bytes_to_write);
-  void OnHostMsgWillSetLength(const HostResource& host_resource,
-                              int64_t length);
-
-  // Host -> Plugin message handlers.
-  void OnPluginMsgGeneralComplete(const HostResource& host_resource,
-                                  int32_t result);
-  void OnPluginMsgOpenFileComplete(const HostResource& host_resource,
-                                  int32_t result);
-  void OnPluginMsgQueryComplete(const HostResource& host_resource,
-                                int32_t result,
-                                const PP_FileInfo& info);
-  void OnPluginMsgReadComplete(const HostResource& host_resource,
-                               int32_t result,
-                               const std::string& data);
-  void OnPluginMsgWriteComplete(const HostResource& host_resource,
-                                int32_t result);
-
-  // Host-side callback handlers. These convert the callbacks to an IPC message
-  // to the plugin.
-  void GeneralCallbackCompleteInHost(int32_t pp_error,
-                                     const HostResource& host_resource);
-  void OpenFileCallbackCompleteInHost(int32_t pp_error,
-                                      const HostResource& host_resource);
-  void QueryCallbackCompleteInHost(int32_t pp_error,
-                                   const HostResource& host_resource,
-                                   PP_FileInfo* info);
-  void ReadCallbackCompleteInHost(int32_t pp_error,
-                                  const HostResource& host_resource,
-                                  std::string* data);
-  ProxyCompletionCallbackFactory<PPB_FileIO_Proxy> callback_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(PPB_FileIO_Proxy);
-};
-
-}  // namespace proxy
-}  // namespace ppapi
-
-#endif  // PPAPI_PROXY_PPB_FILE_IO_PROXY_H_
diff --git a/ppapi/proxy/ppb_file_ref_proxy.cc b/ppapi/proxy/ppb_file_ref_proxy.cc
index dcfb137..49dac58 100644
--- a/ppapi/proxy/ppb_file_ref_proxy.cc
+++ b/ppapi/proxy/ppb_file_ref_proxy.cc
@@ -192,6 +192,7 @@
 bool PPB_FileRef_Proxy::OnMessageReceived(const IPC::Message& msg) {
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPB_FileRef_Proxy, msg)
+#if !defined(OS_NACL)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Create, OnMsgCreate)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_GetParent, OnMsgGetParent)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_MakeDirectory,
@@ -201,6 +202,7 @@
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Rename, OnMsgRename)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_GetAbsolutePath,
                         OnMsgGetAbsolutePath)
+#endif  // !defined(OS_NACL)
 
     IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileRef_CallbackComplete,
                         OnMsgCallbackComplete)
@@ -225,6 +227,7 @@
   return (new FileRef(serialized))->GetReference();
 }
 
+#if !defined(OS_NACL)
 void PPB_FileRef_Proxy::OnMsgCreate(const HostResource& file_system,
                                     const std::string& path,
                                     PPB_FileRef_CreateInfo* result) {
@@ -297,6 +300,7 @@
   if (enter.succeeded())
     result.Return(dispatcher(), enter.object()->GetAbsolutePath());
 }
+#endif  // !defined(OS_NACL)
 
 void PPB_FileRef_Proxy::OnMsgCallbackComplete(
     const HostResource& host_resource,
@@ -308,6 +312,7 @@
     static_cast<FileRef*>(enter.object())->ExecuteCallback(callback_id, result);
 }
 
+#if !defined(OS_NACL)
 void PPB_FileRef_Proxy::OnCallbackCompleteInHost(
     int32_t result,
     const HostResource& host_resource,
@@ -316,6 +321,7 @@
   Send(new PpapiMsg_PPBFileRef_CallbackComplete(
       API_ID_PPB_FILE_REF, host_resource, callback_id, result));
 }
+#endif  // !defined(OS_NACL)
 
 }  // namespace proxy
 }  // namespace ppapi
diff --git a/ppapi/proxy/ppb_file_system_proxy.cc b/ppapi/proxy/ppb_file_system_proxy.cc
index 1d8747a..f0e67a4 100644
--- a/ppapi/proxy/ppb_file_system_proxy.cc
+++ b/ppapi/proxy/ppb_file_system_proxy.cc
@@ -135,14 +135,17 @@
 bool PPB_FileSystem_Proxy::OnMessageReceived(const IPC::Message& msg) {
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPB_FileSystem_Proxy, msg)
+#if !defined(OS_NACL)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Create, OnMsgCreate)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Open, OnMsgOpen)
+#endif
     IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileSystem_OpenComplete, OnMsgOpenComplete)
     IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()
   return handled;
 }
 
+#if !defined(OS_NACL)
 void PPB_FileSystem_Proxy::OnMsgCreate(PP_Instance instance,
                                        int type,
                                        HostResource* result) {
@@ -164,6 +167,7 @@
   if (enter.succeeded())
     enter.SetResult(enter.object()->Open(expected_size, enter.callback()));
 }
+#endif  // !defined(OS_NACL)
 
 // Called in the plugin to handle the open callback.
 void PPB_FileSystem_Proxy::OnMsgOpenComplete(const HostResource& host_resource,
@@ -173,12 +177,14 @@
     static_cast<FileSystem*>(enter.object())->OpenComplete(result);
 }
 
+#if !defined(OS_NACL)
 void PPB_FileSystem_Proxy::OpenCompleteInHost(
     int32_t result,
     const HostResource& host_resource) {
   dispatcher()->Send(new PpapiMsg_PPBFileSystem_OpenComplete(
       API_ID_PPB_FILE_SYSTEM, host_resource, result));
 }
+#endif  // !defined(OS_NACL)
 
 }  // namespace proxy
 }  // namespace ppapi
diff --git a/ppapi/proxy/ppb_flash_menu_proxy.cc b/ppapi/proxy/ppb_flash_menu_proxy.cc
deleted file mode 100644
index a499e51..0000000
--- a/ppapi/proxy/ppb_flash_menu_proxy.cc
+++ /dev/null
@@ -1,174 +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 "ppapi/proxy/ppb_flash_menu_proxy.h"
-
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/private/ppb_flash_menu.h"
-#include "ppapi/proxy/enter_proxy.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_flash_menu_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
-
-using ppapi::thunk::PPB_Flash_Menu_API;
-using ppapi::thunk::ResourceCreationAPI;
-
-namespace ppapi {
-namespace proxy {
-
-class FlashMenu : public PPB_Flash_Menu_API, public Resource {
- public:
-  explicit FlashMenu(const HostResource& resource);
-  virtual ~FlashMenu();
-
-  // Resource overrides.
-  virtual PPB_Flash_Menu_API* AsPPB_Flash_Menu_API() OVERRIDE;
-
-  // PPB_Flash_Menu_API implementation.
-  virtual int32_t Show(const PP_Point* location,
-                       int32_t* selected_id,
-                       scoped_refptr<TrackedCallback> callback) OVERRIDE;
-
-  void ShowACK(int32_t selected_id, int32_t result);
-
- private:
-  scoped_refptr<TrackedCallback> callback_;
-  int32_t* selected_id_ptr_;
-
-  DISALLOW_COPY_AND_ASSIGN(FlashMenu);
-};
-
-FlashMenu::FlashMenu(const HostResource& resource)
-    : Resource(OBJECT_IS_PROXY, resource),
-      selected_id_ptr_(NULL) {
-}
-
-FlashMenu::~FlashMenu() {
-}
-
-PPB_Flash_Menu_API* FlashMenu::AsPPB_Flash_Menu_API() {
-  return this;
-}
-
-int32_t FlashMenu::Show(const struct PP_Point* location,
-                        int32_t* selected_id,
-                        scoped_refptr<TrackedCallback> callback) {
-  if (TrackedCallback::IsPending(callback_))
-    return PP_ERROR_INPROGRESS;
-
-  selected_id_ptr_ = selected_id;
-  callback_ = callback;
-
-  PluginDispatcher::GetForResource(this)->Send(
-      new PpapiHostMsg_PPBFlashMenu_Show(
-          API_ID_PPB_FLASH_MENU, host_resource(), *location));
-  return PP_OK_COMPLETIONPENDING;
-}
-
-void FlashMenu::ShowACK(int32_t selected_id, int32_t result) {
-  *selected_id_ptr_ = selected_id;
-  callback_->Run(result);
-}
-
-PPB_Flash_Menu_Proxy::PPB_Flash_Menu_Proxy(Dispatcher* dispatcher)
-    : InterfaceProxy(dispatcher),
-      callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
-}
-
-PPB_Flash_Menu_Proxy::~PPB_Flash_Menu_Proxy() {
-}
-
-// static
-PP_Resource PPB_Flash_Menu_Proxy::CreateProxyResource(
-    PP_Instance instance_id,
-    const PP_Flash_Menu* menu_data) {
-  PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
-  if (!dispatcher)
-    return 0;
-
-  HostResource result;
-  SerializedFlashMenu serialized_menu;
-  if (!serialized_menu.SetPPMenu(menu_data))
-    return 0;
-
-  dispatcher->Send(new PpapiHostMsg_PPBFlashMenu_Create(
-      API_ID_PPB_FLASH_MENU, instance_id, serialized_menu, &result));
-  if (result.is_null())
-    return 0;
-  return (new FlashMenu(result))->GetReference();
-}
-
-bool PPB_Flash_Menu_Proxy::OnMessageReceived(const IPC::Message& msg) {
-  if (!dispatcher()->permissions().HasPermission(PERMISSION_FLASH))
-    return false;
-
-  bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP(PPB_Flash_Menu_Proxy, msg)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlashMenu_Create,
-                        OnMsgCreate)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlashMenu_Show,
-                        OnMsgShow)
-
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPBFlashMenu_ShowACK,
-                        OnMsgShowACK)
-    IPC_MESSAGE_UNHANDLED(handled = false)
-  IPC_END_MESSAGE_MAP()
-  // FIXME(brettw) handle bad messages!
-  return handled;
-}
-
-void PPB_Flash_Menu_Proxy::OnMsgCreate(PP_Instance instance,
-                                       const SerializedFlashMenu& menu_data,
-                                       HostResource* result) {
-  thunk::EnterResourceCreation enter(instance);
-  if (enter.succeeded()) {
-    result->SetHostResource(
-        instance,
-        enter.functions()->CreateFlashMenu(instance, menu_data.pp_menu()));
-  }
-}
-
-struct PPB_Flash_Menu_Proxy::ShowRequest {
-  HostResource menu;
-  int32_t selected_id;
-};
-
-void PPB_Flash_Menu_Proxy::OnMsgShow(const HostResource& menu,
-                                     const PP_Point& location) {
-  ShowRequest* request = new ShowRequest;
-  request->menu = menu;
-
-  EnterHostFromHostResourceForceCallback<PPB_Flash_Menu_API> enter(
-      menu, callback_factory_, &PPB_Flash_Menu_Proxy::SendShowACKToPlugin,
-      request);
-  if (enter.succeeded()) {
-    enter.SetResult(enter.object()->Show(&location, &request->selected_id,
-                                         enter.callback()));
-  }
-}
-
-void PPB_Flash_Menu_Proxy::OnMsgShowACK(const HostResource& menu,
-                                        int32_t selected_id,
-                                        int32_t result) {
-  EnterPluginFromHostResource<PPB_Flash_Menu_API> enter(menu);
-  if (enter.failed())
-    return;
-  static_cast<FlashMenu*>(enter.object())->ShowACK(selected_id, result);
-}
-
-void PPB_Flash_Menu_Proxy::SendShowACKToPlugin(
-    int32_t result,
-    ShowRequest* request) {
-  dispatcher()->Send(new PpapiMsg_PPBFlashMenu_ShowACK(
-      API_ID_PPB_FLASH_MENU,
-      request->menu,
-      request->selected_id,
-      result));
-  delete request;
-}
-
-}  // namespace proxy
-}  // namespace ppapi
diff --git a/ppapi/proxy/ppb_flash_menu_proxy.h b/ppapi/proxy/ppb_flash_menu_proxy.h
deleted file mode 100644
index b9eda00..0000000
--- a/ppapi/proxy/ppb_flash_menu_proxy.h
+++ /dev/null
@@ -1,55 +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 PPAPI_PPB_FLASH_MENU_PROXY_H_
-#define PPAPI_PPB_FLASH_MENU_PROXY_H_
-
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/proxy/proxy_completion_callback_factory.h"
-#include "ppapi/utility/completion_callback_factory.h"
-
-struct PP_Flash_Menu;
-struct PP_Point;
-
-namespace ppapi {
-
-class HostResource;
-
-namespace proxy {
-
-class SerializedFlashMenu;
-
-class PPB_Flash_Menu_Proxy : public InterfaceProxy {
- public:
-  PPB_Flash_Menu_Proxy(Dispatcher* dispatcher);
-  virtual ~PPB_Flash_Menu_Proxy();
-
-  static PP_Resource CreateProxyResource(PP_Instance instance_id,
-                                         const PP_Flash_Menu* menu_data);
-
-  // InterfaceProxy implementation.
-  virtual bool OnMessageReceived(const IPC::Message& msg);
-
-  static const ApiID kApiID = API_ID_PPB_FLASH_MENU;
-
- private:
-  struct ShowRequest;
-
-  void OnMsgCreate(PP_Instance instance_id,
-                   const SerializedFlashMenu& menu_data,
-                   ppapi::HostResource* resource);
-  void OnMsgShow(const ppapi::HostResource& menu,
-                 const PP_Point& location);
-  void OnMsgShowACK(const ppapi::HostResource& menu,
-                    int32_t selected_id,
-                    int32_t result);
-  void SendShowACKToPlugin(int32_t result, ShowRequest* request);
-
-  ProxyCompletionCallbackFactory<PPB_Flash_Menu_Proxy> callback_factory_;
-};
-
-}  // namespace proxy
-}  // namespace ppapi
-
-#endif  // PPAPI_PPB_FLASH_MENU_PROXY_H_
diff --git a/ppapi/proxy/ppb_flash_message_loop_proxy.cc b/ppapi/proxy/ppb_flash_message_loop_proxy.cc
index c4d4ce1..8b7ff82 100644
--- a/ppapi/proxy/ppb_flash_message_loop_proxy.cc
+++ b/ppapi/proxy/ppb_flash_message_loop_proxy.cc
@@ -118,6 +118,8 @@
 
 void PPB_Flash_MessageLoop_Proxy::OnMsgCreate(PP_Instance instance,
                                               HostResource* result) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_FLASH))
+    return;
   thunk::EnterResourceCreation enter(instance);
   if (enter.succeeded()) {
     result->SetHostResource(
@@ -128,6 +130,9 @@
 void PPB_Flash_MessageLoop_Proxy::OnMsgRun(
     const HostResource& flash_message_loop,
     IPC::Message* reply) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_FLASH))
+    return;
+
   PPB_Flash_MessageLoop_API::RunFromHostProxyCallback callback =
       base::Bind(&PPB_Flash_MessageLoop_Proxy::WillQuitSoon, AsWeakPtr(),
                  base::Passed(scoped_ptr<IPC::Message>(reply)));
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc
deleted file mode 100644
index 23e335d..0000000
--- a/ppapi/proxy/ppb_flash_proxy.cc
+++ /dev/null
@@ -1,774 +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 "ppapi/proxy/ppb_flash_proxy.h"
-
-#include <math.h>
-
-#include <limits>
-
-#include "base/logging.h"
-#include "base/message_loop.h"
-#include "base/time.h"
-#include "build/build_config.h"
-#include "ppapi/c/dev/ppb_font_dev.h"
-#include "ppapi/c/dev/ppb_var_deprecated.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/private/ppb_flash.h"
-#include "ppapi/c/private/ppb_flash_print.h"
-#include "ppapi/proxy/host_dispatcher.h"
-#include "ppapi/proxy/pepper_file_messages.h"
-#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/plugin_globals.h"
-#include "ppapi/proxy/plugin_proxy_delegate.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/proxy_module.h"
-#include "ppapi/proxy/serialized_var.h"
-#include "ppapi/shared_impl/dir_contents.h"
-#include "ppapi/shared_impl/file_type_conversion.h"
-#include "ppapi/shared_impl/ppapi_globals.h"
-#include "ppapi/shared_impl/proxy_lock.h"
-#include "ppapi/shared_impl/resource.h"
-#include "ppapi/shared_impl/resource_tracker.h"
-#include "ppapi/shared_impl/scoped_pp_resource.h"
-#include "ppapi/shared_impl/time_conversion.h"
-#include "ppapi/shared_impl/var.h"
-#include "ppapi/shared_impl/var_tracker.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_instance_api.h"
-#include "ppapi/thunk/ppb_url_request_info_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
-
-using ppapi::thunk::EnterInstanceNoLock;
-using ppapi::thunk::EnterResourceNoLock;
-
-namespace ppapi {
-namespace proxy {
-
-namespace {
-
-// Returns true if |t1| and |t2| are times in the same minute.
-bool InSameMinute(PP_Time t1, PP_Time t2) {
-  return floor(t1 / 60.0) == floor(t2 / 60.0);
-}
-
-IPC::PlatformFileForTransit PlatformFileToPlatformFileForTransit(
-    Dispatcher* dispatcher,
-    int32_t* error,
-    base::PlatformFile file) {
-  if (*error != PP_OK)
-    return IPC::InvalidPlatformFileForTransit();
-  IPC::PlatformFileForTransit out_handle =
-      dispatcher->ShareHandleWithRemote(file, true);
-  if (out_handle == IPC::InvalidPlatformFileForTransit())
-    *error = PP_ERROR_NOACCESS;
-  return out_handle;
-}
-
-void InvokePrinting(PP_Instance instance) {
-  ProxyAutoLock lock;
-
-  PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
-  if (dispatcher) {
-    dispatcher->Send(new PpapiHostMsg_PPBFlash_InvokePrinting(
-        API_ID_PPB_FLASH, instance));
-  }
-}
-
-const PPB_Flash_Print_1_0 g_flash_print_interface = {
-  &InvokePrinting
-};
-
-}  // namespace
-
-// -----------------------------------------------------------------------------
-
-PPB_Flash_Proxy::PPB_Flash_Proxy(Dispatcher* dispatcher)
-    : InterfaceProxy(dispatcher) {
-}
-
-PPB_Flash_Proxy::~PPB_Flash_Proxy() {
-}
-
-// static
-const PPB_Flash_Print_1_0* PPB_Flash_Proxy::GetFlashPrintInterface() {
-  return &g_flash_print_interface;
-}
-
-bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) {
-  if (!dispatcher()->permissions().HasPermission(PERMISSION_FLASH))
-    return false;
-
-  bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP(PPB_Flash_Proxy, msg)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop,
-                        OnHostMsgSetInstanceAlwaysOnTop)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_DrawGlyphs,
-                        OnHostMsgDrawGlyphs)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetProxyForURL,
-                        OnHostMsgGetProxyForURL)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_Navigate, OnHostMsgNavigate)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_RunMessageLoop,
-                        OnHostMsgRunMessageLoop)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QuitMessageLoop,
-                        OnHostMsgQuitMessageLoop)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset,
-                        OnHostMsgGetLocalTimeZoneOffset)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_IsRectTopmost,
-                        OnHostMsgIsRectTopmost)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_FlashSetFullscreen,
-                        OnHostMsgFlashSetFullscreen)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_FlashGetScreenSize,
-                        OnHostMsgFlashGetScreenSize)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_OpenFileRef,
-                        OnHostMsgOpenFileRef)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QueryFileRef,
-                        OnHostMsgQueryFileRef)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetDeviceID,
-                        OnHostMsgGetDeviceID)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_InvokePrinting,
-                        OnHostMsgInvokePrinting)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetSetting,
-                        OnHostMsgGetSetting)
-    IPC_MESSAGE_UNHANDLED(handled = false)
-  IPC_END_MESSAGE_MAP()
-  // TODO(brettw) handle bad messages!
-  return handled;
-}
-
-void PPB_Flash_Proxy::SetInstanceAlwaysOnTop(PP_Instance instance,
-                                             PP_Bool on_top) {
-  dispatcher()->Send(new PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop(
-      API_ID_PPB_FLASH, instance, on_top));
-}
-
-PP_Bool PPB_Flash_Proxy::DrawGlyphs(PP_Instance instance,
-                                    PP_Resource pp_image_data,
-                                    const PP_FontDescription_Dev* font_desc,
-                                    uint32_t color,
-                                    const PP_Point* position,
-                                    const PP_Rect* clip,
-                                    const float transformation[3][3],
-                                    PP_Bool allow_subpixel_aa,
-                                    uint32_t glyph_count,
-                                    const uint16_t glyph_indices[],
-                                    const PP_Point glyph_advances[]) {
-  Resource* image_data =
-      PpapiGlobals::Get()->GetResourceTracker()->GetResource(pp_image_data);
-  if (!image_data)
-    return PP_FALSE;
-  // The instance parameter isn't strictly necessary but we check that it
-  // matches anyway.
-  if (image_data->pp_instance() != instance)
-    return PP_FALSE;
-
-  PPBFlash_DrawGlyphs_Params params;
-  params.image_data = image_data->host_resource();
-  params.font_desc.SetFromPPFontDescription(*font_desc);
-  params.color = color;
-  params.position = *position;
-  params.clip = *clip;
-  for (int i = 0; i < 3; i++) {
-    for (int j = 0; j < 3; j++)
-      params.transformation[i][j] = transformation[i][j];
-  }
-  params.allow_subpixel_aa = allow_subpixel_aa;
-
-  params.glyph_indices.insert(params.glyph_indices.begin(),
-                              &glyph_indices[0],
-                              &glyph_indices[glyph_count]);
-  params.glyph_advances.insert(params.glyph_advances.begin(),
-                               &glyph_advances[0],
-                               &glyph_advances[glyph_count]);
-
-  PP_Bool result = PP_FALSE;
-  dispatcher()->Send(new PpapiHostMsg_PPBFlash_DrawGlyphs(
-      API_ID_PPB_FLASH, instance, params, &result));
-  return result;
-}
-
-PP_Var PPB_Flash_Proxy::GetProxyForURL(PP_Instance instance, const char* url) {
-  ReceiveSerializedVarReturnValue result;
-  dispatcher()->Send(new PpapiHostMsg_PPBFlash_GetProxyForURL(
-      API_ID_PPB_FLASH, instance, url, &result));
-  return result.Return(dispatcher());
-}
-
-int32_t PPB_Flash_Proxy::Navigate(PP_Instance instance,
-                                  PP_Resource request_info,
-                                  const char* target,
-                                  PP_Bool from_user_action) {
-  thunk::EnterResourceNoLock<thunk::PPB_URLRequestInfo_API> enter(
-      request_info, true);
-  if (enter.failed())
-    return PP_ERROR_BADRESOURCE;
-  return Navigate(instance, enter.object()->GetData(), target,
-                  from_user_action);
-}
-
-int32_t PPB_Flash_Proxy::Navigate(PP_Instance instance,
-                                  const URLRequestInfoData& data,
-                                  const char* target,
-                                  PP_Bool from_user_action) {
-  int32_t result = PP_ERROR_FAILED;
-  dispatcher()->Send(new PpapiHostMsg_PPBFlash_Navigate(
-      API_ID_PPB_FLASH, instance, data, target, from_user_action, &result));
-  return result;
-}
-
-void PPB_Flash_Proxy::RunMessageLoop(PP_Instance instance) {
-  IPC::SyncMessage* msg = new PpapiHostMsg_PPBFlash_RunMessageLoop(
-      API_ID_PPB_FLASH, instance);
-  msg->EnableMessagePumping();
-  dispatcher()->Send(msg);
-}
-
-void PPB_Flash_Proxy::QuitMessageLoop(PP_Instance instance) {
-  dispatcher()->Send(new PpapiHostMsg_PPBFlash_QuitMessageLoop(
-      API_ID_PPB_FLASH, instance));
-}
-
-double PPB_Flash_Proxy::GetLocalTimeZoneOffset(PP_Instance instance,
-                                               PP_Time t) {
-  static double s_cached_t = 0.0;
-  static double s_cached_local_offset = 0.0;
-  static int64 s_last_updated = std::numeric_limits<int64>::min();
-
-  // Cache the local offset for ten seconds, since it's slow on XP and Linux.
-  const int64 kMaxCachedLocalOffsetAgeInSeconds = 10;
-  base::TimeTicks now = base::TimeTicks::Now();
-  base::TimeTicks expiration =
-      base::TimeTicks::FromInternalValue(s_last_updated) +
-      base::TimeDelta::FromSeconds(kMaxCachedLocalOffsetAgeInSeconds);
-  // Use cached offset if cache hasn't expired and |t| is in the same minute as
-  // the time for the cached offset (assume offsets change on minute
-  // boundaries).
-  if (now < expiration && InSameMinute(t, s_cached_t))
-    return s_cached_local_offset;
-
-  s_cached_t = t;
-  s_last_updated = now.ToInternalValue();
-  // TODO(shess): Figure out why OSX needs the access, the sandbox
-  // warmup should handle it.  http://crbug.com/149006
-#if defined(OS_LINUX) || defined(OS_MACOSX)
-  // On Linux localtime needs access to the filesystem, which is prohibited
-  // by the sandbox. It would be better to go directly to the browser process
-  // for this message rather than proxy it through some instance in a renderer.
-  dispatcher()->Send(new PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset(
-      API_ID_PPB_FLASH, instance, t, &s_cached_local_offset));
-#else
-  base::Time cur = PPTimeToTime(t);
-  base::Time::Exploded exploded = { 0 };
-  base::Time::Exploded utc_exploded = { 0 };
-  cur.LocalExplode(&exploded);
-  cur.UTCExplode(&utc_exploded);
-  if (exploded.HasValidValues() && utc_exploded.HasValidValues()) {
-    base::Time adj_time = base::Time::FromUTCExploded(exploded);
-    base::Time cur = base::Time::FromUTCExploded(utc_exploded);
-    s_cached_local_offset = (adj_time - cur).InSecondsF();
-  } else {
-    s_cached_local_offset = 0.0;
-  }
-#endif
-
-  return s_cached_local_offset;
-}
-
-PP_Bool PPB_Flash_Proxy::IsRectTopmost(PP_Instance instance,
-                                       const PP_Rect* rect) {
-  PP_Bool result = PP_FALSE;
-  dispatcher()->Send(new PpapiHostMsg_PPBFlash_IsRectTopmost(
-      API_ID_PPB_FLASH, instance, *rect, &result));
-  return result;
-}
-
-void PPB_Flash_Proxy::UpdateActivity(PP_Instance instance) {
-  PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
-      new PpapiHostMsg_PPBFlash_UpdateActivity(API_ID_PPB_FLASH));
-}
-
-PP_Var PPB_Flash_Proxy::GetDeviceID(PP_Instance instance) {
-  ReceiveSerializedVarReturnValue result;
-  dispatcher()->Send(new PpapiHostMsg_PPBFlash_GetDeviceID(
-      API_ID_PPB_FLASH, instance, &result));
-  return result.Return(dispatcher());
-}
-
-int32_t PPB_Flash_Proxy::GetSettingInt(PP_Instance instance,
-                                       PP_FlashSetting setting) {
-  // Note: Don't add support for any more settings here. This method is
-  // deprecated.
-  switch (setting) {
-    case PP_FLASHSETTING_3DENABLED:
-      return static_cast<PluginDispatcher*>(dispatcher())->preferences().
-          is_3d_supported;
-    case PP_FLASHSETTING_INCOGNITO:
-      return static_cast<PluginDispatcher*>(dispatcher())->incognito();
-    case PP_FLASHSETTING_STAGE3DENABLED:
-      return static_cast<PluginDispatcher*>(dispatcher())->preferences().
-          is_stage3d_supported;
-    default:
-      return -1;
-  }
-}
-
-PP_Var PPB_Flash_Proxy::GetSetting(PP_Instance instance,
-                                   PP_FlashSetting setting) {
-  PluginDispatcher* plugin_dispatcher =
-      static_cast<PluginDispatcher*>(dispatcher());
-  switch (setting) {
-    case PP_FLASHSETTING_3DENABLED:
-      return PP_MakeBool(PP_FromBool(
-          plugin_dispatcher->preferences().is_3d_supported));
-    case PP_FLASHSETTING_INCOGNITO:
-      return PP_MakeBool(PP_FromBool(plugin_dispatcher->incognito()));
-    case PP_FLASHSETTING_STAGE3DENABLED:
-      return PP_MakeBool(PP_FromBool(
-          plugin_dispatcher->preferences().is_stage3d_supported));
-    case PP_FLASHSETTING_LANGUAGE:
-      return StringVar::StringToPPVar(
-          PluginGlobals::Get()->plugin_proxy_delegate()->GetUILanguage());
-    case PP_FLASHSETTING_NUMCORES:
-      return PP_MakeInt32(plugin_dispatcher->preferences().number_of_cpu_cores);
-    case PP_FLASHSETTING_LSORESTRICTIONS: {
-      ReceiveSerializedVarReturnValue result;
-      dispatcher()->Send(new PpapiHostMsg_PPBFlash_GetSetting(
-          API_ID_PPB_FLASH, instance, setting, &result));
-      return result.Return(dispatcher());
-    }
-  }
-  return PP_MakeUndefined();
-}
-
-PP_Bool PPB_Flash_Proxy::SetCrashData(PP_Instance instance,
-                                      PP_FlashCrashKey key,
-                                      PP_Var value) {
-  switch (key) {
-    case PP_FLASHCRASHKEY_URL:
-      StringVar *url_string_var(StringVar::FromPPVar(value));
-      if (!url_string_var)
-        return PP_FALSE;
-      std::string url_string(url_string_var->value());
-      PluginGlobals::Get()->plugin_proxy_delegate()->SetActiveURL(url_string);
-      return PP_TRUE;
-  }
-  return PP_FALSE;
-}
-
-bool PPB_Flash_Proxy::CreateThreadAdapterForInstance(PP_Instance instance) {
-  return true;
-}
-
-void PPB_Flash_Proxy::ClearThreadAdapterForInstance(PP_Instance instance) {
-}
-
-int32_t PPB_Flash_Proxy::OpenFile(PP_Instance,
-                                  const char* path,
-                                  int32_t mode,
-                                  PP_FileHandle* file) {
-  int flags = 0;
-  if (!path ||
-      !ppapi::PepperFileOpenFlagsToPlatformFileFlags(mode, &flags) ||
-      !file)
-    return PP_ERROR_BADARGUMENT;
-
-  base::PlatformFileError error;
-  IPC::PlatformFileForTransit transit_file;
-  ppapi::PepperFilePath pepper_path(ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL,
-                                    FilePath::FromUTF8Unsafe(path));
-
-  if (PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
-          new PepperFileMsg_OpenFile(pepper_path, flags,
-                                     &error, &transit_file))) {
-    *file = IPC::PlatformFileForTransitToPlatformFile(transit_file);
-  } else {
-    *file = base::kInvalidPlatformFileValue;
-    error = base::PLATFORM_FILE_ERROR_FAILED;
-  }
-
-  return ppapi::PlatformFileErrorToPepperError(error);
-}
-
-int32_t PPB_Flash_Proxy::RenameFile(PP_Instance,
-                                    const char* from_path,
-                                    const char* to_path) {
-  base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
-  ppapi::PepperFilePath pepper_from(ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL,
-                                    FilePath::FromUTF8Unsafe(from_path));
-  ppapi::PepperFilePath pepper_to(ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL,
-                                  FilePath::FromUTF8Unsafe(to_path));
-
-  PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
-      new PepperFileMsg_RenameFile(pepper_from, pepper_to, &error));
-
-  return ppapi::PlatformFileErrorToPepperError(error);
-}
-
-int32_t PPB_Flash_Proxy::DeleteFileOrDir(PP_Instance,
-                                         const char* path,
-                                         PP_Bool recursive) {
-  base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
-  ppapi::PepperFilePath pepper_path(ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL,
-                                    FilePath::FromUTF8Unsafe(path));
-
-  PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
-      new PepperFileMsg_DeleteFileOrDir(pepper_path,
-                                        PP_ToBool(recursive),
-                                        &error));
-
-  return ppapi::PlatformFileErrorToPepperError(error);
-}
-
-int32_t PPB_Flash_Proxy::CreateDir(PP_Instance, const char* path) {
-  base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
-  ppapi::PepperFilePath pepper_path(ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL,
-                                    FilePath::FromUTF8Unsafe(path));
-
-  PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
-      new PepperFileMsg_CreateDir(pepper_path, &error));
-
-  return ppapi::PlatformFileErrorToPepperError(error);
-}
-
-int32_t PPB_Flash_Proxy::QueryFile(PP_Instance,
-                                   const char* path,
-                                   PP_FileInfo* info) {
-  base::PlatformFileInfo file_info;
-  base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
-  ppapi::PepperFilePath pepper_path(ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL,
-                                    FilePath::FromUTF8Unsafe(path));
-
-  PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
-      new PepperFileMsg_QueryFile(pepper_path, &file_info, &error));
-
-  if (error == base::PLATFORM_FILE_OK) {
-    info->size = file_info.size;
-    info->creation_time = TimeToPPTime(file_info.creation_time);
-    info->last_access_time = TimeToPPTime(file_info.last_accessed);
-    info->last_modified_time = TimeToPPTime(file_info.last_modified);
-    info->system_type = PP_FILESYSTEMTYPE_EXTERNAL;
-    if (file_info.is_directory)
-        info->type = PP_FILETYPE_DIRECTORY;
-    else
-      info->type = PP_FILETYPE_REGULAR;
-  }
-
-  return ppapi::PlatformFileErrorToPepperError(error);
-}
-
-int32_t PPB_Flash_Proxy::GetDirContents(PP_Instance,
-                                        const char* path,
-                                        PP_DirContents_Dev** contents) {
-  ppapi::DirContents entries;
-  base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
-  ppapi::PepperFilePath pepper_path(ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL,
-                                    FilePath::FromUTF8Unsafe(path));
-
-  PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
-      new PepperFileMsg_GetDirContents(pepper_path, &entries, &error));
-
-  if (error == base::PLATFORM_FILE_OK) {
-    // Copy the serialized dir entries to the output struct.
-    *contents = new PP_DirContents_Dev;
-    (*contents)->count = static_cast<int32_t>(entries.size());
-    (*contents)->entries = new PP_DirEntry_Dev[entries.size()];
-    for (size_t i = 0; i < entries.size(); i++) {
-      const ppapi::DirEntry& source = entries[i];
-      PP_DirEntry_Dev* dest = &(*contents)->entries[i];
-      std::string name = source.name.AsUTF8Unsafe();
-      char* name_copy = new char[name.size() + 1];
-      memcpy(name_copy, name.c_str(), name.size() + 1);
-      dest->name = name_copy;
-      dest->is_dir = PP_FromBool(source.is_dir);
-    }
-  }
-
-  return ppapi::PlatformFileErrorToPepperError(error);
-}
-
-int32_t PPB_Flash_Proxy::CreateTemporaryFile(PP_Instance instance,
-                                             PP_FileHandle* file) {
-  if (!file)
-    return PP_ERROR_BADARGUMENT;
-
-  base::PlatformFileError error;
-  IPC::PlatformFileForTransit transit_file;
-
-  if (PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
-          new PepperFileMsg_CreateTemporaryFile(&error, &transit_file))) {
-    *file = IPC::PlatformFileForTransitToPlatformFile(transit_file);
-  } else {
-    error = base::PLATFORM_FILE_ERROR_FAILED;
-    *file = base::kInvalidPlatformFileValue;
-  }
-
-  return ppapi::PlatformFileErrorToPepperError(error);
-}
-
-int32_t PPB_Flash_Proxy::OpenFileRef(PP_Instance instance,
-                                     PP_Resource file_ref_id,
-                                     int32_t mode,
-                                     PP_FileHandle* file) {
-  EnterResourceNoLock<thunk::PPB_FileRef_API> enter(file_ref_id, true);
-  if (enter.failed())
-    return PP_ERROR_BADRESOURCE;
-
-  int32_t result = PP_ERROR_FAILED;
-  IPC::PlatformFileForTransit transit;
-  dispatcher()->Send(new PpapiHostMsg_PPBFlash_OpenFileRef(
-      API_ID_PPB_FLASH, instance, enter.resource()->host_resource(), mode,
-      &transit, &result));
-  *file = IPC::PlatformFileForTransitToPlatformFile(transit);
-  return result;
-}
-
-int32_t PPB_Flash_Proxy::QueryFileRef(PP_Instance instance,
-                                      PP_Resource file_ref_id,
-                                      PP_FileInfo* info) {
-  EnterResourceNoLock<thunk::PPB_FileRef_API> enter(file_ref_id, true);
-  if (enter.failed())
-    return PP_ERROR_BADRESOURCE;
-
-  int32_t result = PP_ERROR_FAILED;
-  dispatcher()->Send(new PpapiHostMsg_PPBFlash_QueryFileRef(
-      API_ID_PPB_FLASH, instance, enter.resource()->host_resource(), info,
-      &result));
-  return result;
-}
-
-PP_Bool PPB_Flash_Proxy::FlashIsFullscreen(PP_Instance instance) {
-  InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
-      GetInstanceData(instance);
-  if (!data)
-    return PP_FALSE;
-  return data->flash_fullscreen;
-}
-
-PP_Bool PPB_Flash_Proxy::FlashSetFullscreen(PP_Instance instance,
-                                            PP_Bool fullscreen) {
-  PP_Bool result = PP_FALSE;
-  dispatcher()->Send(new PpapiHostMsg_PPBFlash_FlashSetFullscreen(
-      API_ID_PPB_FLASH, instance, fullscreen, &result));
-  return result;
-}
-
-PP_Bool PPB_Flash_Proxy::FlashGetScreenSize(PP_Instance instance,
-                                            PP_Size* size) {
-  PP_Bool result = PP_FALSE;
-  dispatcher()->Send(new PpapiHostMsg_PPBFlash_FlashGetScreenSize(
-      API_ID_PPB_FLASH, instance, &result, size));
-  return result;
-}
-
-void PPB_Flash_Proxy::OnHostMsgSetInstanceAlwaysOnTop(PP_Instance instance,
-                                                      PP_Bool on_top) {
-  EnterInstanceNoLock enter(instance);
-  if (enter.succeeded())
-    enter.functions()->GetFlashAPI()->SetInstanceAlwaysOnTop(instance, on_top);
-}
-
-void PPB_Flash_Proxy::OnHostMsgDrawGlyphs(
-    PP_Instance instance,
-    const PPBFlash_DrawGlyphs_Params& params,
-    PP_Bool* result) {
-  *result = PP_FALSE;
-  EnterInstanceNoLock enter(instance);
-  if (enter.failed())
-    return;
-
-  if (params.glyph_indices.size() != params.glyph_advances.size() ||
-      params.glyph_indices.empty())
-    return;
-
-  PP_FontDescription_Dev font_desc;
-  params.font_desc.SetToPPFontDescription(&font_desc);
-
-  *result = enter.functions()->GetFlashAPI()->DrawGlyphs(
-      0,  // Unused instance param.
-      params.image_data.host_resource(), &font_desc,
-      params.color, &params.position, &params.clip,
-      const_cast<float(*)[3]>(params.transformation),
-      params.allow_subpixel_aa,
-      static_cast<uint32_t>(params.glyph_indices.size()),
-      const_cast<uint16_t*>(&params.glyph_indices[0]),
-      const_cast<PP_Point*>(&params.glyph_advances[0]));
-
-  // SetToPPFontDescription() creates a var which is owned by the caller.
-  PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(font_desc.face);
-}
-
-void PPB_Flash_Proxy::OnHostMsgGetProxyForURL(PP_Instance instance,
-                                              const std::string& url,
-                                              SerializedVarReturnValue result) {
-  EnterInstanceNoLock enter(instance);
-  if (enter.succeeded()) {
-    result.Return(dispatcher(),
-                  enter.functions()->GetFlashAPI()->GetProxyForURL(
-                      instance, url.c_str()));
-  } else {
-    result.Return(dispatcher(), PP_MakeUndefined());
-  }
-}
-
-void PPB_Flash_Proxy::OnHostMsgNavigate(PP_Instance instance,
-                                        const URLRequestInfoData& data,
-                                        const std::string& target,
-                                        PP_Bool from_user_action,
-                                        int32_t* result) {
-  EnterInstanceNoLock enter_instance(instance);
-  if (enter_instance.failed()) {
-    *result = PP_ERROR_BADARGUMENT;
-    return;
-  }
-  DCHECK(!dispatcher()->IsPlugin());
-
-  // Validate the PP_Instance since we'll be constructing resources on its
-  // behalf.
-  HostDispatcher* host_dispatcher = static_cast<HostDispatcher*>(dispatcher());
-  if (HostDispatcher::GetForInstance(instance) != host_dispatcher) {
-    NOTREACHED();
-    *result = PP_ERROR_BADARGUMENT;
-    return;
-  }
-
-  // We need to allow re-entrancy here, because this may call into Javascript
-  // (e.g. with a "javascript:" URL), or do things like navigate away from the
-  // page, either one of which will need to re-enter into the plugin.
-  // It is safe, because it is essentially equivalent to NPN_GetURL, where Flash
-  // would expect re-entrancy. When running in-process, it does re-enter here.
-  host_dispatcher->set_allow_plugin_reentrancy();
-  *result = enter_instance.functions()->GetFlashAPI()->Navigate(
-      instance, data, target.c_str(), from_user_action);
-}
-
-void PPB_Flash_Proxy::OnHostMsgRunMessageLoop(PP_Instance instance) {
-  EnterInstanceNoLock enter(instance);
-  if (enter.succeeded())
-    enter.functions()->GetFlashAPI()->RunMessageLoop(instance);
-}
-
-void PPB_Flash_Proxy::OnHostMsgQuitMessageLoop(PP_Instance instance) {
-  EnterInstanceNoLock enter(instance);
-  if (enter.succeeded())
-    enter.functions()->GetFlashAPI()->QuitMessageLoop(instance);
-}
-
-void PPB_Flash_Proxy::OnHostMsgGetLocalTimeZoneOffset(PP_Instance instance,
-                                                  PP_Time t,
-                                                  double* result) {
-  EnterInstanceNoLock enter(instance);
-  if (enter.succeeded()) {
-    *result = enter.functions()->GetFlashAPI()->GetLocalTimeZoneOffset(
-        instance, t);
-  } else {
-    *result = 0.0;
-  }
-}
-
-void PPB_Flash_Proxy::OnHostMsgIsRectTopmost(PP_Instance instance,
-                                             PP_Rect rect,
-                                             PP_Bool* result) {
-  EnterInstanceNoLock enter(instance);
-  if (enter.succeeded())
-    *result = enter.functions()->GetFlashAPI()->IsRectTopmost(instance, &rect);
-  else
-    *result = PP_FALSE;
-}
-
-void PPB_Flash_Proxy::OnHostMsgFlashSetFullscreen(PP_Instance instance,
-                                                  PP_Bool fullscreen,
-                                                  PP_Bool* result) {
-  EnterInstanceNoLock enter(instance);
-  if (enter.succeeded()) {
-    *result = enter.functions()->GetFlashAPI()->FlashSetFullscreen(
-        instance, fullscreen);
-  } else {
-    *result = PP_FALSE;
-  }
-}
-
-void PPB_Flash_Proxy::OnHostMsgFlashGetScreenSize(PP_Instance instance,
-                                                  PP_Bool* result,
-                                                  PP_Size* size) {
-  EnterInstanceNoLock enter(instance);
-  if (enter.succeeded()) {
-    *result = enter.functions()->GetFlashAPI()->FlashGetScreenSize(
-        instance, size);
-  } else {
-    size->width = 0;
-    size->height = 0;
-  }
-}
-
-void PPB_Flash_Proxy::OnHostMsgOpenFileRef(
-    PP_Instance instance,
-    const HostResource& host_resource,
-    int32_t mode,
-    IPC::PlatformFileForTransit* file_handle,
-    int32_t* result) {
-  EnterInstanceNoLock enter(instance);
-  if (enter.failed()) {
-    *result = PP_ERROR_BADARGUMENT;
-    return;
-  }
-
-  base::PlatformFile file;
-  *result = enter.functions()->GetFlashAPI()->OpenFileRef(
-      instance, host_resource.host_resource(), mode, &file);
-  *file_handle = PlatformFileToPlatformFileForTransit(dispatcher(),
-                                                      result, file);
-}
-
-void PPB_Flash_Proxy::OnHostMsgQueryFileRef(
-    PP_Instance instance,
-    const HostResource& host_resource,
-    PP_FileInfo* info,
-    int32_t* result) {
-  EnterInstanceNoLock enter(instance);
-  if (enter.failed()) {
-    *result = PP_ERROR_BADARGUMENT;
-    return;
-  }
-  *result = enter.functions()->GetFlashAPI()->QueryFileRef(
-      instance, host_resource.host_resource(), info);
-}
-
-void PPB_Flash_Proxy::OnHostMsgGetSetting(PP_Instance instance,
-                                          PP_FlashSetting setting,
-                                          SerializedVarReturnValue id) {
-  EnterInstanceNoLock enter(instance);
-  if (enter.succeeded()) {
-    id.Return(dispatcher(),
-              enter.functions()->GetFlashAPI()->GetSetting(
-                  instance, setting));
-  } else {
-    id.Return(dispatcher(), PP_MakeUndefined());
-  }
-}
-
-void PPB_Flash_Proxy::OnHostMsgGetDeviceID(PP_Instance instance,
-                                           SerializedVarReturnValue id) {
-  EnterInstanceNoLock enter(instance);
-  if (enter.succeeded()) {
-    id.Return(dispatcher(),
-                  enter.functions()->GetFlashAPI()->GetDeviceID(
-                      instance));
-  } else {
-    id.Return(dispatcher(), PP_MakeUndefined());
-  }
-}
-
-void PPB_Flash_Proxy::OnHostMsgInvokePrinting(PP_Instance instance) {
-  // This function is actually implemented in the PPB_Flash_Print interface.
-  // It's rarely used enough that we just request this interface when needed.
-  const PPB_Flash_Print_1_0* print_interface =
-      static_cast<const PPB_Flash_Print_1_0*>(
-          dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0));
-  if (print_interface)
-    print_interface->InvokePrinting(instance);
-}
-
-}  // namespace proxy
-}  // namespace ppapi
diff --git a/ppapi/proxy/ppb_flash_proxy.h b/ppapi/proxy/ppb_flash_proxy.h
deleted file mode 100644
index 09728ef..0000000
--- a/ppapi/proxy/ppb_flash_proxy.h
+++ /dev/null
@@ -1,177 +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 PPAPI_PROXY_PPB_FLASH_PROXY_H_
-#define PPAPI_PROXY_PPB_FLASH_PROXY_H_
-
-#include <string>
-#include <vector>
-
-#include "base/compiler_specific.h"
-#include "ipc/ipc_platform_file.h"
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_time.h"
-#include "ppapi/c/private/ppb_flash.h"
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/proxy/serialized_var.h"
-#include "ppapi/shared_impl/host_resource.h"
-#include "ppapi/shared_impl/ppb_flash_shared.h"
-
-struct PPB_Flash_Print_1_0;
-
-namespace ppapi {
-
-struct URLRequestInfoData;
-
-namespace proxy {
-
-struct PPBFlash_DrawGlyphs_Params;
-struct SerializedDirEntry;
-class SerializedVarReturnValue;
-
-/////////////////////////// WARNING:DEPRECTATED ////////////////////////////////
-// Please do not add any new functions to this proxy. They should be
-// implemented in the new-style resource proxy (see flash_resource.h).
-// TODO(raymes): All of these functions should be moved to the new-style proxy.
-////////////////////////////////////////////////////////////////////////////////
-class PPB_Flash_Proxy : public InterfaceProxy, public PPB_Flash_Shared {
- public:
-  explicit PPB_Flash_Proxy(Dispatcher* dispatcher);
-  virtual ~PPB_Flash_Proxy();
-
-  // This flash proxy also proxies the PPB_Flash_Print interface. This one
-  // doesn't use the regular thunk system because the _impl side is actually in
-  // Chrome rather than with the rest of the interface implementations.
-  static const PPB_Flash_Print_1_0* GetFlashPrintInterface();
-
-  // InterfaceProxy implementation.
-  virtual bool OnMessageReceived(const IPC::Message& msg);
-
-  // PPB_Flash_API implementation.
-  virtual void SetInstanceAlwaysOnTop(PP_Instance instance,
-                                      PP_Bool on_top) OVERRIDE;
-  virtual PP_Bool DrawGlyphs(PP_Instance instance,
-                             PP_Resource pp_image_data,
-                             const PP_FontDescription_Dev* font_desc,
-                             uint32_t color,
-                             const PP_Point* position,
-                             const PP_Rect* clip,
-                             const float transformation[3][3],
-                             PP_Bool allow_subpixel_aa,
-                             uint32_t glyph_count,
-                             const uint16_t glyph_indices[],
-                             const PP_Point glyph_advances[]) OVERRIDE;
-  virtual PP_Var GetProxyForURL(PP_Instance instance, const char* url) OVERRIDE;
-  virtual int32_t Navigate(PP_Instance instance,
-                           PP_Resource request_info,
-                           const char* target,
-                           PP_Bool from_user_action) OVERRIDE;
-  virtual int32_t Navigate(PP_Instance instance,
-                           const URLRequestInfoData& data,
-                           const char* target,
-                           PP_Bool from_user_action) OVERRIDE;
-  virtual void RunMessageLoop(PP_Instance instance) OVERRIDE;
-  virtual void QuitMessageLoop(PP_Instance instance) OVERRIDE;
-  virtual double GetLocalTimeZoneOffset(PP_Instance instance,
-                                        PP_Time t) OVERRIDE;
-  virtual PP_Bool IsRectTopmost(PP_Instance instance,
-                                const PP_Rect* rect) OVERRIDE;
-  virtual void UpdateActivity(PP_Instance instance) OVERRIDE;
-  virtual PP_Var GetDeviceID(PP_Instance instance) OVERRIDE;
-  virtual int32_t GetSettingInt(PP_Instance instance,
-                                PP_FlashSetting setting) OVERRIDE;
-  virtual PP_Var GetSetting(PP_Instance instance,
-                            PP_FlashSetting setting) OVERRIDE;
-  virtual PP_Bool SetCrashData(PP_Instance instance,
-                               PP_FlashCrashKey key,
-                               PP_Var value) OVERRIDE;
-  virtual bool CreateThreadAdapterForInstance(PP_Instance instance) OVERRIDE;
-  virtual void ClearThreadAdapterForInstance(PP_Instance instance) OVERRIDE;
-  virtual int32_t OpenFile(PP_Instance instance,
-                           const char* path,
-                           int32_t mode,
-                           PP_FileHandle* file) OVERRIDE;
-  virtual int32_t RenameFile(PP_Instance instance,
-                             const char* path_from,
-                             const char* path_to) OVERRIDE;
-  virtual int32_t DeleteFileOrDir(PP_Instance instance,
-                                  const char* path,
-                                  PP_Bool recursive) OVERRIDE;
-  virtual int32_t CreateDir(PP_Instance instance, const char* path) OVERRIDE;
-  virtual int32_t QueryFile(PP_Instance instance,
-                            const char* path,
-                            PP_FileInfo* info) OVERRIDE;
-  virtual int32_t GetDirContents(PP_Instance instance,
-                                 const char* path,
-                                 PP_DirContents_Dev** contents) OVERRIDE;
-  virtual int32_t CreateTemporaryFile(PP_Instance instance,
-                                      PP_FileHandle* file) OVERRIDE;
-  virtual int32_t OpenFileRef(PP_Instance instance,
-                              PP_Resource file_ref,
-                              int32_t mode,
-                              PP_FileHandle* file) OVERRIDE;
-  virtual int32_t QueryFileRef(PP_Instance instance,
-                               PP_Resource file_ref,
-                               PP_FileInfo* info) OVERRIDE;
-  virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE;
-  virtual PP_Bool FlashSetFullscreen(PP_Instance instance,
-                                     PP_Bool fullscreen) OVERRIDE;
-  virtual PP_Bool FlashGetScreenSize(PP_Instance instance,
-                                     PP_Size* size) OVERRIDE;
-
-  static const ApiID kApiID = API_ID_PPB_FLASH;
-
- private:
-  // Message handlers.
-  void OnHostMsgSetInstanceAlwaysOnTop(PP_Instance instance,
-                                       PP_Bool on_top);
-  void OnHostMsgDrawGlyphs(PP_Instance instance,
-                           const PPBFlash_DrawGlyphs_Params& params,
-                           PP_Bool* result);
-  void OnHostMsgGetProxyForURL(PP_Instance instance,
-                               const std::string& url,
-                               SerializedVarReturnValue result);
-  void OnHostMsgNavigate(PP_Instance instance,
-                         const URLRequestInfoData& data,
-                         const std::string& target,
-                         PP_Bool from_user_action,
-                         int32_t* result);
-  void OnHostMsgRunMessageLoop(PP_Instance instance);
-  void OnHostMsgQuitMessageLoop(PP_Instance instance);
-  void OnHostMsgGetLocalTimeZoneOffset(PP_Instance instance, PP_Time t,
-                                       double* result);
-  void OnHostMsgIsRectTopmost(PP_Instance instance,
-                              PP_Rect rect,
-                              PP_Bool* result);
-  void OnHostMsgFlashSetFullscreen(PP_Instance instance,
-                                   PP_Bool fullscreen,
-                                   PP_Bool* result);
-  void OnHostMsgFlashGetScreenSize(PP_Instance instance,
-                                   PP_Bool* result,
-                                   PP_Size* size);
-  void OnHostMsgOpenFileRef(PP_Instance instance,
-                            const ppapi::HostResource& host_resource,
-                            int32_t mode,
-                            IPC::PlatformFileForTransit* file_handle,
-                            int32_t* result);
-  void OnHostMsgQueryFileRef(PP_Instance instance,
-                             const ppapi::HostResource& host_resource,
-                             PP_FileInfo* info,
-                             int32_t* result);
-  void OnHostMsgGetDeviceID(PP_Instance instance,
-                            SerializedVarReturnValue id);
-  void OnHostMsgGetSetting(PP_Instance instance,
-                           PP_FlashSetting setting,
-                           SerializedVarReturnValue result);
-  void OnHostMsgInvokePrinting(PP_Instance instance);
-
-  DISALLOW_COPY_AND_ASSIGN(PPB_Flash_Proxy);
-};
-
-}  // namespace proxy
-}  // namespace ppapi
-
-#endif  // PPAPI_PROXY_PPB_FLASH_PROXY_H_
diff --git a/ppapi/proxy/ppb_graphics_2d_proxy.cc b/ppapi/proxy/ppb_graphics_2d_proxy.cc
deleted file mode 100644
index 23c90fc..0000000
--- a/ppapi/proxy/ppb_graphics_2d_proxy.cc
+++ /dev/null
@@ -1,309 +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 "ppapi/proxy/ppb_graphics_2d_proxy.h"
-
-#include <string.h>  // For memset.
-
-#include "base/compiler_specific.h"
-#include "base/logging.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/ppb_graphics_2d.h"
-#include "ppapi/proxy/enter_proxy.h"
-#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/plugin_resource_tracker.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/ppb_image_data_proxy.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_graphics_2d_api.h"
-#include "ppapi/thunk/thunk.h"
-
-using ppapi::thunk::PPB_Graphics2D_API;
-
-namespace ppapi {
-namespace proxy {
-
-class Graphics2D : public Resource, public thunk::PPB_Graphics2D_API {
- public:
-  Graphics2D(const HostResource& host_resource,
-             const PP_Size& size,
-             PP_Bool is_always_opaque);
-  virtual ~Graphics2D();
-
-  // Resource.
-  virtual PPB_Graphics2D_API* AsPPB_Graphics2D_API();
-
-  // PPB_Graphics_2D_API.
-  PP_Bool Describe(PP_Size* size, PP_Bool* is_always_opaque);
-  void PaintImageData(PP_Resource image_data,
-                      const PP_Point* top_left,
-                      const PP_Rect* src_rect);
-  void Scroll(const PP_Rect* clip_rect,
-              const PP_Point* amount);
-  void ReplaceContents(PP_Resource image_data);
-  bool SetScale(float scale);
-  float GetScale();
-  int32_t Flush(scoped_refptr<TrackedCallback> callback,
-                PP_Resource* old_image_data);
-
-  // Notification that the host has sent an ACK for a pending Flush.
-  void FlushACK(int32_t result_code);
-
- private:
-  PluginDispatcher* GetDispatcher() const {
-    return PluginDispatcher::GetForResource(this);
-  }
-
-  static const ApiID kApiID = API_ID_PPB_GRAPHICS_2D;
-
-  PP_Size size_;
-  PP_Bool is_always_opaque_;
-  float scale_;
-
-  // In the plugin, this is the current callback set for Flushes. When the
-  // callback is pending, we're waiting for a flush ACK.
-  scoped_refptr<TrackedCallback> current_flush_callback_;
-
-  DISALLOW_COPY_AND_ASSIGN(Graphics2D);
-};
-
-Graphics2D::Graphics2D(const HostResource& host_resource,
-                       const PP_Size& size,
-                       PP_Bool is_always_opaque)
-    : Resource(OBJECT_IS_PROXY, host_resource),
-      size_(size),
-      is_always_opaque_(is_always_opaque),
-      scale_(1.0f) {
-}
-
-Graphics2D::~Graphics2D() {
-}
-
-PPB_Graphics2D_API* Graphics2D::AsPPB_Graphics2D_API() {
-  return this;
-}
-
-PP_Bool Graphics2D::Describe(PP_Size* size, PP_Bool* is_always_opaque) {
-  *size = size_;
-  *is_always_opaque = is_always_opaque_;
-  return PP_TRUE;
-}
-
-void Graphics2D::PaintImageData(PP_Resource image_data,
-                                const PP_Point* top_left,
-                                const PP_Rect* src_rect) {
-  Resource* image_object =
-      PpapiGlobals::Get()->GetResourceTracker()->GetResource(image_data);
-  if (!image_object || pp_instance() != image_object->pp_instance()) {
-    Log(PP_LOGLEVEL_ERROR,
-        "PPB_Graphics2D.PaintImageData: Bad image resource.");
-    return;
-  }
-
-  PP_Rect dummy;
-  memset(&dummy, 0, sizeof(PP_Rect));
-  GetDispatcher()->Send(new PpapiHostMsg_PPBGraphics2D_PaintImageData(
-      kApiID, host_resource(), image_object->host_resource(), *top_left,
-      !!src_rect, src_rect ? *src_rect : dummy));
-}
-
-void Graphics2D::Scroll(const PP_Rect* clip_rect,
-                        const PP_Point* amount) {
-  PP_Rect dummy;
-  memset(&dummy, 0, sizeof(PP_Rect));
-  GetDispatcher()->Send(new PpapiHostMsg_PPBGraphics2D_Scroll(
-      kApiID, host_resource(), !!clip_rect, clip_rect ? *clip_rect : dummy,
-      *amount));
-}
-
-void Graphics2D::ReplaceContents(PP_Resource image_data) {
-  thunk::EnterResourceNoLock<thunk::PPB_ImageData_API> enter_image(
-      image_data, true);
-  if (enter_image.failed())
-    return;
-
-  ImageData* image_object = static_cast<ImageData*>(enter_image.object());
-  if (pp_instance() != image_object->pp_instance()) {
-    Log(PP_LOGLEVEL_ERROR,
-        "PPB_Graphics2D.ReplaceContents: Image resource for another instance.");
-    return;
-  }
-  image_object->set_used_in_replace_contents();
-
-  GetDispatcher()->Send(new PpapiHostMsg_PPBGraphics2D_ReplaceContents(
-      kApiID, host_resource(), image_object->host_resource()));
-}
-
-bool Graphics2D::SetScale(float scale) {
-  if (scale <= 0.0f)
-    return false;
-  GetDispatcher()->Send(new PpapiHostMsg_PPBGraphics2D_Dev_SetScale(
-      kApiID, host_resource(), scale));
-  scale_ = scale;
-  return true;
-}
-
-float Graphics2D::GetScale() {
-  return scale_;
-}
-
-int32_t Graphics2D::Flush(scoped_refptr<TrackedCallback> callback,
-                          PP_Resource* old_image_data) {
-  // We don't support this feature, it's for in-renderer only.
-  if (old_image_data)
-    *old_image_data = 0;
-
-  if (TrackedCallback::IsPending(current_flush_callback_))
-    return PP_ERROR_INPROGRESS;  // Can't have >1 flush pending.
-  current_flush_callback_ = callback;
-
-  GetDispatcher()->Send(new PpapiHostMsg_PPBGraphics2D_Flush(kApiID,
-                                                             host_resource()));
-  return PP_OK_COMPLETIONPENDING;
-}
-
-void Graphics2D::FlushACK(int32_t result_code) {
-  current_flush_callback_->Run(result_code);
-}
-
-PPB_Graphics2D_Proxy::PPB_Graphics2D_Proxy(Dispatcher* dispatcher)
-    : InterfaceProxy(dispatcher),
-      callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
-}
-
-PPB_Graphics2D_Proxy::~PPB_Graphics2D_Proxy() {
-}
-
-// static
-PP_Resource PPB_Graphics2D_Proxy::CreateProxyResource(
-    PP_Instance instance,
-    const PP_Size& size,
-    PP_Bool is_always_opaque) {
-  PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
-  if (!dispatcher)
-    return 0;
-
-  HostResource result;
-  dispatcher->Send(new PpapiHostMsg_PPBGraphics2D_Create(
-      kApiID, instance, size, is_always_opaque, &result));
-  if (result.is_null())
-    return 0;
-  return (new Graphics2D(result, size, is_always_opaque))->GetReference();
-}
-
-bool PPB_Graphics2D_Proxy::OnMessageReceived(const IPC::Message& msg) {
-  bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP(PPB_Graphics2D_Proxy, msg)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_Create,
-                        OnHostMsgCreate)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_PaintImageData,
-                        OnHostMsgPaintImageData)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_Scroll,
-                        OnHostMsgScroll)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_ReplaceContents,
-                        OnHostMsgReplaceContents)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_Flush,
-                        OnHostMsgFlush)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_Dev_SetScale,
-                        OnHostMsgSetScale)
-
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPBGraphics2D_FlushACK,
-                        OnPluginMsgFlushACK)
-    IPC_MESSAGE_UNHANDLED(handled = false)
-  IPC_END_MESSAGE_MAP()
-  // FIXME(brettw) handle bad messages!
-  return handled;
-}
-
-void PPB_Graphics2D_Proxy::OnHostMsgCreate(PP_Instance instance,
-                                           const PP_Size& size,
-                                           PP_Bool is_always_opaque,
-                                           HostResource* result) {
-  thunk::EnterResourceCreation enter(instance);
-  if (enter.succeeded()) {
-    result->SetHostResource(instance, enter.functions()->CreateGraphics2D(
-        instance, size, is_always_opaque));
-  }
-}
-
-void PPB_Graphics2D_Proxy::OnHostMsgPaintImageData(
-    const HostResource& graphics_2d,
-    const HostResource& image_data,
-    const PP_Point& top_left,
-    bool src_rect_specified,
-    const PP_Rect& src_rect) {
-  EnterHostFromHostResource<PPB_Graphics2D_API> enter(graphics_2d);
-  if (enter.failed())
-    return;
-  enter.object()->PaintImageData(image_data.host_resource(), &top_left,
-      src_rect_specified ? &src_rect : NULL);
-}
-
-void PPB_Graphics2D_Proxy::OnHostMsgScroll(const HostResource& graphics_2d,
-                                           bool clip_specified,
-                                           const PP_Rect& clip,
-                                           const PP_Point& amount) {
-  EnterHostFromHostResource<PPB_Graphics2D_API> enter(graphics_2d);
-  if (enter.failed())
-    return;
-  enter.object()->Scroll(clip_specified ? &clip : NULL, &amount);
-}
-
-void PPB_Graphics2D_Proxy::OnHostMsgReplaceContents(
-    const HostResource& graphics_2d,
-    const HostResource& image_data) {
-  EnterHostFromHostResource<PPB_Graphics2D_API> enter(graphics_2d);
-  if (enter.failed())
-    return;
-  enter.object()->ReplaceContents(image_data.host_resource());
-}
-
-void PPB_Graphics2D_Proxy::OnHostMsgFlush(const HostResource& graphics_2d) {
-  EnterHostFromHostResourceForceCallback<PPB_Graphics2D_API> enter(
-      graphics_2d, callback_factory_,
-      &PPB_Graphics2D_Proxy::SendFlushACKToPlugin, graphics_2d);
-  if (enter.failed())
-    return;
-  PP_Resource old_image_data = 0;
-  enter.SetResult(enter.object()->Flush(enter.callback(), &old_image_data));
-  if (old_image_data) {
-    // If the Graphics2D has an old image data it's not using any more, send
-    // it back to the plugin for possible re-use. See ppb_image_data_proxy.cc
-    // for a description how this process works.
-    HostResource old_image_data_host_resource;
-    old_image_data_host_resource.SetHostResource(graphics_2d.instance(),
-                                                 old_image_data);
-    dispatcher()->Send(new PpapiMsg_PPBImageData_NotifyUnusedImageData(
-        API_ID_PPB_IMAGE_DATA, old_image_data_host_resource));
-  }
-}
-
-void PPB_Graphics2D_Proxy::OnHostMsgSetScale(const HostResource& graphics_2d,
-                                             float scale) {
-  EnterHostFromHostResource<PPB_Graphics2D_API> enter(graphics_2d);
-  if (enter.failed())
-    return;
-  enter.object()->SetScale(scale);
-}
-
-void PPB_Graphics2D_Proxy::OnPluginMsgFlushACK(
-    const HostResource& host_resource,
-    int32_t pp_error) {
-  EnterPluginFromHostResource<PPB_Graphics2D_API> enter(host_resource);
-  if (enter.succeeded())
-    static_cast<Graphics2D*>(enter.object())->FlushACK(pp_error);
-}
-
-void PPB_Graphics2D_Proxy::SendFlushACKToPlugin(
-    int32_t result,
-    const HostResource& graphics_2d) {
-  dispatcher()->Send(new PpapiMsg_PPBGraphics2D_FlushACK(kApiID, graphics_2d,
-                                                         result));
-}
-
-}  // namespace proxy
-}  // namespace ppapi
diff --git a/ppapi/proxy/ppb_graphics_2d_proxy.h b/ppapi/proxy/ppb_graphics_2d_proxy.h
deleted file mode 100644
index cf0a921..0000000
--- a/ppapi/proxy/ppb_graphics_2d_proxy.h
+++ /dev/null
@@ -1,77 +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 PPAPI_PPB_GRAPHICS_2D_PROXY_H_
-#define PPAPI_PPB_GRAPHICS_2D_PROXY_H_
-
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_size.h"
-#include "ppapi/c/pp_var.h"
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/proxy/proxy_completion_callback_factory.h"
-#include "ppapi/shared_impl/host_resource.h"
-#include "ppapi/utility/completion_callback_factory.h"
-
-struct PP_Point;
-struct PP_Rect;
-
-namespace ppapi {
-namespace proxy {
-
-class PPB_Graphics2D_Proxy : public InterfaceProxy {
- public:
-  PPB_Graphics2D_Proxy(Dispatcher* dispatcher);
-  virtual ~PPB_Graphics2D_Proxy();
-
-  static PP_Resource CreateProxyResource(PP_Instance instance,
-                                         const PP_Size& size,
-                                         PP_Bool is_always_opaque);
-
-  // InterfaceProxy implementation.
-  virtual bool OnMessageReceived(const IPC::Message& msg);
-
-  static const ApiID kApiID = API_ID_PPB_GRAPHICS_2D;
-
- private:
-  // Plugin->host message handlers.
-  void OnHostMsgCreate(PP_Instance instance,
-                       const PP_Size& size,
-                       PP_Bool is_always_opaque,
-                       HostResource* result);
-  void OnHostMsgPaintImageData(const HostResource& graphics_2d,
-                               const HostResource& image_data,
-                               const PP_Point& top_left,
-                               bool src_rect_specified,
-                               const PP_Rect& src_rect);
-  void OnHostMsgScroll(const HostResource& graphics_2d,
-                       bool clip_specified,
-                       const PP_Rect& clip,
-                       const PP_Point& amount);
-  void OnHostMsgReplaceContents(const HostResource& graphics_2d,
-                                const HostResource& image_data);
-  void OnHostMsgFlush(const HostResource& graphics_2d);
-  void OnHostMsgSetScale(const HostResource& graphics_2d,
-                         float scale);
-
-  // Host->plugin message handlers.
-  void OnPluginMsgFlushACK(const HostResource& graphics_2d,
-                           int32_t pp_error);
-
-  // Called in the renderer to send the given flush ACK to the plugin.
-  void SendFlushACKToPlugin(int32_t result,
-                            const HostResource& graphics_2d);
-
-  ProxyCompletionCallbackFactory<PPB_Graphics2D_Proxy> callback_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(PPB_Graphics2D_Proxy);
-};
-
-}  // namespace proxy
-}  // namespace ppapi
-
-#endif  // PPAPI_PPB_GRAPHICS_2D_PROXY_H_
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.cc b/ppapi/proxy/ppb_graphics_3d_proxy.cc
index 9d2ecd6..11db5a1 100644
--- a/ppapi/proxy/ppb_graphics_3d_proxy.cc
+++ b/ppapi/proxy/ppb_graphics_3d_proxy.cc
@@ -130,6 +130,9 @@
     // MaybeLock lock(need_to_lock_);
     return gpu_command_buffer_->GetLastState();
   }
+  virtual int32 GetLastToken() OVERRIDE {
+    return GetLastState().token;
+  }
   virtual void Flush(int32 put_offset) OVERRIDE {
     MaybeLock lock(need_to_lock_);
     gpu_command_buffer_->Flush(put_offset);
@@ -146,24 +149,18 @@
     MaybeLock lock(need_to_lock_);
     gpu_command_buffer_->SetGetOffset(get_offset);
   }
-  virtual int32 CreateTransferBuffer(size_t size, int32 id_request) OVERRIDE {
+  virtual gpu::Buffer CreateTransferBuffer(size_t size,
+                                           int32* id) OVERRIDE {
     MaybeLock lock(need_to_lock_);
-    return gpu_command_buffer_->CreateTransferBuffer(size, id_request);
-  }
-  virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory,
-                                       size_t size,
-                                       int32 id_request) OVERRIDE {
-    MaybeLock lock(need_to_lock_);
-    return gpu_command_buffer_->RegisterTransferBuffer(shared_memory, size,
-        id_request);
+    return gpu_command_buffer_->CreateTransferBuffer(size, id);
   }
   virtual void DestroyTransferBuffer(int32 id) OVERRIDE {
     MaybeLock lock(need_to_lock_);
     gpu_command_buffer_->DestroyTransferBuffer(id);
   }
-  virtual gpu::Buffer GetTransferBuffer(int32 handle) OVERRIDE {
+  virtual gpu::Buffer GetTransferBuffer(int32 id) OVERRIDE {
     MaybeLock lock(need_to_lock_);
-    return gpu_command_buffer_->GetTransferBuffer(handle);
+    return gpu_command_buffer_->GetTransferBuffer(id);
   }
   virtual void SetToken(int32 token) OVERRIDE {
     MaybeLock lock(need_to_lock_);
@@ -178,6 +175,10 @@
     MaybeLock lock(need_to_lock_);
     gpu_command_buffer_->SetContextLostReason(reason);
   }
+  virtual uint32 InsertSyncPoint() OVERRIDE {
+    MaybeLock lock(need_to_lock_);
+    return gpu_command_buffer_->InsertSyncPoint();
+  }
 
   // Weak pointer - see class Graphics3D for the scopted_ptr.
   gpu::CommandBuffer* gpu_command_buffer_;
@@ -251,6 +252,11 @@
   return GetErrorState();
 }
 
+uint32_t Graphics3D::InsertSyncPoint() {
+  NOTREACHED();
+  return 0;
+}
+
 gpu::CommandBuffer* Graphics3D::GetCommandBuffer() {
   return locking_command_buffer_.get();
 }
@@ -342,6 +348,7 @@
 bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) {
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPB_Graphics3D_Proxy, msg)
+#if !defined(OS_NACL)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_Create,
                         OnMsgCreate)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_InitCommandBuffer,
@@ -362,6 +369,9 @@
                         OnMsgGetTransferBuffer)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SwapBuffers,
                         OnMsgSwapBuffers)
+    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_InsertSyncPoint,
+                        OnMsgInsertSyncPoint)
+#endif  // !defined(OS_NACL)
 
     IPC_MESSAGE_HANDLER(PpapiMsg_PPBGraphics3D_SwapBuffersACK,
                         OnMsgSwapBuffersACK)
@@ -372,11 +382,14 @@
   return handled;
 }
 
+#if !defined(OS_NACL)
 void PPB_Graphics3D_Proxy::OnMsgCreate(PP_Instance instance,
                                        HostResource share_context,
                                        const std::vector<int32_t>& attribs,
                                        HostResource* result) {
-  if (attribs.empty() || attribs.back() != PP_GRAPHICS3DATTRIB_NONE)
+  if (attribs.empty() ||
+      attribs.back() != PP_GRAPHICS3DATTRIB_NONE ||
+      !(attribs.size() & 1))
     return;  // Bad message.
 
   thunk::EnterResourceCreation enter(instance);
@@ -446,13 +459,13 @@
 
 void PPB_Graphics3D_Proxy::OnMsgCreateTransferBuffer(
     const HostResource& context,
-    int32 size,
+    uint32 size,
     int32* id) {
   EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
   if (enter.succeeded())
     *id = enter.object()->CreateTransferBuffer(size);
   else
-    *id = 0;
+    *id = -1;
 }
 
 void PPB_Graphics3D_Proxy::OnMsgDestroyTransferBuffer(
@@ -488,6 +501,15 @@
     enter.SetResult(enter.object()->SwapBuffers(enter.callback()));
 }
 
+void PPB_Graphics3D_Proxy::OnMsgInsertSyncPoint(const HostResource& context,
+                                                uint32* sync_point) {
+  *sync_point = 0;
+  EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
+  if (enter.succeeded())
+    *sync_point = enter.object()->InsertSyncPoint();
+}
+#endif  // !defined(OS_NACL)
+
 void PPB_Graphics3D_Proxy::OnMsgSwapBuffersACK(const HostResource& resource,
                                               int32_t pp_error) {
   EnterPluginFromHostResource<PPB_Graphics3D_API> enter(resource);
@@ -495,12 +517,14 @@
     static_cast<Graphics3D*>(enter.object())->SwapBuffersACK(pp_error);
 }
 
+#if !defined(OS_NACL)
 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin(
     int32_t result,
     const HostResource& context) {
   dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK(
       API_ID_PPB_GRAPHICS_3D, context, result));
 }
+#endif  // !defined(OS_NACL)
 
 }  // namespace proxy
 }  // namespace ppapi
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.h b/ppapi/proxy/ppb_graphics_3d_proxy.h
index de6afd0..f07d2c4 100644
--- a/ppapi/proxy/ppb_graphics_3d_proxy.h
+++ b/ppapi/proxy/ppb_graphics_3d_proxy.h
@@ -13,7 +13,6 @@
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/proxy/interface_proxy.h"
 #include "ppapi/proxy/proxy_completion_callback_factory.h"
-#include "ppapi/proxy/serialized_structs.h"
 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h"
 #include "ppapi/shared_impl/resource.h"
 #include "ppapi/utility/completion_callback_factory.h"
@@ -24,6 +23,8 @@
 
 namespace proxy {
 
+class SerializedHandle;
+
 class Graphics3D : public PPB_Graphics3D_Shared {
  public:
   explicit Graphics3D(const HostResource& resource);
@@ -45,6 +46,7 @@
   virtual PP_Graphics3DTrustedState FlushSyncFast(
       int32_t put_offset,
       int32_t last_known_get) OVERRIDE;
+  virtual uint32_t InsertSyncPoint() OVERRIDE;
 
  private:
   class LockingCommandBuffer;
@@ -96,7 +98,7 @@
   void OnMsgAsyncFlush(const HostResource& context,
                        int32 put_offset);
   void OnMsgCreateTransferBuffer(const HostResource& context,
-                                 int32 size,
+                                 uint32 size,
                                  int32* id);
   void OnMsgDestroyTransferBuffer(const HostResource& context,
                                   int32 id);
@@ -104,6 +106,7 @@
                               int32 id,
                               ppapi::proxy::SerializedHandle* transfer_buffer);
   void OnMsgSwapBuffers(const HostResource& context);
+  void OnMsgInsertSyncPoint(const HostResource& context, uint32* sync_point);
   // Renderer->plugin message handlers.
   void OnMsgSwapBuffersACK(const HostResource& context,
                            int32_t pp_error);
diff --git a/ppapi/proxy/ppb_host_resolver_private_proxy.cc b/ppapi/proxy/ppb_host_resolver_private_proxy.cc
deleted file mode 100644
index da73c09..0000000
--- a/ppapi/proxy/ppb_host_resolver_private_proxy.cc
+++ /dev/null
@@ -1,123 +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 "ppapi/proxy/ppb_host_resolver_private_proxy.h"
-
-#include <cstddef>
-#include <map>
-
-#include "base/logging.h"
-#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/plugin_globals.h"
-#include "ppapi/proxy/plugin_proxy_delegate.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/shared_impl/host_resource.h"
-
-namespace ppapi {
-namespace proxy {
-
-namespace {
-
-typedef std::map<uint32, PPB_HostResolver_Shared*> IDToHostResolverMap;
-IDToHostResolverMap* g_id_to_host_resolver = NULL;
-
-class HostResolver : public PPB_HostResolver_Shared {
- public:
-  HostResolver(const HostResource& resource,
-               uint32 plugin_dispatcher_id);
-  virtual ~HostResolver();
-
-  virtual void SendResolve(const HostPortPair& host_port,
-                           const PP_HostResolver_Private_Hint* hint) OVERRIDE;
-
- private:
-  void SendToBrowser(IPC::Message* msg);
-
-  const uint32 plugin_dispatcher_id_;
-
-  DISALLOW_COPY_AND_ASSIGN(HostResolver);
-};
-
-HostResolver::HostResolver(const HostResource& resource,
-                           uint32 plugin_dispatcher_id)
-    : PPB_HostResolver_Shared(resource),
-      plugin_dispatcher_id_(plugin_dispatcher_id) {
-  if (!g_id_to_host_resolver)
-    g_id_to_host_resolver = new IDToHostResolverMap();
-  DCHECK(g_id_to_host_resolver->find(host_resolver_id_) ==
-         g_id_to_host_resolver->end());
-  (*g_id_to_host_resolver)[host_resolver_id_] = this;
-}
-
-HostResolver::~HostResolver() {
-  g_id_to_host_resolver->erase(host_resolver_id_);
-}
-
-void HostResolver::SendResolve(const HostPortPair& host_port,
-                               const PP_HostResolver_Private_Hint* hint) {
-  SendToBrowser(new PpapiHostMsg_PPBHostResolver_Resolve(
-      API_ID_PPB_HOSTRESOLVER_PRIVATE,
-      plugin_dispatcher_id_,
-      host_resolver_id_,
-      host_port,
-      *hint));
-}
-
-void HostResolver::SendToBrowser(IPC::Message* msg) {
-  PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(msg);
-}
-
-}  // namespace
-
-//------------------------------------------------------------------------------
-
-PPB_HostResolver_Private_Proxy::PPB_HostResolver_Private_Proxy(
-    Dispatcher* dispatcher) : InterfaceProxy(dispatcher) {
-}
-
-PPB_HostResolver_Private_Proxy::~PPB_HostResolver_Private_Proxy() {
-}
-
-// static
-PP_Resource PPB_HostResolver_Private_Proxy::CreateProxyResource(
-    PP_Instance instance) {
-  PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
-  if (!dispatcher)
-    return 0;
-
-  HostResolver* host_resolver =
-      new HostResolver(HostResource::MakeInstanceOnly(instance),
-                       dispatcher->plugin_dispatcher_id());
-  return host_resolver->GetReference();
-}
-
-bool PPB_HostResolver_Private_Proxy::OnMessageReceived(
-    const IPC::Message& msg) {
-  bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP(PPB_HostResolver_Private_Proxy, msg)
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPBHostResolver_ResolveACK, OnMsgResolveACK)
-    IPC_MESSAGE_UNHANDLED(handled = false)
-  IPC_END_MESSAGE_MAP()
-  return handled;
-}
-
-void PPB_HostResolver_Private_Proxy::OnMsgResolveACK(
-    uint32 plugin_dispatcher_id,
-    uint32 host_resolver_id,
-    bool succeeded,
-    const std::string& canonical_name,
-    const std::vector<PP_NetAddress_Private>& net_address_list) {
-  if (!g_id_to_host_resolver) {
-    NOTREACHED();
-    return;
-  }
-  IDToHostResolverMap::iterator it =
-      g_id_to_host_resolver->find(host_resolver_id);
-  if (it == g_id_to_host_resolver->end())
-    return;
-  it->second->OnResolveCompleted(succeeded, canonical_name, net_address_list);
-}
-
-}  // namespace proxy
-}  // namespace ppapi
diff --git a/ppapi/proxy/ppb_host_resolver_private_proxy.h b/ppapi/proxy/ppb_host_resolver_private_proxy.h
deleted file mode 100644
index 7e9b719..0000000
--- a/ppapi/proxy/ppb_host_resolver_private_proxy.h
+++ /dev/null
@@ -1,44 +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 PPAPI_PROXY_PPB_HOST_RESOLVER_PRIVATE_PROXY_H_
-#define PPAPI_PROXY_PPB_HOST_RESOLVER_PRIVATE_PROXY_H_
-
-#include "base/basictypes.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/shared_impl/private/ppb_host_resolver_shared.h"
-
-namespace ppapi {
-namespace proxy {
-
-class PPB_HostResolver_Private_Proxy : public InterfaceProxy {
- public:
-  PPB_HostResolver_Private_Proxy(Dispatcher* dispatcher);
-  virtual~PPB_HostResolver_Private_Proxy();
-
-  static PP_Resource CreateProxyResource(PP_Instance instance);
-
-  // InterfaceProxy implementation.
-  virtual bool OnMessageReceived(const IPC::Message& msg);
-
-  static const ApiID kApiID = API_ID_PPB_HOSTRESOLVER_PRIVATE;
-
- private:
-  // Browser->plugin message handlers.
-  void OnMsgResolveACK(
-      uint32 plugin_dispatcher_id,
-      uint32 host_resolver_id,
-      bool succeeded,
-      const std::string& canonical_name,
-      const std::vector<PP_NetAddress_Private>& net_address_list);
-
-  DISALLOW_COPY_AND_ASSIGN(PPB_HostResolver_Private_Proxy);
-};
-
-}  // namespace proxy
-}  // namespace ppapi
-
-#endif  // PPAPI_PROXY_PPB_HOST_RESOLVER_PRIVATE_PROXY_H_
diff --git a/ppapi/proxy/ppb_image_data_proxy.cc b/ppapi/proxy/ppb_image_data_proxy.cc
index eca9749..b2ede29 100644
--- a/ppapi/proxy/ppb_image_data_proxy.cc
+++ b/ppapi/proxy/ppb_image_data_proxy.cc
@@ -23,6 +23,7 @@
 #include "ppapi/proxy/plugin_resource_tracker.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/shared_impl/host_resource.h"
+#include "ppapi/shared_impl/proxy_lock.h"
 #include "ppapi/shared_impl/resource.h"
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/thunk.h"
@@ -236,6 +237,8 @@
   // Notification from the renderer that the given image data is usable.
   void ImageDataUsable(ImageData* image_data);
 
+  void DidDeleteInstance(PP_Instance instance);
+
  private:
   friend struct LeakySingletonTraits<ImageDataCache>;
 
@@ -275,9 +278,9 @@
   // Schedule a timer to invalidate this entry.
   MessageLoop::current()->PostDelayedTask(
       FROM_HERE,
-      base::Bind(&ImageDataCache::OnTimer,
-                 weak_factory_.GetWeakPtr(),
-                 image_data->pp_instance()),
+      RunWhileLocked(base::Bind(&ImageDataCache::OnTimer,
+                     weak_factory_.GetWeakPtr(),
+                     image_data->pp_instance())),
       base::TimeDelta::FromSeconds(kMaxAgeSeconds));
 }
 
@@ -287,6 +290,10 @@
     found->second.ImageDataUsable(image_data);
 }
 
+void ImageDataCache::DidDeleteInstance(PP_Instance instance) {
+  cache_.erase(instance);
+}
+
 void ImageDataCache::OnTimer(PP_Instance instance) {
   CacheMap::iterator found = cache_.find(instance);
   if (found == cache_.end())
@@ -343,6 +350,10 @@
     ImageDataCache::GetInstance()->Add(this);
 }
 
+void ImageData::InstanceWasDeleted() {
+  ImageDataCache::GetInstance()->DidDeleteInstance(pp_instance());
+}
+
 PP_Bool ImageData::Describe(PP_ImageDataDesc* desc) {
   memcpy(desc, &desc_, sizeof(PP_ImageDataDesc));
   return PP_TRUE;
@@ -386,7 +397,7 @@
   return PP_ERROR_NOACCESS;
 }
 
-skia::PlatformCanvas* ImageData::GetPlatformCanvas() {
+SkCanvas* ImageData::GetPlatformCanvas() {
 #if defined(OS_NACL)
   return NULL;  // No canvas in NaCl.
 #else
@@ -402,6 +413,10 @@
 #endif
 }
 
+void ImageData::SetUsedInReplaceContents() {
+  used_in_replace_contents_ = true;
+}
+
 void ImageData::RecycleToPlugin(bool zero_contents) {
   used_in_replace_contents_ = false;
   if (zero_contents) {
@@ -492,10 +507,11 @@
 bool PPB_ImageData_Proxy::OnMessageReceived(const IPC::Message& msg) {
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPB_ImageData_Proxy, msg)
+#if !defined(OS_NACL)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_Create, OnHostMsgCreate)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_CreateNaCl,
                         OnHostMsgCreateNaCl)
-
+#endif
     IPC_MESSAGE_HANDLER(PpapiMsg_PPBImageData_NotifyUnusedImageData,
                         OnPluginMsgNotifyUnusedImageData)
 
@@ -504,6 +520,7 @@
   return handled;
 }
 
+#if !defined(OS_NACL)
 void PPB_ImageData_Proxy::OnHostMsgCreate(PP_Instance instance,
                                           int32_t format,
                                           const PP_Size& size,
@@ -511,11 +528,6 @@
                                           HostResource* result,
                                           std::string* image_data_desc,
                                           ImageHandle* result_image_handle) {
-#if defined(OS_NACL)
-  // This message should never be received in untrusted code. To minimize the
-  // size of the IRT, we just don't handle it.
-  return;
-#else
   *result_image_handle = ImageData::NullHandle();
 
   thunk::EnterResourceCreation enter(instance);
@@ -547,7 +559,6 @@
     *result_image_handle = ImageData::HandleFromInt(handle);
 #endif  // defined(OS_WIN)
   }
-#endif  // defined(OS_NACL)
 }
 
 void PPB_ImageData_Proxy::OnHostMsgCreateNaCl(
@@ -558,11 +569,6 @@
     HostResource* result,
     std::string* image_data_desc,
     ppapi::proxy::SerializedHandle* result_image_handle) {
-#if defined(OS_NACL)
-  // This message should never be received in untrusted code. To minimize the
-  // size of the IRT, we just don't handle it.
-  return;
-#else
   result_image_handle->set_null_shmem();
   HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
   if (!dispatcher)
@@ -604,8 +610,8 @@
   result_image_handle->set_shmem(
       dispatcher->ShareHandleWithRemote(platform_file, false),
       byte_count);
-#endif  // defined(OS_NACL)
 }
+#endif  // !defined(OS_NACL)
 
 void PPB_ImageData_Proxy::OnPluginMsgNotifyUnusedImageData(
     const HostResource& old_image_data) {
diff --git a/ppapi/proxy/ppb_image_data_proxy.h b/ppapi/proxy/ppb_image_data_proxy.h
index 3c44dda..6001b37 100644
--- a/ppapi/proxy/ppb_image_data_proxy.h
+++ b/ppapi/proxy/ppb_image_data_proxy.h
@@ -27,6 +27,8 @@
 namespace ppapi {
 namespace proxy {
 
+class SerializedHandle;
+
 // The proxied image data resource. Unlike most resources, this needs to be
 // public in the header since a number of other resources need to access it.
 class ImageData : public ppapi::Resource,
@@ -51,19 +53,19 @@
   // Resource overrides.
   virtual ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API() OVERRIDE;
   virtual void LastPluginRefWasDeleted() OVERRIDE;
+  virtual void InstanceWasDeleted() OVERRIDE;
 
   // PPB_ImageData API.
   virtual PP_Bool Describe(PP_ImageDataDesc* desc) OVERRIDE;
   virtual void* Map() OVERRIDE;
   virtual void Unmap() OVERRIDE;
   virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) OVERRIDE;
-  virtual skia::PlatformCanvas* GetPlatformCanvas() OVERRIDE;
+  virtual SkCanvas* GetPlatformCanvas() OVERRIDE;
   virtual SkCanvas* GetCanvas() OVERRIDE;
+  virtual void SetUsedInReplaceContents() OVERRIDE;
 
   const PP_ImageDataDesc& desc() const { return desc_; }
 
-  void set_used_in_replace_contents() { used_in_replace_contents_ = true; }
-
   // Prepares this image data to be recycled to the plugin. The contents will be
   // cleared if zero_contents is set.
   void RecycleToPlugin(bool zero_contents);
@@ -84,7 +86,7 @@
   scoped_ptr<TransportDIB> transport_dib_;
 
   // Null when the image isn't mapped.
-  scoped_ptr<skia::PlatformCanvas> mapped_canvas_;
+  scoped_ptr<SkCanvas> mapped_canvas_;
 #endif
 
   // Set to true when this ImageData has been used in a call to
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc
index f8cd310..36d8b30 100644
--- a/ppapi/proxy/ppb_instance_proxy.cc
+++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -4,6 +4,7 @@
 
 #include "ppapi/proxy/ppb_instance_proxy.h"
 
+#include "base/memory/ref_counted.h"
 #include "build/build_config.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/c/pp_time.h"
@@ -13,22 +14,27 @@
 #include "ppapi/c/ppb_messaging.h"
 #include "ppapi/c/ppb_mouse_lock.h"
 #include "ppapi/c/private/pp_content_decryptor.h"
+#include "ppapi/proxy/broker_resource.h"
+#include "ppapi/proxy/browser_font_singleton_resource.h"
 #include "ppapi/proxy/content_decryptor_private_serializer.h"
 #include "ppapi/proxy/enter_proxy.h"
 #include "ppapi/proxy/flash_clipboard_resource.h"
+#include "ppapi/proxy/flash_file_resource.h"
+#include "ppapi/proxy/flash_fullscreen_resource.h"
 #include "ppapi/proxy/flash_resource.h"
 #include "ppapi/proxy/gamepad_resource.h"
 #include "ppapi/proxy/host_dispatcher.h"
 #include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/plugin_proxy_delegate.h"
 #include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/ppb_flash_proxy.h"
 #include "ppapi/proxy/serialized_var.h"
+#include "ppapi/proxy/truetype_font_singleton_resource.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
 #include "ppapi/shared_impl/ppb_url_util_shared.h"
 #include "ppapi/shared_impl/ppb_view_shared.h"
 #include "ppapi/shared_impl/var.h"
 #include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_graphics_2d_api.h"
+#include "ppapi/thunk/ppb_graphics_3d_api.h"
 #include "ppapi/thunk/thunk.h"
 
 // Windows headers interfere with this file.
@@ -38,6 +44,8 @@
 
 using ppapi::thunk::EnterInstanceNoLock;
 using ppapi::thunk::EnterResourceNoLock;
+using ppapi::thunk::PPB_Graphics2D_API;
+using ppapi::thunk::PPB_Graphics3D_API;
 using ppapi::thunk::PPB_Instance_API;
 
 namespace ppapi {
@@ -97,10 +105,13 @@
   // This must happen OUTSIDE of ExecuteScript since the SerializedVars use
   // the dispatcher upon return of the function (converting the
   // SerializedVarReturnValue/OutParam to a SerializedVar in the destructor).
+#if !defined(OS_NACL)
   ScopedModuleReference death_grip(dispatcher());
+#endif
 
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPB_Instance_Proxy, msg)
+#if !defined(OS_NACL)
     // Plugin -> Host messages.
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject,
                         OnHostMsgGetWindowObject)
@@ -130,8 +141,6 @@
                         OnHostMsgRequestInputEvents)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents,
                         OnHostMsgClearInputEvents)
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPPInputEvent_HandleInputEvent_ACK,
-                        OnMsgHandleInputEventAck)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LockMouse,
                         OnHostMsgLockMouse)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UnlockMouse,
@@ -148,8 +157,6 @@
                         OnHostMsgUpdateSurroundingText)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDocumentURL,
                         OnHostMsgGetDocumentURL)
-
-#if !defined(OS_NACL)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument,
                         OnHostMsgResolveRelativeToDocument)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest,
@@ -194,18 +201,35 @@
   // If device is 0, pass a null HostResource. This signals the host to unbind
   // all devices.
   HostResource host_resource;
+  PP_Resource pp_resource = 0;
   if (device) {
     Resource* resource =
         PpapiGlobals::Get()->GetResourceTracker()->GetResource(device);
     if (!resource || resource->pp_instance() != instance)
       return PP_FALSE;
     host_resource = resource->host_resource();
+    pp_resource = resource->pp_resource();
+  } else {
+    // Passing 0 means unbinding all devices.
+    dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
+        API_ID_PPB_INSTANCE, instance, 0));
+    return PP_TRUE;
   }
 
-  PP_Bool result = PP_FALSE;
-  dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
-      API_ID_PPB_INSTANCE, instance, host_resource, &result));
-  return result;
+  // We need to pass different resource to Graphics 2D and 3D right now.  Once
+  // 3D is migrated to the new design, we should be able to unify this.
+  EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false);
+  EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false);
+  if (enter_2d.succeeded()) {
+    dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
+        API_ID_PPB_INSTANCE, instance, pp_resource));
+    return PP_TRUE;
+  } else if (enter_3d.succeeded()) {
+    dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
+        API_ID_PPB_INSTANCE, instance, host_resource.host_resource()));
+    return PP_TRUE;
+  }
+  return PP_FALSE;
 }
 
 PP_Bool PPB_Instance_Proxy::IsFullFrame(PP_Instance instance) {
@@ -223,6 +247,13 @@
   return &data->view;
 }
 
+PP_Bool PPB_Instance_Proxy::FlashIsFullscreen(PP_Instance instance) {
+  // This function is only used for proxying in the renderer process. It is not
+  // implemented in the plugin process.
+  NOTREACHED();
+  return PP_FALSE;
+}
+
 PP_Var PPB_Instance_Proxy::GetWindowObject(PP_Instance instance) {
   ReceiveSerializedVarReturnValue result;
   dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetWindowObject(
@@ -291,21 +322,6 @@
   NOTIMPLEMENTED();  // Not proxied yet.
 }
 
-PP_Var PPB_Instance_Proxy::GetFontFamilies(PP_Instance instance) {
-  PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
-  if (!dispatcher)
-    return PP_MakeUndefined();
-
-  // Assume the font families don't change, so we can cache the result globally.
-  CR_DEFINE_STATIC_LOCAL(std::string, families, ());
-  if (families.empty()) {
-    PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
-        new PpapiHostMsg_PPBInstance_GetFontFamilies(&families));
-  }
-
-  return StringVar::StringToPPVar(families);
-}
-
 PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance,
                                           PP_Bool fullscreen) {
   PP_Bool result = PP_FALSE;
@@ -322,72 +338,70 @@
   return result;
 }
 
-thunk::PPB_Flash_API* PPB_Instance_Proxy::GetFlashAPI() {
-  InterfaceProxy* ip = dispatcher()->GetInterfaceProxy(API_ID_PPB_FLASH);
-  return static_cast<PPB_Flash_Proxy*>(ip);
-}
+Resource* PPB_Instance_Proxy::GetSingletonResource(PP_Instance instance,
+                                                   SingletonResourceID id) {
+  InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
+      GetInstanceData(instance);
 
-// TODO(raymes): We can most likely cut down this boilerplate for grabbing
-// singleton resource APIs.
-thunk::PPB_Flash_Functions_API* PPB_Instance_Proxy::GetFlashFunctionsAPI(
-    PP_Instance instance) {
+  InstanceData::SingletonResourceMap::iterator it =
+      data->singleton_resources.find(id);
+  if (it != data->singleton_resources.end())
+    return it->second.get();
+
+  scoped_refptr<Resource> new_singleton;
+  Connection connection(PluginGlobals::Get()->GetBrowserSender(), dispatcher());
+
+  switch (id) {
+    case BROKER_SINGLETON_ID:
+      new_singleton = new BrokerResource(connection, instance);
+      break;
+    case GAMEPAD_SINGLETON_ID:
+      new_singleton = new GamepadResource(connection, instance);
+      break;
+    case TRUETYPE_FONT_SINGLETON_ID:
+      new_singleton = new TrueTypeFontSingletonResource(connection, instance);
+      break;
+// Flash/trusted resources aren't needed for NaCl.
 #if !defined(OS_NACL) && !defined(NACL_WIN64)
-  InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
-      GetInstanceData(instance);
-  if (!data)
-    return NULL;
-
-  if (!data->flash_resource.get()) {
-    Connection connection(
-        PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(),
-        dispatcher());
-    data->flash_resource = new FlashResource(connection, instance);
-  }
-  return data->flash_resource.get();
+    case BROWSER_FONT_SINGLETON_ID:
+      new_singleton = new BrowserFontSingletonResource(connection, instance);
+      break;
+    case FLASH_CLIPBOARD_SINGLETON_ID:
+      new_singleton = new FlashClipboardResource(connection, instance);
+      break;
+    case FLASH_FILE_SINGLETON_ID:
+      new_singleton = new FlashFileResource(connection, instance);
+      break;
+    case FLASH_FULLSCREEN_SINGLETON_ID:
+      new_singleton = new FlashFullscreenResource(connection, instance);
+      break;
+    case FLASH_SINGLETON_ID:
+      new_singleton = new FlashResource(connection, instance,
+          static_cast<PluginDispatcher*>(dispatcher()));
+      break;
+    case PDF_SINGLETON_ID:
+      // TODO(raymes): fill this in.
+      break;
 #else
-  // Flash functions aren't implemented for nacl.
-  NOTIMPLEMENTED();
-  return NULL;
+    case BROWSER_FONT_SINGLETON_ID:
+    case FLASH_CLIPBOARD_SINGLETON_ID:
+    case FLASH_FILE_SINGLETON_ID:
+    case FLASH_FULLSCREEN_SINGLETON_ID:
+    case FLASH_SINGLETON_ID:
+    case PDF_SINGLETON_ID:
+      NOTREACHED();
+      break;
 #endif  // !defined(OS_NACL) && !defined(NACL_WIN64)
-}
-
-thunk::PPB_Flash_Clipboard_API* PPB_Instance_Proxy::GetFlashClipboardAPI(
-    PP_Instance instance) {
-#if !defined(OS_NACL) && !defined(NACL_WIN64)
-  InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
-      GetInstanceData(instance);
-  if (!data)
-    return NULL;
-
-  if (!data->flash_clipboard_resource.get()) {
-    Connection connection(
-        PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(),
-        dispatcher());
-    data->flash_clipboard_resource =
-        new FlashClipboardResource(connection, instance);
   }
-  return data->flash_clipboard_resource.get();
-#else
-  // Flash functions aren't implemented for nacl.
-  NOTIMPLEMENTED();
-  return NULL;
-#endif  // !defined(OS_NACL) && !defined(NACL_WIN64)
-}
 
-thunk::PPB_Gamepad_API* PPB_Instance_Proxy::GetGamepadAPI(
-    PP_Instance instance) {
-  InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
-      GetInstanceData(instance);
-  if (!data)
+  if (!new_singleton) {
+    // Getting here implies that a constructor is missing in the above switch.
+    NOTREACHED();
     return NULL;
-
-  if (!data->gamepad_resource.get()) {
-    Connection connection(
-        PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(),
-        dispatcher());
-    data->gamepad_resource = new GamepadResource(connection, instance);
   }
-  return data->gamepad_resource.get();
+
+  data->singleton_resources[id] = new_singleton;
+  return new_singleton.get();
 }
 
 int32_t PPB_Instance_Proxy::RequestInputEvents(PP_Instance instance,
@@ -419,12 +433,6 @@
       API_ID_PPB_INSTANCE, instance, event_classes));
 }
 
-void PPB_Instance_Proxy::ClosePendingUserGesture(PP_Instance instance,
-                                                 PP_TimeTicks timestamp) {
-  // Not called on the plugin side.
-  NOTREACHED();
-}
-
 void PPB_Instance_Proxy::ZoomChanged(PP_Instance instance,
                                      double factor) {
   // Not proxied yet.
@@ -520,19 +528,15 @@
 void PPB_Instance_Proxy::KeyMessage(PP_Instance instance,
                                     PP_Var key_system,
                                     PP_Var session_id,
-                                    PP_Resource message,
+                                    PP_Var message,
                                     PP_Var default_url) {
-  Resource* object =
-      PpapiGlobals::Get()->GetResourceTracker()->GetResource(message);
-  if (!object || object->pp_instance() != instance)
-    return;
   dispatcher()->Send(
       new PpapiHostMsg_PPBInstance_KeyMessage(
           API_ID_PPB_INSTANCE,
           instance,
           SerializedVarSendInput(dispatcher(), key_system),
           SerializedVarSendInput(dispatcher(), session_id),
-          object->host_resource().host_resource(),
+          SerializedVarSendInput(dispatcher(), message),
           SerializedVarSendInput(dispatcher(), default_url)));
 }
 
@@ -680,7 +684,8 @@
                                      PP_Var message) {
   dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage(
       API_ID_PPB_INSTANCE,
-      instance, SerializedVarSendInput(dispatcher(), message)));
+      instance, SerializedVarSendInputShmem(dispatcher(), message,
+                                            instance)));
 }
 
 PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance,
@@ -752,7 +757,7 @@
 
 void PPB_Instance_Proxy::SelectionChanged(PP_Instance instance) {
   // The "right" way to do this is to send the message to the host. However,
-  // all it will do it call RequestSurroundingText with a hardcoded number of
+  // all it will do is call RequestSurroundingText with a hardcoded number of
   // characters in response, which is an entire IPC round-trip.
   //
   // We can avoid this round-trip by just implementing the
@@ -771,7 +776,7 @@
   if (!data->is_request_surrounding_text_pending) {
     MessageLoop::current()->PostTask(
         FROM_HERE,
-        base::Bind(&RequestSurroundingText, instance));
+        RunWhileLocked(base::Bind(&RequestSurroundingText, instance)));
     data->is_request_surrounding_text_pending = true;
   }
 }
@@ -784,9 +789,12 @@
       API_ID_PPB_INSTANCE, instance, text, caret, anchor));
 }
 
+#if !defined(OS_NACL)
 void PPB_Instance_Proxy::OnHostMsgGetWindowObject(
     PP_Instance instance,
     SerializedVarReturnValue result) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded())
     result.Return(dispatcher(), enter.functions()->GetWindowObject(instance));
@@ -795,6 +803,8 @@
 void PPB_Instance_Proxy::OnHostMsgGetOwnerElementObject(
     PP_Instance instance,
     SerializedVarReturnValue result) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded()) {
     result.Return(dispatcher(),
@@ -803,13 +813,14 @@
 }
 
 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance,
-                                               const HostResource& device,
-                                               PP_Bool* result) {
+                                               PP_Resource device) {
+  // Note that we ignroe the return value here. Otherwise, this would need to
+  // be a slow sync call, and the plugin side of the proxy will have already
+  // validated the resources, so we shouldn't see errors here that weren't
+  // already caught.
   EnterInstanceNoLock enter(instance);
-  if (enter.succeeded()) {
-    *result = enter.functions()->BindGraphics(instance,
-                                              device.host_resource());
-  }
+  if (enter.succeeded())
+    enter.functions()->BindGraphics(instance, device);
 }
 
 void PPB_Instance_Proxy::OnHostMsgGetAudioHardwareOutputSampleRate(
@@ -838,6 +849,8 @@
     SerializedVarReceiveInput script,
     SerializedVarOutParam out_exception,
     SerializedVarReturnValue result) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.failed())
     return;
@@ -856,6 +869,8 @@
 void PPB_Instance_Proxy::OnHostMsgGetDefaultCharSet(
     PP_Instance instance,
     SerializedVarReturnValue result) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded())
     result.Return(dispatcher(), enter.functions()->GetDefaultCharSet(instance));
@@ -897,19 +912,14 @@
     enter.functions()->ClearInputEventRequest(instance, event_classes);
 }
 
-void PPB_Instance_Proxy::OnMsgHandleInputEventAck(PP_Instance instance,
-                                                  PP_TimeTicks timestamp) {
-  EnterInstanceNoLock enter(instance);
-  if (enter.succeeded())
-    enter.functions()->ClosePendingUserGesture(instance, timestamp);
-}
-
 void PPB_Instance_Proxy::OnHostMsgPostMessage(
     PP_Instance instance,
     SerializedVarReceiveInput message) {
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded())
-    enter.functions()->PostMessage(instance, message.Get(dispatcher()));
+    enter.functions()->PostMessage(instance,
+                                   message.GetForInstance(dispatcher(),
+                                                          instance));
 }
 
 void PPB_Instance_Proxy::OnHostMsgLockMouse(PP_Instance instance) {
@@ -932,6 +942,8 @@
     PP_Instance instance,
     PP_URLComponents_Dev* components,
     SerializedVarReturnValue result) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded()) {
     PP_Var document_url = enter.functions()->GetDocumentURL(instance,
@@ -940,11 +952,12 @@
   }
 }
 
-#if !defined(OS_NACL)
 void PPB_Instance_Proxy::OnHostMsgResolveRelativeToDocument(
     PP_Instance instance,
     SerializedVarReceiveInput relative,
     SerializedVarReturnValue result) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded()) {
     result.Return(dispatcher(),
@@ -957,6 +970,8 @@
     PP_Instance instance,
     SerializedVarReceiveInput url,
     PP_Bool* result) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded()) {
     *result = enter.functions()->DocumentCanRequest(instance,
@@ -967,6 +982,8 @@
 void PPB_Instance_Proxy::OnHostMsgDocumentCanAccessDocument(PP_Instance active,
                                                             PP_Instance target,
                                                             PP_Bool* result) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV))
+    return;
   EnterInstanceNoLock enter(active);
   if (enter.succeeded())
     *result = enter.functions()->DocumentCanAccessDocument(active, target);
@@ -975,6 +992,8 @@
 void PPB_Instance_Proxy::OnHostMsgGetPluginInstanceURL(
     PP_Instance instance,
     SerializedVarReturnValue result) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded()) {
     result.Return(dispatcher(),
@@ -986,6 +1005,8 @@
                                           SerializedVarReceiveInput key_system,
                                           SerializedVarReceiveInput session_id,
                                           SerializedVarReceiveInput init_data) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded()) {
     enter.functions()->NeedKey(instance,
@@ -999,6 +1020,8 @@
     PP_Instance instance,
     SerializedVarReceiveInput key_system,
     SerializedVarReceiveInput session_id) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded()) {
     enter.functions()->KeyAdded(instance,
@@ -1011,14 +1034,16 @@
     PP_Instance instance,
     SerializedVarReceiveInput key_system,
     SerializedVarReceiveInput session_id,
-    PP_Resource message,
+    SerializedVarReceiveInput message,
     SerializedVarReceiveInput default_url) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded()) {
     enter.functions()->KeyMessage(instance,
                                   key_system.Get(dispatcher()),
                                   session_id.Get(dispatcher()),
-                                  message,
+                                  message.Get(dispatcher()),
                                   default_url.Get(dispatcher()));
   }
 }
@@ -1029,6 +1054,8 @@
     SerializedVarReceiveInput session_id,
     int32_t media_error,
     int32_t system_error) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded()) {
     enter.functions()->KeyError(instance,
@@ -1043,6 +1070,8 @@
     PP_Instance instance,
     PP_Resource decrypted_block,
     const std::string& serialized_block_info) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+    return;
   PP_DecryptedBlockInfo block_info;
   if (!DeserializeBlockInfo(serialized_block_info, &block_info))
     return;
@@ -1057,6 +1086,8 @@
     PP_DecryptorStreamType decoder_type,
     uint32_t request_id,
     PP_Bool success) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded()) {
     enter.functions()->DecoderInitializeDone(instance,
@@ -1070,6 +1101,8 @@
     PP_Instance instance,
     PP_DecryptorStreamType decoder_type,
     uint32_t request_id) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded())
     enter.functions()->DecoderDeinitializeDone(instance,
@@ -1081,6 +1114,8 @@
     PP_Instance instance,
     PP_DecryptorStreamType decoder_type,
     uint32_t request_id) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded())
     enter.functions()->DecoderResetDone(instance, decoder_type, request_id);
@@ -1090,6 +1125,8 @@
     PP_Instance instance,
     PP_Resource decrypted_frame,
     const std::string& serialized_frame_info) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+    return;
   PP_DecryptedFrameInfo frame_info;
   if (!DeserializeBlockInfo(serialized_frame_info, &frame_info))
     return;
@@ -1103,6 +1140,8 @@
     PP_Instance instance,
     PP_Resource audio_frames,
     const std::string& serialized_block_info) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+    return;
   PP_DecryptedBlockInfo block_info;
   if (!DeserializeBlockInfo(serialized_block_info, &block_info))
     return;
@@ -1111,13 +1150,13 @@
   if (enter.succeeded())
     enter.functions()->DeliverSamples(instance, audio_frames, &block_info);
 }
-#endif  // !defined(OS_NACL)
 
-void  PPB_Instance_Proxy::OnHostMsgSetCursor(
+void PPB_Instance_Proxy::OnHostMsgSetCursor(
     PP_Instance instance,
     int32_t type,
     const ppapi::HostResource& custom_image,
     const PP_Point& hot_spot) {
+  // This API serves PPB_CursorControl_Dev and PPB_MouseCursor, so is public.
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded()) {
     enter.functions()->SetCursor(
@@ -1128,6 +1167,8 @@
 
 void PPB_Instance_Proxy::OnHostMsgSetTextInputType(PP_Instance instance,
                                                    PP_TextInput_Type type) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded())
     enter.functions()->SetTextInputType(instance, type);
@@ -1137,6 +1178,8 @@
     PP_Instance instance,
     const PP_Rect& caret,
     const PP_Rect& bounding_box) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded())
     enter.functions()->UpdateCaretPosition(instance, caret, bounding_box);
@@ -1144,6 +1187,8 @@
 
 void PPB_Instance_Proxy::OnHostMsgCancelCompositionText(PP_Instance instance) {
   EnterInstanceNoLock enter(instance);
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV))
+    return;
   if (enter.succeeded())
     enter.functions()->CancelCompositionText(instance);
 }
@@ -1153,15 +1198,21 @@
     const std::string& text,
     uint32_t caret,
     uint32_t anchor) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV))
+    return;
   EnterInstanceNoLock enter(instance);
   if (enter.succeeded()) {
     enter.functions()->UpdateSurroundingText(instance, text.c_str(), caret,
                                              anchor);
   }
 }
+#endif  // !defined(OS_NACL)
 
 void PPB_Instance_Proxy::OnPluginMsgMouseLockComplete(PP_Instance instance,
                                                       int32_t result) {
+  if (!dispatcher()->IsPlugin())
+    return;
+
   // Save the mouse callback on the instance data.
   InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
       GetInstanceData(instance);
@@ -1174,11 +1225,13 @@
   data->mouse_lock_callback->Run(result);
 }
 
+#if !defined(OS_NACL)
 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result,
                                                  PP_Instance instance) {
   dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete(
       API_ID_PPB_INSTANCE, instance, result));
 }
+#endif  // !defined(OS_NACL)
 
 void PPB_Instance_Proxy::CancelAnyPendingRequestSurroundingText(
     PP_Instance instance) {
diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h
index 9b4de32..b62706e 100644
--- a/ppapi/proxy/ppb_instance_proxy.h
+++ b/ppapi/proxy/ppb_instance_proxy.h
@@ -9,12 +9,12 @@
 
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_time.h"
 #include "ppapi/c/pp_var.h"
 #include "ppapi/proxy/interface_proxy.h"
 #include "ppapi/proxy/proxy_completion_callback_factory.h"
 #include "ppapi/shared_impl/host_resource.h"
 #include "ppapi/shared_impl/ppb_instance_shared.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
 #include "ppapi/thunk/ppb_instance_api.h"
 #include "ppapi/utility/completion_callback_factory.h"
 
@@ -49,6 +49,7 @@
                                PP_Resource device) OVERRIDE;
   virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE;
   virtual const ViewData* GetViewData(PP_Instance instance) OVERRIDE;
+  virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE;
   virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE;
   virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE;
   virtual PP_Var ExecuteScript(PP_Instance instance,
@@ -64,25 +65,18 @@
                                           PP_Bool final_result) OVERRIDE;
   virtual void SelectedFindResultChanged(PP_Instance instance,
                                          int32_t index) OVERRIDE;
-  virtual PP_Var GetFontFamilies(PP_Instance instance) OVERRIDE;
   virtual PP_Bool SetFullscreen(PP_Instance instance,
                                 PP_Bool fullscreen) OVERRIDE;
   virtual PP_Bool GetScreenSize(PP_Instance instance,
                                 PP_Size* size) OVERRIDE;
-  virtual thunk::PPB_Flash_API* GetFlashAPI() OVERRIDE;
-  virtual thunk::PPB_Flash_Functions_API* GetFlashFunctionsAPI(
-      PP_Instance instance) OVERRIDE;
-  virtual thunk::PPB_Flash_Clipboard_API* GetFlashClipboardAPI(
-      PP_Instance instance) OVERRIDE;
-  virtual thunk::PPB_Gamepad_API* GetGamepadAPI(PP_Instance instance) OVERRIDE;
+  virtual Resource* GetSingletonResource(PP_Instance instance,
+                                         SingletonResourceID id) OVERRIDE;
   virtual int32_t RequestInputEvents(PP_Instance instance,
                                      uint32_t event_classes) OVERRIDE;
   virtual int32_t RequestFilteringInputEvents(PP_Instance instance,
                                               uint32_t event_classes) OVERRIDE;
   virtual void ClearInputEventRequest(PP_Instance instance,
                                       uint32_t event_classes) OVERRIDE;
-  virtual void ClosePendingUserGesture(PP_Instance instance,
-                                       PP_TimeTicks timestamp) OVERRIDE;
   virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE;
   virtual void ZoomLimitsChanged(PP_Instance instance,
                                  double minimum_factor,
@@ -129,7 +123,7 @@
   virtual void KeyMessage(PP_Instance instance,
                           PP_Var key_system,
                           PP_Var session_id,
-                          PP_Resource message,
+                          PP_Var message,
                           PP_Var default_url) OVERRIDE;
   virtual void KeyError(PP_Instance instance,
                         PP_Var key_system,
@@ -166,8 +160,7 @@
   void OnHostMsgGetOwnerElementObject(PP_Instance instance,
                                       SerializedVarReturnValue result);
   void OnHostMsgBindGraphics(PP_Instance instance,
-                             const ppapi::HostResource& device,
-                             PP_Bool* result);
+                             PP_Resource device);
   void OnHostMsgIsFullFrame(PP_Instance instance, PP_Bool* result);
   void OnHostMsgExecuteScript(PP_Instance instance,
                               SerializedVarReceiveInput script,
@@ -190,8 +183,6 @@
                                    uint32_t event_classes);
   void OnHostMsgClearInputEvents(PP_Instance instance,
                                  uint32_t event_classes);
-  void OnMsgHandleInputEventAck(PP_Instance instance,
-                                PP_TimeTicks timestamp);
   void OnHostMsgPostMessage(PP_Instance instance,
                             SerializedVarReceiveInput message);
   void OnHostMsgLockMouse(PP_Instance instance);
@@ -236,7 +227,7 @@
   virtual void OnHostMsgKeyMessage(PP_Instance instance,
                                    SerializedVarReceiveInput key_system,
                                    SerializedVarReceiveInput session_id,
-                                   PP_Resource message,
+                                   SerializedVarReceiveInput message,
                                    SerializedVarReceiveInput default_url);
   virtual void OnHostMsgKeyError(PP_Instance instance,
                                  SerializedVarReceiveInput key_system,
diff --git a/ppapi/proxy/ppb_message_loop_proxy.cc b/ppapi/proxy/ppb_message_loop_proxy.cc
index b86ecf0..0062fb7 100644
--- a/ppapi/proxy/ppb_message_loop_proxy.cc
+++ b/ppapi/proxy/ppb_message_loop_proxy.cc
@@ -10,8 +10,8 @@
 #include "base/compiler_specific.h"
 #include "base/message_loop.h"
 #include "base/message_loop_proxy.h"
-#include "ppapi/c/dev/ppb_message_loop_dev.h"
 #include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_message_loop.h"
 #include "ppapi/proxy/plugin_dispatcher.h"
 #include "ppapi/proxy/plugin_globals.h"
 #include "ppapi/shared_impl/proxy_lock.h"
@@ -45,14 +45,12 @@
 
   // This must be called only once, so the slot must be empty.
   CHECK(!PluginGlobals::Get()->msg_loop_slot());
-  base::ThreadLocalStorage::Slot* slot =
-      new base::ThreadLocalStorage::Slot(&ReleaseMessageLoop);
+  // We don't add a reference for TLS here, so we don't release it. Instead,
+  // this loop is owned by PluginGlobals. Contrast with AttachToCurrentThread
+  // where we register ReleaseMessageLoop with TLS and call AddRef.
+  base::ThreadLocalStorage::Slot* slot = new base::ThreadLocalStorage::Slot();
   PluginGlobals::Get()->set_msg_loop_slot(slot);
 
-  // Take a ref to the MessageLoop on behalf of the TLS. Note that this is an
-  // internal ref and not a plugin ref so the plugin can't accidentally
-  // release it. This is released by ReleaseMessageLoop().
-  AddRef();
   slot->Set(this);
 
   loop_proxy_ = base::MessageLoopProxy::current();
@@ -200,6 +198,7 @@
 // -----------------------------------------------------------------------------
 
 PP_Resource Create(PP_Instance instance) {
+  ProxyAutoLock lock;
   // Validate the instance.
   PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
   if (!dispatcher)
@@ -208,10 +207,12 @@
 }
 
 PP_Resource GetForMainThread() {
+  ProxyAutoLock lock;
   return PluginGlobals::Get()->loop_for_main_thread()->GetReference();
 }
 
 PP_Resource GetCurrent() {
+  ProxyAutoLock lock;
   Resource* resource = MessageLoopResource::GetCurrent();
   if (resource)
     return resource->GetReference();
@@ -248,7 +249,7 @@
   return PP_ERROR_BADRESOURCE;
 }
 
-const PPB_MessageLoop_Dev_0_1 ppb_message_loop_interface = {
+const PPB_MessageLoop_1_0 ppb_message_loop_interface = {
   &Create,
   &GetForMainThread,
   &GetCurrent,
@@ -266,7 +267,7 @@
 }
 
 // static
-const PPB_MessageLoop_Dev_0_1* PPB_MessageLoop_Proxy::GetInterface() {
+const PPB_MessageLoop_1_0* PPB_MessageLoop_Proxy::GetInterface() {
   return &ppb_message_loop_interface;
 }
 
diff --git a/ppapi/proxy/ppb_message_loop_proxy.h b/ppapi/proxy/ppb_message_loop_proxy.h
index 689e439..3fa7674 100644
--- a/ppapi/proxy/ppb_message_loop_proxy.h
+++ b/ppapi/proxy/ppb_message_loop_proxy.h
@@ -11,15 +11,16 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/message_loop.h"
 #include "ppapi/proxy/interface_proxy.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
 #include "ppapi/shared_impl/ppb_message_loop_shared.h"
 #include "ppapi/thunk/ppb_message_loop_api.h"
 
-struct PPB_MessageLoop_Dev_0_1;
+struct PPB_MessageLoop_1_0;
 
 namespace ppapi {
 namespace proxy {
 
-class MessageLoopResource : public MessageLoopShared {
+class PPAPI_PROXY_EXPORT MessageLoopResource : public MessageLoopShared {
  public:
   explicit MessageLoopResource(PP_Instance instance);
   // Construct the one MessageLoopResource for the main thread. This must be
@@ -98,7 +99,7 @@
   explicit PPB_MessageLoop_Proxy(Dispatcher* dispatcher);
   virtual ~PPB_MessageLoop_Proxy();
 
-  static const PPB_MessageLoop_Dev_0_1* GetInterface();
+  static const PPB_MessageLoop_1_0* GetInterface();
 
  private:
   DISALLOW_COPY_AND_ASSIGN(PPB_MessageLoop_Proxy);
diff --git a/ppapi/proxy/ppb_network_monitor_private_proxy.cc b/ppapi/proxy/ppb_network_monitor_private_proxy.cc
index 0d17cd4..ad9d06d 100644
--- a/ppapi/proxy/ppb_network_monitor_private_proxy.cc
+++ b/ppapi/proxy/ppb_network_monitor_private_proxy.cc
@@ -5,7 +5,6 @@
 #include "ppapi/proxy/ppb_network_monitor_private_proxy.h"
 
 #include "ppapi/proxy/enter_proxy.h"
-#include "ppapi/proxy/plugin_proxy_delegate.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/shared_impl/proxy_lock.h"
 #include "ppapi/thunk/ppb_network_monitor_private_api.h"
@@ -98,7 +97,7 @@
   proxy->monitors_count_++;
   if (proxy->monitors_count_ == 1) {
     // If that is the first network monitor then send Start message.
-    PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
+    PluginGlobals::Get()->GetBrowserSender()->Send(
         new PpapiHostMsg_PPBNetworkMonitor_Start(
             dispatcher->plugin_dispatcher_id()));
 
@@ -143,7 +142,7 @@
     // Send Stop message if that was the last NetworkMonitor.
     PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
     if (dispatcher) {
-      PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
+      PluginGlobals::Get()->GetBrowserSender()->Send(
           new PpapiHostMsg_PPBNetworkMonitor_Stop(
               dispatcher->plugin_dispatcher_id()));
     }
diff --git a/ppapi/proxy/ppb_pdf_proxy.cc b/ppapi/proxy/ppb_pdf_proxy.cc
deleted file mode 100644
index e06b806..0000000
--- a/ppapi/proxy/ppb_pdf_proxy.cc
+++ /dev/null
@@ -1,202 +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 "ppapi/proxy/ppb_pdf_proxy.h"
-
-#include <string.h>  // For memcpy.
-
-#include <map>
-
-#include "base/logging.h"
-#include "base/memory/linked_ptr.h"
-#include "build/build_config.h"
-#include "ppapi/c/private/ppb_pdf.h"
-#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/plugin_resource_tracker.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/shared_impl/ppapi_globals.h"
-#include "ppapi/shared_impl/proxy_lock.h"
-#include "ppapi/shared_impl/var_tracker.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_pdf_api.h"
-
-using ppapi::thunk::PPB_PDFFont_API;
-using ppapi::thunk::EnterResource;
-
-namespace ppapi {
-namespace proxy {
-
-class PrivateFontFile : public Resource,
-                        public PPB_PDFFont_API {
- public:
-  PrivateFontFile(const HostResource& resource)
-      : Resource(OBJECT_IS_PROXY, resource) {
-  }
-  virtual ~PrivateFontFile() {}
-
-  PPB_PDFFont_API* AsPPB_PDFFont_API() { return this; }
-
-  // Sees if we have a cache of the font table and returns a pointer to it.
-  // Returns NULL if we don't have it.
-  std::string* GetFontTable(uint32_t table) const;
-
-  std::string* AddFontTable(uint32_t table, const std::string& contents);
-
- private:
-  typedef std::map<uint32_t, linked_ptr<std::string> > FontTableMap;
-  FontTableMap font_tables_;
-
-  DISALLOW_COPY_AND_ASSIGN(PrivateFontFile);
-};
-
-std::string* PrivateFontFile::GetFontTable(uint32_t table) const {
-  FontTableMap::const_iterator found = font_tables_.find(table);
-  if (found == font_tables_.end())
-    return NULL;
-  return found->second.get();
-}
-
-std::string* PrivateFontFile::AddFontTable(uint32_t table,
-                                           const std::string& contents) {
-  linked_ptr<std::string> heap_string(new std::string(contents));
-  font_tables_[table] = heap_string;
-  return heap_string.get();
-}
-
-namespace {
-
-PP_Resource GetFontFileWithFallback(
-    PP_Instance instance,
-    const PP_FontDescription_Dev* description,
-    PP_PrivateFontCharset charset) {
-  ProxyAutoLock lock;
-
-  PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
-  if (!dispatcher)
-    return 0;
-
-  SerializedFontDescription desc;
-  desc.SetFromPPFontDescription(*description);
-
-  HostResource result;
-  dispatcher->Send(new PpapiHostMsg_PPBPDF_GetFontFileWithFallback(
-      API_ID_PPB_PDF, instance, desc, charset, &result));
-  if (result.is_null())
-    return 0;
-  return (new PrivateFontFile(result))->GetReference();
-}
-
-bool GetFontTableForPrivateFontFile(PP_Resource font_file,
-                                    uint32_t table,
-                                    void* output,
-                                    uint32_t* output_length) {
-  EnterResource<PPB_PDFFont_API> enter(font_file, true);
-  if (enter.failed())
-    return false;
-
-  PrivateFontFile* object = static_cast<PrivateFontFile*>(enter.object());
-  PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(
-      object->pp_instance());
-  if (!dispatcher)
-    return false;
-
-  std::string* contents = object->GetFontTable(table);
-  if (!contents) {
-    std::string deserialized;
-    dispatcher->Send(new PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile(
-        API_ID_PPB_PDF, object->host_resource(), table, &deserialized));
-    if (deserialized.empty())
-      return false;
-    contents = object->AddFontTable(table, deserialized);
-  }
-
-  *output_length = static_cast<uint32_t>(contents->size());
-  if (output)
-    memcpy(output, contents->c_str(), *output_length);
-  return true;
-}
-
-const PPB_PDF pdf_interface = {
-  NULL,  // &GetLocalizedString,
-  NULL,  // &GetResourceImage,
-  &GetFontFileWithFallback,
-  &GetFontTableForPrivateFontFile,
-};
-
-InterfaceProxy* CreatePDFProxy(Dispatcher* dispatcher) {
-  return new PPB_PDF_Proxy(dispatcher);
-}
-
-}  // namespace
-
-PPB_PDF_Proxy::PPB_PDF_Proxy(Dispatcher* dispatcher)
-    : InterfaceProxy(dispatcher),
-      ppb_pdf_impl_(NULL) {
-  if (!dispatcher->IsPlugin()) {
-    ppb_pdf_impl_ = static_cast<const PPB_PDF*>(
-        dispatcher->local_get_interface()(PPB_PDF_INTERFACE));
-  }
-}
-
-PPB_PDF_Proxy::~PPB_PDF_Proxy() {
-}
-
-// static
-const InterfaceProxy::Info* PPB_PDF_Proxy::GetInfo() {
-  static const Info info = {
-    &pdf_interface,
-    PPB_PDF_INTERFACE,
-    API_ID_PPB_PDF,
-    true,
-    &CreatePDFProxy,
-  };
-  return &info;
-}
-
-bool PPB_PDF_Proxy::OnMessageReceived(const IPC::Message& msg) {
-  bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP(PPB_PDF_Proxy, msg)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontFileWithFallback,
-                        OnMsgGetFontFileWithFallback)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile,
-                        OnMsgGetFontTableForPrivateFontFile)
-    IPC_MESSAGE_UNHANDLED(handled = false)
-  IPC_END_MESSAGE_MAP()
-  // TODO(brettw): handle bad messages!
-  return handled;
-}
-
-void PPB_PDF_Proxy::OnMsgGetFontFileWithFallback(
-    PP_Instance instance,
-    const SerializedFontDescription& in_desc,
-    int32_t charset,
-    HostResource* result) {
-  PP_FontDescription_Dev desc;
-  in_desc.SetToPPFontDescription(&desc);
-  result->SetHostResource(instance,
-      ppb_pdf_impl_->GetFontFileWithFallback(
-          instance, &desc, static_cast<PP_PrivateFontCharset>(charset)));
-
-  // SetToPPFontDescription() creates a var which is owned by the caller.
-  PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(desc.face);
-}
-
-void PPB_PDF_Proxy::OnMsgGetFontTableForPrivateFontFile(
-    const HostResource& font_file,
-    uint32_t table,
-    std::string* result) {
-  // TODO(brettw): It would be nice not to copy here. At least on Linux,
-  // we can map the font file into shared memory and read it that way.
-  uint32_t table_length = 0;
-  if (!ppb_pdf_impl_->GetFontTableForPrivateFontFile(
-          font_file.host_resource(), table, NULL, &table_length))
-    return;
-
-  result->resize(table_length);
-  ppb_pdf_impl_->GetFontTableForPrivateFontFile(font_file.host_resource(),
-      table, const_cast<char*>(result->c_str()), &table_length);
-}
-
-}  // namespace proxy
-}  // namespace ppapi
diff --git a/ppapi/proxy/ppb_pdf_proxy.h b/ppapi/proxy/ppb_pdf_proxy.h
deleted file mode 100644
index b676148..0000000
--- a/ppapi/proxy/ppb_pdf_proxy.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PPAPI_PPB_PDF_PROXY_H_
-#define PPAPI_PPB_PDF_PROXY_H_
-
-#include <string>
-
-#include "ppapi/c/pp_module.h"
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/shared_impl/host_resource.h"
-
-struct PPB_PDF;
-
-namespace ppapi {
-namespace proxy {
-
-struct SerializedFontDescription;
-
-class PPB_PDF_Proxy : public InterfaceProxy {
- public:
-  PPB_PDF_Proxy(Dispatcher* dispatcher);
-  virtual ~PPB_PDF_Proxy();
-
-  static const Info* GetInfo();
-
-  // InterfaceProxy implementation.
-  virtual bool OnMessageReceived(const IPC::Message& msg);
-
- private:
-  // Message handlers.
-  void OnMsgGetFontFileWithFallback(PP_Module module,
-                                    const SerializedFontDescription& desc,
-                                    int32_t charset,
-                                    ppapi::HostResource* result);
-  void OnMsgGetFontTableForPrivateFontFile(const ppapi::HostResource& font_file,
-                                           uint32_t table,
-                                           std::string* result);
-
-  // When this proxy is in the host side, this value caches the interface
-  // pointer so we don't have to retrieve it from the dispatcher each time.
-  // In the plugin, this value is always NULL.
-  const PPB_PDF* ppb_pdf_impl_;
-};
-
-}  // namespace proxy
-}  // namespace ppapi
-
-#endif  // PPAPI_PPB_PDF_PROXY_H_
diff --git a/ppapi/proxy/ppb_talk_private_proxy.cc b/ppapi/proxy/ppb_talk_private_proxy.cc
deleted file mode 100644
index 7c34185..0000000
--- a/ppapi/proxy/ppb_talk_private_proxy.cc
+++ /dev/null
@@ -1,92 +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 "ppapi/proxy/ppb_talk_private_proxy.h"
-
-#include "ipc/ipc_message_macros.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/plugin_globals.h"
-#include "ppapi/proxy/plugin_proxy_delegate.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/shared_impl/resource.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_talk_private_api.h"
-
-namespace ppapi {
-namespace proxy {
-
-namespace {
-
-class Talk : public Resource, public thunk::PPB_Talk_Private_API {
- public:
-  Talk(PP_Instance instance) : Resource(OBJECT_IS_PROXY, instance) {
-  }
-
-  // Resource overrides.
-  thunk::PPB_Talk_Private_API* AsPPB_Talk_Private_API() { return this; }
-
-  // PPB_Talk_API implementation.
-  int32_t GetPermission(scoped_refptr<TrackedCallback> callback) {
-    if (TrackedCallback::IsPending(callback_))
-      return PP_ERROR_INPROGRESS;
-    PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(
-        pp_instance());
-    if (!dispatcher)
-      return PP_ERROR_FAILED;
-
-    callback_ = callback;
-
-    if (PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
-        new PpapiHostMsg_PPBTalk_GetPermission(
-            API_ID_PPB_TALK,
-            dispatcher->plugin_dispatcher_id(),
-            pp_resource())))
-      return PP_OK_COMPLETIONPENDING;
-    return PP_ERROR_FAILED;
-  }
-
-  void GotCompletion(int32_t result) {
-    callback_->Run(result);
-  }
-
- private:
-  scoped_refptr<TrackedCallback> callback_;
-
-  DISALLOW_COPY_AND_ASSIGN(Talk);
-};
-
-}  // namespace
-
-PPB_Talk_Private_Proxy::PPB_Talk_Private_Proxy(Dispatcher* dispatcher)
-    : InterfaceProxy(dispatcher) {
-}
-
-// static
-PP_Resource PPB_Talk_Private_Proxy::CreateProxyResource(PP_Instance instance) {
-  return (new Talk(instance))->GetReference();
-}
-
-bool PPB_Talk_Private_Proxy::OnMessageReceived(const IPC::Message& msg) {
-  bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP(PPB_Talk_Private_Proxy, msg)
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPBTalk_GetPermissionACK,
-                        OnMsgGetPermissionACK)
-    IPC_MESSAGE_UNHANDLED(handled = false);
-  IPC_END_MESSAGE_MAP();
-  return handled;
-}
-
-void PPB_Talk_Private_Proxy::OnMsgGetPermissionACK(uint32 /* dispatcher_id */,
-                                                   PP_Resource resource,
-                                                   int32_t result) {
-  thunk::EnterResourceNoLock<thunk::PPB_Talk_Private_API> enter(
-      resource, false);
-  if (enter.succeeded())
-    static_cast<Talk*>(enter.object())->GotCompletion(result);
-}
-
-}  // namespace proxy
-}  // namespace ppapi
diff --git a/ppapi/proxy/ppb_talk_private_proxy.h b/ppapi/proxy/ppb_talk_private_proxy.h
deleted file mode 100644
index 62b0b80..0000000
--- a/ppapi/proxy/ppb_talk_private_proxy.h
+++ /dev/null
@@ -1,38 +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 PPAPI_PROXY_PPB_TALK_PRIVATE_PROXY_H_
-#define PPAPI_PROXY_PPB_TALK_PRIVATE_PROXY_H_
-
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/shared_impl/api_id.h"
-
-namespace ppapi {
-namespace proxy {
-
-class PPB_Talk_Private_Proxy : public InterfaceProxy {
- public:
-  PPB_Talk_Private_Proxy(Dispatcher* dispatcher);
-
-  static PP_Resource CreateProxyResource(PP_Instance instance);
-
-  // InterfaceProxy implementation.
-  virtual bool OnMessageReceived(const IPC::Message& msg);
-
-  static const ApiID kApiID = API_ID_PPB_TALK;
-
- private:
-  // Message handlers.
-  void OnMsgGetPermissionACK(uint32 dispatcher_id,
-                             PP_Resource resource,
-                             int32_t result);
-
-  DISALLOW_COPY_AND_ASSIGN(PPB_Talk_Private_Proxy);
-};
-
-}  // namespace proxy
-}  // namespace ppapi
-
-#endif  // PPAPI_PROXY_PPB_TALK_PRIVATE_PROXY_H_
diff --git a/ppapi/proxy/ppb_tcp_server_socket_private_proxy.cc b/ppapi/proxy/ppb_tcp_server_socket_private_proxy.cc
index a98d4a7..e577a6b 100644
--- a/ppapi/proxy/ppb_tcp_server_socket_private_proxy.cc
+++ b/ppapi/proxy/ppb_tcp_server_socket_private_proxy.cc
@@ -10,7 +10,6 @@
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/proxy/plugin_dispatcher.h"
 #include "ppapi/proxy/plugin_globals.h"
-#include "ppapi/proxy/plugin_proxy_delegate.h"
 #include "ppapi/proxy/plugin_resource_tracker.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/proxy/ppb_tcp_socket_private_proxy.h"
@@ -113,7 +112,7 @@
 }
 
 void TCPServerSocket::SendToBrowser(IPC::Message* msg) {
-  PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(msg);
+  PluginGlobals::Get()->GetBrowserSender()->Send(msg);
 }
 
 }  // namespace
@@ -171,7 +170,7 @@
   } else if (socket_id != 0 && status == PP_OK) {
     IPC::Message* msg =
         new PpapiHostMsg_PPBTCPServerSocket_Destroy(socket_id);
-    PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(msg);
+    PluginGlobals::Get()->GetBrowserSender()->Send(msg);
   }
 }
 
@@ -190,7 +189,7 @@
                                   local_addr,
                                   remote_addr);
   } else if (accepted_socket_id != 0) {
-    PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
+    PluginGlobals::Get()->GetBrowserSender()->Send(
         new PpapiHostMsg_PPBTCPSocket_Disconnect(accepted_socket_id));
   }
 }
diff --git a/ppapi/proxy/ppb_tcp_socket_private_proxy.cc b/ppapi/proxy/ppb_tcp_socket_private_proxy.cc
index a032811..7f7fb78 100644
--- a/ppapi/proxy/ppb_tcp_socket_private_proxy.cc
+++ b/ppapi/proxy/ppb_tcp_socket_private_proxy.cc
@@ -9,7 +9,6 @@
 #include "base/logging.h"
 #include "ppapi/proxy/plugin_dispatcher.h"
 #include "ppapi/proxy/plugin_globals.h"
-#include "ppapi/proxy/plugin_proxy_delegate.h"
 #include "ppapi/proxy/plugin_resource_tracker.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h"
@@ -47,6 +46,8 @@
   virtual void SendRead(int32_t bytes_to_read) OVERRIDE;
   virtual void SendWrite(const std::string& buffer) OVERRIDE;
   virtual void SendDisconnect() OVERRIDE;
+  virtual void SendSetBoolOption(PP_TCPSocketOption_Private name,
+                                 bool value) OVERRIDE;
 
  private:
   void SendToBrowser(IPC::Message* msg);
@@ -117,8 +118,13 @@
   SendToBrowser(new PpapiHostMsg_PPBTCPSocket_Disconnect(socket_id_));
 }
 
+void TCPSocket::SendSetBoolOption(PP_TCPSocketOption_Private name, bool value) {
+  SendToBrowser(
+      new PpapiHostMsg_PPBTCPSocket_SetBoolOption(socket_id_, name, value));
+}
+
 void TCPSocket::SendToBrowser(IPC::Message* msg) {
-  PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(msg);
+  PluginGlobals::Get()->GetBrowserSender()->Send(msg);
 }
 
 }  // namespace
@@ -140,7 +146,7 @@
     return 0;
 
   uint32 socket_id = 0;
-  PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
+  PluginGlobals::Get()->GetBrowserSender()->Send(
       new PpapiHostMsg_PPBTCPSocket_Create(
           API_ID_PPB_TCPSOCKET_PRIVATE, dispatcher->plugin_dispatcher_id(),
           &socket_id));
@@ -171,6 +177,8 @@
                         OnMsgSSLHandshakeACK)
     IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnMsgReadACK)
     IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnMsgWriteACK)
+    IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SetBoolOptionACK,
+                        OnMsgSetBoolOptionACK)
     IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()
   return handled;
@@ -237,5 +245,19 @@
   iter->second->OnWriteCompleted(succeeded, bytes_written);
 }
 
+void PPB_TCPSocket_Private_Proxy::OnMsgSetBoolOptionACK(
+    uint32 /* plugin_dispatcher_id */,
+    uint32 socket_id,
+    bool succeeded) {
+  if (!g_id_to_socket) {
+    NOTREACHED();
+    return;
+  }
+  IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id);
+  if (iter == g_id_to_socket->end())
+    return;
+  iter->second->OnSetOptionCompleted(succeeded);
+}
+
 }  // namespace proxy
 }  // namespace ppapi
diff --git a/ppapi/proxy/ppb_tcp_socket_private_proxy.h b/ppapi/proxy/ppb_tcp_socket_private_proxy.h
index 4667216..ffceca7 100644
--- a/ppapi/proxy/ppb_tcp_socket_private_proxy.h
+++ b/ppapi/proxy/ppb_tcp_socket_private_proxy.h
@@ -57,6 +57,9 @@
                      uint32 socket_id,
                      bool succeeded,
                      int32_t bytes_written);
+  void OnMsgSetBoolOptionACK(uint32 plugin_dispatcher_id,
+                             uint32 socket_id,
+                             bool succeeded);
 
   DISALLOW_COPY_AND_ASSIGN(PPB_TCPSocket_Private_Proxy);
 };
diff --git a/ppapi/proxy/ppb_testing_proxy.cc b/ppapi/proxy/ppb_testing_proxy.cc
index 576302f..167a91e 100644
--- a/ppapi/proxy/ppb_testing_proxy.cc
+++ b/ppapi/proxy/ppb_testing_proxy.cc
@@ -14,10 +14,13 @@
 #include "ppapi/shared_impl/resource.h"
 #include "ppapi/shared_impl/resource_tracker.h"
 #include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_graphics_2d_api.h"
 #include "ppapi/thunk/ppb_input_event_api.h"
 
 using ppapi::thunk::EnterInstance;
+using ppapi::thunk::EnterResource;
 using ppapi::thunk::EnterResourceNoLock;
+using ppapi::thunk::PPB_Graphics2D_API;
 using ppapi::thunk::PPB_InputEvent_API;
 
 namespace ppapi {
@@ -39,16 +42,12 @@
       image_object->pp_instance() != graphics_2d_object->pp_instance())
     return PP_FALSE;
 
-  PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(
-      image_object->pp_instance());
-  if (!dispatcher)
+  EnterResourceNoLock<PPB_Graphics2D_API> enter(graphics_2d, true);
+  if (enter.failed())
     return PP_FALSE;
-
-  PP_Bool result = PP_FALSE;
-  dispatcher->Send(new PpapiHostMsg_PPBTesting_ReadImageData(
-      API_ID_PPB_TESTING, graphics_2d_object->host_resource(),
-      image_object->host_resource(), *top_left, &result));
-  return result;
+  const HostResource& host_image = image_object->host_resource();
+  return enter.object()->ReadImageData(host_image.host_resource(), top_left) ?
+      PP_TRUE : PP_FALSE;
 }
 
 void RunMessageLoop(PP_Instance instance) {
@@ -157,6 +156,9 @@
 }
 
 bool PPB_Testing_Proxy::OnMessageReceived(const IPC::Message& msg) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_TESTING))
+    return false;
+
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPB_Testing_Proxy, msg)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_ReadImageData,
diff --git a/ppapi/proxy/ppb_udp_socket_private_proxy.cc b/ppapi/proxy/ppb_udp_socket_private_proxy.cc
deleted file mode 100644
index b5a6d93..0000000
--- a/ppapi/proxy/ppb_udp_socket_private_proxy.cc
+++ /dev/null
@@ -1,181 +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 "ppapi/proxy/ppb_udp_socket_private_proxy.h"
-
-#include <map>
-
-#include "base/logging.h"
-#include "ppapi/c/private/ppb_udp_socket_private.h"
-#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/plugin_globals.h"
-#include "ppapi/proxy/plugin_proxy_delegate.h"
-#include "ppapi/proxy/plugin_resource_tracker.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/shared_impl/private/udp_socket_private_impl.h"
-#include "ppapi/shared_impl/resource.h"
-#include "ppapi/thunk/thunk.h"
-
-namespace ppapi {
-namespace proxy {
-
-namespace {
-
-typedef std::map<uint32, UDPSocketPrivateImpl*> IDToSocketMap;
-IDToSocketMap* g_id_to_socket = NULL;
-
-class UDPSocket : public UDPSocketPrivateImpl {
- public:
-  UDPSocket(const HostResource& resource, uint32 socket_id);
-  virtual ~UDPSocket();
-
-  virtual void SendBoolSocketFeature(int32_t name, bool value) OVERRIDE;
-  virtual void SendBind(const PP_NetAddress_Private& addr) OVERRIDE;
-  virtual void SendRecvFrom(int32_t num_bytes) OVERRIDE;
-  virtual void SendSendTo(const std::string& data,
-                          const PP_NetAddress_Private& addr) OVERRIDE;
-  virtual void SendClose() OVERRIDE;
-
- private:
-  void SendToBrowser(IPC::Message* msg);
-
-  DISALLOW_COPY_AND_ASSIGN(UDPSocket);
-};
-
-UDPSocket::UDPSocket(const HostResource& resource, uint32 socket_id)
-    : UDPSocketPrivateImpl(resource, socket_id) {
-  if (!g_id_to_socket)
-    g_id_to_socket = new IDToSocketMap();
-  DCHECK(g_id_to_socket->find(socket_id) == g_id_to_socket->end());
-  (*g_id_to_socket)[socket_id] = this;
-}
-
-UDPSocket::~UDPSocket() {
-  Close();
-}
-
-void UDPSocket::SendBoolSocketFeature(int32_t name, bool value) {
-  SendToBrowser(new PpapiHostMsg_PPBUDPSocket_SetBoolSocketFeature(
-      API_ID_PPB_UDPSOCKET_PRIVATE, socket_id_, name, value));
-}
-
-void UDPSocket::SendBind(const PP_NetAddress_Private& addr) {
-  SendToBrowser(new PpapiHostMsg_PPBUDPSocket_Bind(
-      API_ID_PPB_UDPSOCKET_PRIVATE, socket_id_, addr));
-}
-
-void UDPSocket::SendRecvFrom(int32_t num_bytes) {
-  SendToBrowser(new PpapiHostMsg_PPBUDPSocket_RecvFrom(socket_id_, num_bytes));
-}
-
-void UDPSocket::SendSendTo(const std::string& data,
-                           const PP_NetAddress_Private& addr) {
-  SendToBrowser(new PpapiHostMsg_PPBUDPSocket_SendTo(
-      API_ID_PPB_UDPSOCKET_PRIVATE, socket_id_, data, addr));
-}
-
-void UDPSocket::SendClose() {
-  // After removed from the mapping, this object won't receive any notifications
-  // from the proxy.
-  DCHECK(g_id_to_socket->find(socket_id_) != g_id_to_socket->end());
-  g_id_to_socket->erase(socket_id_);
-  SendToBrowser(new PpapiHostMsg_PPBUDPSocket_Close(socket_id_));
-}
-
-void UDPSocket::SendToBrowser(IPC::Message* msg) {
-  PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(msg);
-}
-
-}  // namespace
-
-//------------------------------------------------------------------------------
-
-PPB_UDPSocket_Private_Proxy::PPB_UDPSocket_Private_Proxy(Dispatcher* dispatcher)
-    : InterfaceProxy(dispatcher) {
-}
-
-PPB_UDPSocket_Private_Proxy::~PPB_UDPSocket_Private_Proxy() {
-}
-
-// static
-PP_Resource PPB_UDPSocket_Private_Proxy::CreateProxyResource(
-    PP_Instance instance) {
-  PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
-  if (!dispatcher)
-    return 0;
-
-  uint32 socket_id = 0;
-  PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
-      new PpapiHostMsg_PPBUDPSocket_Create(
-          API_ID_PPB_UDPSOCKET_PRIVATE, dispatcher->plugin_dispatcher_id(),
-          &socket_id));
-  if (socket_id == 0)
-    return 0;
-
-  return (new UDPSocket(HostResource::MakeInstanceOnly(instance),
-                        socket_id))->GetReference();
-}
-
-bool PPB_UDPSocket_Private_Proxy::OnMessageReceived(const IPC::Message& msg) {
-  bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP(PPB_UDPSocket_Private_Proxy, msg)
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK,
-                        OnMsgBindACK)
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_RecvFromACK,
-                        OnMsgRecvFromACK)
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_SendToACK,
-                        OnMsgSendToACK)
-    IPC_MESSAGE_UNHANDLED(handled = false)
-  IPC_END_MESSAGE_MAP()
-  return handled;
-}
-
-void PPB_UDPSocket_Private_Proxy::OnMsgBindACK(
-    uint32 /* plugin_dispatcher_id */,
-    uint32 socket_id,
-    bool succeeded,
-    const PP_NetAddress_Private& bound_addr) {
-  if (!g_id_to_socket) {
-    NOTREACHED();
-    return;
-  }
-  IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id);
-  if (iter == g_id_to_socket->end())
-    return;
-  iter->second->OnBindCompleted(succeeded, bound_addr);
-}
-
-void PPB_UDPSocket_Private_Proxy::OnMsgRecvFromACK(
-    uint32 /* plugin_dispatcher_id */,
-    uint32 socket_id,
-    bool succeeded,
-    const std::string& data,
-    const PP_NetAddress_Private& addr) {
-  if (!g_id_to_socket) {
-    NOTREACHED();
-    return;
-  }
-  IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id);
-  if (iter == g_id_to_socket->end())
-    return;
-  iter->second->OnRecvFromCompleted(succeeded, data, addr);
-}
-
-void PPB_UDPSocket_Private_Proxy::OnMsgSendToACK(
-    uint32 /* plugin_dispatcher_id */,
-    uint32 socket_id,
-    bool succeeded,
-    int32_t bytes_written) {
-  if (!g_id_to_socket) {
-    NOTREACHED();
-    return;
-  }
-  IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id);
-  if (iter == g_id_to_socket->end())
-    return;
-  iter->second->OnSendToCompleted(succeeded, bytes_written);
-}
-
-}  // namespace proxy
-}  // namespace ppapi
diff --git a/ppapi/proxy/ppb_udp_socket_private_proxy.h b/ppapi/proxy/ppb_udp_socket_private_proxy.h
deleted file mode 100644
index 4677b4e..0000000
--- a/ppapi/proxy/ppb_udp_socket_private_proxy.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PPAPI_PROXY_PPB_UDP_SOCKET_PRIVATE_PROXY_H_
-#define PPAPI_PROXY_PPB_UDP_SOCKET_PRIVATE_PROXY_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/private/ppb_udp_socket_private.h"
-#include "ppapi/proxy/interface_proxy.h"
-
-namespace ppapi {
-namespace proxy {
-
-class PPB_UDPSocket_Private_Proxy : public InterfaceProxy {
- public:
-  PPB_UDPSocket_Private_Proxy(Dispatcher* dispatcher);
-  virtual ~PPB_UDPSocket_Private_Proxy();
-
-  static PP_Resource CreateProxyResource(PP_Instance instance);
-
-  // InterfaceProxy implementation.
-  virtual bool OnMessageReceived(const IPC::Message& msg);
-
-  static const ApiID kApiID = API_ID_PPB_UDPSOCKET_PRIVATE;
-
- private:
-  // Browser->plugin message handlers.
-  void OnMsgBindACK(uint32 plugin_dispatcher_id,
-                    uint32 socket_id,
-                    bool succeeded,
-                    const PP_NetAddress_Private& bound_addr);
-  void OnMsgRecvFromACK(uint32 plugin_dispatcher_id,
-                        uint32 socket_id,
-                        bool succeeded,
-                        const std::string& data,
-                        const PP_NetAddress_Private& addr);
-  void OnMsgSendToACK(uint32 plugin_dispatcher_id,
-                      uint32 socket_id,
-                      bool succeeded,
-                      int32_t bytes_written);
-
-  DISALLOW_COPY_AND_ASSIGN(PPB_UDPSocket_Private_Proxy);
-};
-
-}  // namespace proxy
-}  // namespace ppapi
-
-#endif  // PPAPI_PROXY_PPB_UDP_SOCKET_PRIVATE_PROXY_H_
diff --git a/ppapi/proxy/ppb_url_loader_proxy.cc b/ppapi/proxy/ppb_url_loader_proxy.cc
index 9398671..3293516 100644
--- a/ppapi/proxy/ppb_url_loader_proxy.cc
+++ b/ppapi/proxy/ppb_url_loader_proxy.cc
@@ -22,7 +22,7 @@
 #include "ppapi/proxy/plugin_dispatcher.h"
 #include "ppapi/proxy/plugin_resource_tracker.h"
 #include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/ppb_url_response_info_proxy.h"
+#include "ppapi/proxy/ppb_file_ref_proxy.h"
 #include "ppapi/shared_impl/scoped_pp_resource.h"
 #include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
@@ -48,6 +48,7 @@
 // asked for a larger buffer.
 const int32_t kMaxReadBufferSize = 16777216;  // 16MB
 
+#if !defined(OS_NACL)
 // Called in the renderer when the byte counts have changed. We send a message
 // to the plugin to synchronize its counts so it can respond to status polls
 // from the plugin.
@@ -57,7 +58,6 @@
                               int64 total_bytes_to_be_sent,
                               int64 bytes_received,
                               int64 total_bytes_to_be_received) {
-#if !defined(OS_NACL)
   Dispatcher* dispatcher = HostDispatcher::GetForInstance(pp_instance);
   if (!dispatcher)
     return;
@@ -71,8 +71,8 @@
   params.total_bytes_to_be_received = total_bytes_to_be_received;
   dispatcher->Send(new PpapiMsg_PPBURLLoader_UpdateProgress(
       API_ID_PPB_URL_LOADER, params));
-#endif
 }
+#endif  // !defined(OS_NACL)
 
 InterfaceProxy* CreateURLLoaderProxy(Dispatcher* dispatcher) {
   return new PPB_URLLoader_Proxy(dispatcher);
@@ -114,6 +114,7 @@
   virtual void GrantUniversalAccess() OVERRIDE;
   virtual void SetStatusCallback(
       PP_URLLoaderTrusted_StatusCallback cb) OVERRIDE;
+  virtual bool GetResponseInfoData(URLResponseInfoData* data) OVERRIDE;
 
   // Called when the browser has new up/download progress to report.
   void UpdateProgress(const PPBURLLoader_UpdateProgress_Params& params);
@@ -249,14 +250,24 @@
 
 PP_Resource URLLoader::GetResponseInfo() {
   if (!response_info_) {
-    HostResource response_id;
+    bool success = false;
+    URLResponseInfoData data;
     GetDispatcher()->Send(new PpapiHostMsg_PPBURLLoader_GetResponseInfo(
-        API_ID_PPB_URL_LOADER, host_resource(), &response_id));
-    if (response_id.is_null())
+        API_ID_PPB_URL_LOADER, host_resource(), &success, &data));
+    if (!success)
       return 0;
 
-    response_info_ = PPB_URLResponseInfo_Proxy::CreateResponseForResource(
-        response_id);
+    // Create a proxy resource for the the file ref host resource if needed.
+    PP_Resource body_as_file_ref = 0;
+    if (!data.body_as_file_ref.resource.is_null()) {
+      body_as_file_ref =
+          PPB_FileRef_Proxy::DeserializeFileRef(data.body_as_file_ref);
+    }
+
+    // Assumes ownership of body_as_file_ref.
+    thunk::EnterResourceCreationNoLock enter(pp_instance());
+    response_info_ = enter.functions()->CreateURLResponseInfo(
+        pp_instance(), data, body_as_file_ref);
   }
 
   // The caller expects to get a ref, and we want to keep holding ours.
@@ -319,6 +330,12 @@
   // proxy itself in the host.
 }
 
+bool URLLoader::GetResponseInfoData(URLResponseInfoData* data) {
+  // Not implemented in the proxied version, this is for implementing the
+  // proxy itself in the host.
+  return false;
+}
+
 void URLLoader::UpdateProgress(
     const PPBURLLoader_UpdateProgress_Params& params) {
   bytes_sent_ = params.bytes_sent;
@@ -412,6 +429,7 @@
 bool PPB_URLLoader_Proxy::OnMessageReceived(const IPC::Message& msg) {
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPB_URLLoader_Proxy, msg)
+#if !defined(OS_NACL)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoader_Create,
                         OnMsgCreate)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoader_Open,
@@ -428,6 +446,8 @@
                         OnMsgClose)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoader_GrantUniversalAccess,
                         OnMsgGrantUniversalAccess)
+#endif  // !defined(OS_NACL)
+
     IPC_MESSAGE_HANDLER(PpapiMsg_PPBURLLoader_UpdateProgress,
                         OnMsgUpdateProgress)
     IPC_MESSAGE_HANDLER(PpapiMsg_PPBURLLoader_ReadResponseBody_Ack,
@@ -440,6 +460,7 @@
   return handled;
 }
 
+#if !defined(OS_NACL)
 void PPB_URLLoader_Proxy::PrepareURLLoaderForSendingToPlugin(
     PP_Resource resource) {
   // So the plugin can query load status, we need to register our status
@@ -480,12 +501,13 @@
 }
 
 void PPB_URLLoader_Proxy::OnMsgGetResponseInfo(const HostResource& loader,
-                                               HostResource* result) {
+                                               bool* success,
+                                               URLResponseInfoData* result) {
   EnterHostFromHostResource<PPB_URLLoader_API> enter(loader);
-  if (enter.succeeded()) {
-    result->SetHostResource(loader.instance(),
-                            enter.object()->GetResponseInfo());
-  }
+  if (enter.succeeded())
+    *success = enter.object()->GetResponseInfoData(result);
+  else
+    *success = false;
 }
 
 void PPB_URLLoader_Proxy::OnMsgReadResponseBody(
@@ -553,6 +575,7 @@
   if (enter.succeeded())
     enter.object()->GrantUniversalAccess();
 }
+#endif  // !defined(OS_NACL)
 
 // Called in the Plugin.
 void PPB_URLLoader_Proxy::OnMsgUpdateProgress(
@@ -586,7 +609,10 @@
     return;
   }
 
-  DCHECK(result < 0 || result == data_len);
+  if (result >= 0 && result != data_len) {
+    NOTREACHED() << "Data size mismatch";
+    return;
+  }
 
   EnterPluginFromHostResource<PPB_URLLoader_API> enter(host_resource);
   if (enter.succeeded())
@@ -602,6 +628,7 @@
     static_cast<URLLoader*>(enter.object())->CallbackComplete(result);
 }
 
+#if !defined(OS_NACL)
 void PPB_URLLoader_Proxy::OnReadCallback(int32_t result,
                                          IPC::Message* message) {
   int32_t bytes_read = 0;
@@ -619,6 +646,7 @@
   dispatcher()->Send(new PpapiMsg_PPBURLLoader_CallbackComplete(
       API_ID_PPB_URL_LOADER, resource, result));
 }
+#endif  // !defined(OS_NACL)
 
 }  // namespace proxy
 }  // namespace ppapi
diff --git a/ppapi/proxy/ppb_url_loader_proxy.h b/ppapi/proxy/ppb_url_loader_proxy.h
index 5e4e759..f4c5bc5 100644
--- a/ppapi/proxy/ppb_url_loader_proxy.h
+++ b/ppapi/proxy/ppb_url_loader_proxy.h
@@ -21,6 +21,7 @@
 namespace ppapi {
 
 struct URLRequestInfoData;
+struct URLResponseInfoData;
 
 namespace proxy {
 
@@ -61,7 +62,8 @@
                  const URLRequestInfoData& data);
   void OnMsgFollowRedirect(const HostResource& loader);
   void OnMsgGetResponseInfo(const HostResource& loader,
-                            HostResource* result);
+                            bool* success,
+                            URLResponseInfoData* result);
   void OnMsgReadResponseBody(const HostResource& loader,
                              int32_t bytes_to_read);
   void OnMsgFinishStreamingToFile(const HostResource& loader);
diff --git a/ppapi/proxy/ppb_url_response_info_proxy.cc b/ppapi/proxy/ppb_url_response_info_proxy.cc
deleted file mode 100644
index c2f0942..0000000
--- a/ppapi/proxy/ppb_url_response_info_proxy.cc
+++ /dev/null
@@ -1,128 +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 "ppapi/proxy/ppb_url_response_info_proxy.h"
-
-#include "ppapi/c/ppb_url_response_info.h"
-#include "ppapi/proxy/enter_proxy.h"
-#include "ppapi/proxy/host_dispatcher.h"
-#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/ppb_file_ref_proxy.h"
-#include "ppapi/proxy/serialized_var.h"
-#include "ppapi/shared_impl/resource.h"
-#include "ppapi/thunk/ppb_url_response_info_api.h"
-#include "ppapi/thunk/thunk.h"
-
-using ppapi::thunk::PPB_URLResponseInfo_API;
-
-namespace ppapi {
-namespace proxy {
-
-// URLResponseInfo -------------------------------------------------------------
-
-class URLResponseInfo : public Resource, public PPB_URLResponseInfo_API {
- public:
-  URLResponseInfo(const HostResource& resource);
-  virtual ~URLResponseInfo();
-
-  // Resource override.
-  virtual PPB_URLResponseInfo_API* AsPPB_URLResponseInfo_API() OVERRIDE;
-
-  // PPB_URLResponseInfo_API implementation.
-  virtual PP_Var GetProperty(PP_URLResponseProperty property) OVERRIDE;
-  virtual PP_Resource GetBodyAsFileRef() OVERRIDE;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(URLResponseInfo);
-};
-
-URLResponseInfo::URLResponseInfo(const HostResource& resource)
-    : Resource(OBJECT_IS_PROXY, resource) {
-}
-
-URLResponseInfo::~URLResponseInfo() {
-}
-
-PPB_URLResponseInfo_API* URLResponseInfo::AsPPB_URLResponseInfo_API() {
-  return this;
-}
-
-PP_Var URLResponseInfo::GetProperty(PP_URLResponseProperty property) {
-  PluginDispatcher* dispatcher = PluginDispatcher::GetForResource(this);
-  ReceiveSerializedVarReturnValue result;
-  dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetProperty(
-      API_ID_PPB_URL_RESPONSE_INFO, host_resource(), property, &result));
-  return result.Return(dispatcher);
-}
-
-PP_Resource URLResponseInfo::GetBodyAsFileRef() {
-  // This could be more efficient by having the host automatically send us the
-  // file ref when the request is streaming to a file and it's in the state
-  // where the file is ready. This will prevent us from having to do this sync
-  // IPC here.
-  PPB_FileRef_CreateInfo create_info;
-  PluginDispatcher::GetForResource(this)->Send(
-      new PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef(
-          API_ID_PPB_URL_RESPONSE_INFO, host_resource(), &create_info));
-  return PPB_FileRef_Proxy::DeserializeFileRef(create_info);
-}
-
-// PPB_URLResponseInfo_Proxy ---------------------------------------------------
-
-PPB_URLResponseInfo_Proxy::PPB_URLResponseInfo_Proxy(Dispatcher* dispatcher)
-    : InterfaceProxy(dispatcher) {
-}
-
-PPB_URLResponseInfo_Proxy::~PPB_URLResponseInfo_Proxy() {
-}
-
-// static
-PP_Resource PPB_URLResponseInfo_Proxy::CreateResponseForResource(
-    const HostResource& resource) {
-  return (new URLResponseInfo(resource))->GetReference();
-}
-
-bool PPB_URLResponseInfo_Proxy::OnMessageReceived(const IPC::Message& msg) {
-  bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP(PPB_URLResponseInfo_Proxy, msg)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetProperty,
-                        OnMsgGetProperty)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef,
-                        OnMsgGetBodyAsFileRef)
-    IPC_MESSAGE_UNHANDLED(handled = false)
-  IPC_END_MESSAGE_MAP()
-  // TODO(brettw): handle bad messages.
-  return handled;
-}
-
-void PPB_URLResponseInfo_Proxy::OnMsgGetProperty(
-    const HostResource& response,
-    int32_t property,
-    SerializedVarReturnValue result) {
-  EnterHostFromHostResource<PPB_URLResponseInfo_API> enter(response);
-  PP_Var result_var = PP_MakeUndefined();
-  if (enter.succeeded()) {
-    result_var = enter.object()->GetProperty(
-        static_cast<PP_URLResponseProperty>(property));
-  }
-  result.Return(dispatcher(), result_var);
-}
-
-void PPB_URLResponseInfo_Proxy::OnMsgGetBodyAsFileRef(
-    const HostResource& response,
-    PPB_FileRef_CreateInfo* result) {
-  EnterHostFromHostResource<PPB_URLResponseInfo_API> enter(response);
-  PP_Resource file_ref = 0;
-  if (enter.succeeded())
-    file_ref = enter.object()->GetBodyAsFileRef();
-
-  // Use the FileRef proxy to serialize.
-  PPB_FileRef_Proxy* file_ref_proxy = static_cast<PPB_FileRef_Proxy*>(
-      dispatcher()->GetInterfaceProxy(API_ID_PPB_FILE_REF));
-  file_ref_proxy->SerializeFileRef(file_ref, result);
-}
-
-}  // namespace proxy
-}  // namespace ppapi
diff --git a/ppapi/proxy/ppb_url_response_info_proxy.h b/ppapi/proxy/ppb_url_response_info_proxy.h
deleted file mode 100644
index 86c27fb..0000000
--- a/ppapi/proxy/ppb_url_response_info_proxy.h
+++ /dev/null
@@ -1,55 +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 PPAPI_PROXY_PPB_URL_RESPONSE_INFO_PROXY_H_
-#define PPAPI_PROXY_PPB_URL_RESPONSE_INFO_PROXY_H_
-
-#include "base/basictypes.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/shared_impl/host_resource.h"
-
-namespace ppapi {
-
-struct PPB_FileRef_CreateInfo;
-
-namespace proxy {
-
-class SerializedVarReturnValue;
-
-class PPB_URLResponseInfo_Proxy : public InterfaceProxy {
- public:
-  PPB_URLResponseInfo_Proxy(Dispatcher* dispatcher);
-  virtual ~PPB_URLResponseInfo_Proxy();
-
-  // URLResponseInfo objects are actually created and returned by the
-  // URLLoader. This function allows the URLLoader to convert a new
-  // HostResource representing a response info to a properly tracked
-  // URLReponseInfo Resource. Returns the plugin resource ID for the
-  // new resource.
-  static PP_Resource CreateResponseForResource(
-      const ppapi::HostResource& resource);
-
-  // InterfaceProxy implementation.
-  virtual bool OnMessageReceived(const IPC::Message& msg);
-
-  static const ApiID kApiID = API_ID_PPB_URL_RESPONSE_INFO;
-
- private:
-  // Message handlers.
-  void OnMsgGetProperty(const ppapi::HostResource& response,
-                        int32_t property,
-                        SerializedVarReturnValue result);
-  void OnMsgGetBodyAsFileRef(const ppapi::HostResource& response,
-                             PPB_FileRef_CreateInfo* result);
-
-  DISALLOW_COPY_AND_ASSIGN(PPB_URLResponseInfo_Proxy);
-};
-
-}  // namespace proxy
-}  // namespace ppapi
-
-#endif  // PPAPI_PROXY_PPB_URL_RESPONSE_INFO_PROXY_H_
diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.cc b/ppapi/proxy/ppb_var_deprecated_proxy.cc
index 3cef43a..2513a85 100644
--- a/ppapi/proxy/ppb_var_deprecated_proxy.cc
+++ b/ppapi/proxy/ppb_var_deprecated_proxy.cc
@@ -326,6 +326,9 @@
 }
 
 bool PPB_Var_Deprecated_Proxy::OnMessageReceived(const IPC::Message& msg) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV))
+    return false;
+
   // Prevent the dispatcher from going away during a call to Call or other
   // function that could mutate the DOM. This must happen OUTSIDE of
   // the message handlers since the SerializedVars use the dispatcher upon
diff --git a/ppapi/proxy/ppb_var_unittest.cc b/ppapi/proxy/ppb_var_unittest.cc
index 74ed453..bf6147d 100644
--- a/ppapi/proxy/ppb_var_unittest.cc
+++ b/ppapi/proxy/ppb_var_unittest.cc
@@ -10,7 +10,6 @@
 #include "ppapi/c/pp_var.h"
 #include "ppapi/c/ppb_var.h"
 #include "ppapi/proxy/ppapi_proxy_test.h"
-#include "ppapi/shared_impl/ppapi_globals.h"
 #include "ppapi/shared_impl/ppb_var_shared.h"
 
 namespace {
@@ -97,13 +96,12 @@
   // read the var back out to |strings_out[i]|.
   CreateVarThreadDelegate(PP_Module pp_module, const std::string* strings_in,
                           PP_Var* vars_out, std::string* strings_out,
-                          size_t size, PpapiGlobals* globals)
+                          size_t size)
       : pp_module_(pp_module), strings_in_(strings_in), vars_out_(vars_out),
-        strings_out_(strings_out), size_(size), globals_(globals) {
+        strings_out_(strings_out), size_(size) {
   }
   virtual ~CreateVarThreadDelegate() {}
   virtual void ThreadMain() {
-    PpapiGlobals::SetPpapiGlobalsOnThreadForTest(globals_);
     const PPB_Var* ppb_var = ppapi::PPB_Var_Shared::GetVarInterface1_1();
     for (size_t i = 0; i < size_; ++i) {
       vars_out_[i] = ppb_var->VarFromUtf8(strings_in_[i].c_str(),
@@ -117,20 +115,16 @@
   PP_Var* vars_out_;
   std::string* strings_out_;
   size_t size_;
-  PpapiGlobals* globals_;
 };
 
 // A thread that will increment and decrement the reference count of every var
 // multiple times.
 class ChangeRefVarThreadDelegate : public base::PlatformThread::Delegate {
  public:
-  ChangeRefVarThreadDelegate(const std::vector<PP_Var>& vars,
-                             PpapiGlobals* globals)
-      : vars_(vars), globals_(globals) {
+  ChangeRefVarThreadDelegate(const std::vector<PP_Var>& vars) : vars_(vars) {
   }
   virtual ~ChangeRefVarThreadDelegate() {}
   virtual void ThreadMain() {
-    PpapiGlobals::SetPpapiGlobalsOnThreadForTest(globals_);
     const PPB_Var* ppb_var = ppapi::PPB_Var_Shared::GetVarInterface1_1();
     // Increment and decrement the reference count for each var kRefsToAdd
     // times. Note that we always AddRef once before doing the matching Release,
@@ -150,19 +144,15 @@
   }
  private:
   std::vector<PP_Var> vars_;
-  PpapiGlobals* globals_;
 };
 
 // A thread that will decrement the reference count of every var once.
 class RemoveRefVarThreadDelegate : public base::PlatformThread::Delegate {
  public:
-  RemoveRefVarThreadDelegate(const std::vector<PP_Var>& vars,
-                             PpapiGlobals* globals)
-      : vars_(vars), globals_(globals) {
+  RemoveRefVarThreadDelegate(const std::vector<PP_Var>& vars) : vars_(vars) {
   }
   virtual ~RemoveRefVarThreadDelegate() {}
   virtual void ThreadMain() {
-    PpapiGlobals::SetPpapiGlobalsOnThreadForTest(globals_);
     const PPB_Var* ppb_var = ppapi::PPB_Var_Shared::GetVarInterface1_1();
     for (size_t i = 0; i < kNumStrings; ++i) {
       ppb_var->Release(vars_[i]);
@@ -170,7 +160,6 @@
   }
  private:
   std::vector<PP_Var> vars_;
-  PpapiGlobals* globals_;
 };
 
 }  // namespace
@@ -197,8 +186,7 @@
                                 &vars_[slice_start],
                                 &strings_out[slice_start],
                                 std::min(strings_per_thread,
-                                         kNumStrings - slice_start),
-                                GetGlobals()));
+                                         kNumStrings - slice_start)));
   }
   // Now run then join all the threads.
   for (size_t i = 0; i < kNumThreads; ++i)
@@ -213,8 +201,7 @@
   std::vector<base::PlatformThreadHandle> change_ref_var_threads(kNumThreads);
   std::vector<ChangeRefVarThreadDelegate> change_ref_var_delegates;
   for (size_t i = 0; i < kNumThreads; ++i)
-    change_ref_var_delegates.push_back(
-        ChangeRefVarThreadDelegate(vars_, GetGlobals()));
+    change_ref_var_delegates.push_back(ChangeRefVarThreadDelegate(vars_));
   for (size_t i = 0; i < kNumThreads; ++i) {
     base::PlatformThread::Create(0, &change_ref_var_delegates[i],
                                  &change_ref_var_threads[i]);
@@ -237,8 +224,7 @@
   std::vector<base::PlatformThreadHandle> remove_ref_var_threads(kNumThreads);
   std::vector<RemoveRefVarThreadDelegate> remove_ref_var_delegates;
   for (size_t i = 0; i < kNumThreads; ++i)
-    remove_ref_var_delegates.push_back(
-        RemoveRefVarThreadDelegate(vars_, GetGlobals()));
+    remove_ref_var_delegates.push_back(RemoveRefVarThreadDelegate(vars_));
   for (size_t i = 0; i < kNumThreads; ++i) {
     base::PlatformThread::Create(0, &remove_ref_var_delegates[i],
                                  &remove_ref_var_threads[i]);
diff --git a/ppapi/proxy/ppb_video_capture_proxy.cc b/ppapi/proxy/ppb_video_capture_proxy.cc
deleted file mode 100644
index 7edfa50..0000000
--- a/ppapi/proxy/ppb_video_capture_proxy.cc
+++ /dev/null
@@ -1,542 +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 "ppapi/proxy/ppb_video_capture_proxy.h"
-
-#include "base/compiler_specific.h"
-#include "base/logging.h"
-#include "build/build_config.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/ppb_core.h"
-#include "ppapi/c/dev/ppb_video_capture_dev.h"
-#include "ppapi/proxy/enter_proxy.h"
-#include "ppapi/proxy/host_dispatcher.h"
-#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/ppb_buffer_proxy.h"
-#include "ppapi/shared_impl/ppapi_globals.h"
-#include "ppapi/shared_impl/ppb_video_capture_shared.h"
-#include "ppapi/shared_impl/resource_tracker.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/thunk/ppb_buffer_api.h"
-#include "ppapi/thunk/ppb_buffer_trusted_api.h"
-#include "ppapi/thunk/ppb_video_capture_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
-#include "ppapi/thunk/thunk.h"
-
-using ppapi::thunk::EnterResourceNoLock;
-using ppapi::thunk::PPB_Buffer_API;
-using ppapi::thunk::PPB_BufferTrusted_API;
-using ppapi::thunk::PPB_VideoCapture_API;
-
-namespace ppapi {
-namespace proxy {
-
-namespace {
-
-InterfaceProxy* CreatePPPVideoCaptureProxy(Dispatcher* dispatcher) {
-  return new PPP_VideoCapture_Proxy(dispatcher);
-}
-
-void OnDeviceInfo(PP_Instance instance,
-                  PP_Resource resource,
-                  const PP_VideoCaptureDeviceInfo_Dev* info,
-                  uint32_t buffer_count,
-                  const PP_Resource resources[]) {
-  HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
-  if (!dispatcher) {
-    NOTREACHED();
-    return;
-  }
-  HostResource host_resource;
-  host_resource.SetHostResource(instance, resource);
-  std::vector<PPPVideoCapture_Buffer> buffers(buffer_count);
-  const PPB_Core* core = static_cast<const PPB_Core*>(
-      dispatcher->local_get_interface()(PPB_CORE_INTERFACE));
-  DCHECK(core);
-  for (uint32_t i = 0; i < buffer_count; ++i) {
-    // We need to take a ref on the resource now. The browser may drop
-    // references once we return from here, but we're sending an asynchronous
-    // message. The plugin side takes ownership of that reference.
-    core->AddRefResource(resources[i]);
-    buffers[i].resource.SetHostResource(instance, resources[i]);
-    {
-      EnterResourceNoLock<PPB_Buffer_API> enter(resources[i], true);
-      DCHECK(enter.succeeded());
-      PP_Bool result = enter.object()->Describe(&buffers[i].size);
-      DCHECK(result);
-    }
-    {
-      EnterResourceNoLock<PPB_BufferTrusted_API> enter(resources[i], true);
-      DCHECK(enter.succeeded());
-      int handle;
-      int32_t result = enter.object()->GetSharedMemory(&handle);
-      DCHECK(result == PP_OK);
-      // TODO(piman/brettw): Change trusted interface to return a PP_FileHandle,
-      // those casts are ugly.
-      base::PlatformFile platform_file =
-#if defined(OS_WIN)
-          reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle));
-#elif defined(OS_POSIX)
-          handle;
-#else
-#error Not implemented.
-#endif
-      buffers[i].handle =
-          dispatcher->ShareHandleWithRemote(platform_file, false);
-    }
-  }
-  dispatcher->Send(new PpapiMsg_PPPVideoCapture_OnDeviceInfo(
-      API_ID_PPP_VIDEO_CAPTURE_DEV, host_resource, *info, buffers));
-}
-
-void OnStatus(PP_Instance instance, PP_Resource resource, uint32_t status) {
-  HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
-  if (!dispatcher) {
-    NOTREACHED();
-    return;
-  }
-  HostResource host_resource;
-  host_resource.SetHostResource(instance, resource);
-  dispatcher->Send(new PpapiMsg_PPPVideoCapture_OnStatus(
-      API_ID_PPP_VIDEO_CAPTURE_DEV, host_resource, status));
-}
-
-void OnError(PP_Instance instance, PP_Resource resource, uint32_t error_code) {
-  HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
-  if (!dispatcher) {
-    NOTREACHED();
-    return;
-  }
-  HostResource host_resource;
-  host_resource.SetHostResource(instance, resource);
-  dispatcher->Send(new PpapiMsg_PPPVideoCapture_OnError(
-      API_ID_PPP_VIDEO_CAPTURE_DEV, host_resource, error_code));
-}
-
-void OnBufferReady(PP_Instance instance,
-                   PP_Resource resource,
-                   uint32_t buffer) {
-  HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
-  if (!dispatcher) {
-    NOTREACHED();
-    return;
-  }
-  HostResource host_resource;
-  host_resource.SetHostResource(instance, resource);
-  dispatcher->Send(new PpapiMsg_PPPVideoCapture_OnBufferReady(
-      API_ID_PPP_VIDEO_CAPTURE_DEV, host_resource, buffer));
-}
-
-PPP_VideoCapture_Dev ppp_video_capture = {
-  OnDeviceInfo,
-  OnStatus,
-  OnError,
-  OnBufferReady
-};
-
-}  // namespace
-
-class VideoCapture : public PPB_VideoCapture_Shared {
- public:
-  explicit VideoCapture(const HostResource& resource);
-  virtual ~VideoCapture();
-
-  bool OnStatus(PP_VideoCaptureStatus_Dev status);
-
-  void set_status(PP_VideoCaptureStatus_Dev status) {
-    SetStatus(status, true);
-  }
-
-  void SetBufferCount(size_t count) {
-    buffer_in_use_ = std::vector<bool>(count);
-  }
-
-  void SetBufferInUse(uint32_t buffer) {
-    DCHECK(buffer < buffer_in_use_.size());
-    buffer_in_use_[buffer] = true;
-  }
-
- private:
-  // PPB_VideoCapture_Shared implementation.
-  virtual int32_t InternalEnumerateDevices(
-      PP_Resource* devices,
-      scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t InternalOpen(
-      const std::string& device_id,
-      const PP_VideoCaptureDeviceInfo_Dev& requested_info,
-      uint32_t buffer_count,
-      scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t InternalStartCapture() OVERRIDE;
-  virtual int32_t InternalReuseBuffer(uint32_t buffer) OVERRIDE;
-  virtual int32_t InternalStopCapture() OVERRIDE;
-  virtual void InternalClose() OVERRIDE;
-  virtual int32_t InternalStartCapture0_1(
-      const PP_VideoCaptureDeviceInfo_Dev& requested_info,
-      uint32_t buffer_count) OVERRIDE;
-  virtual const std::vector<DeviceRefData>&
-      InternalGetDeviceRefData() const OVERRIDE;
-
-  PluginDispatcher* GetDispatcher() const {
-    return PluginDispatcher::GetForResource(this);
-  }
-
-  std::vector<bool> buffer_in_use_;
-
-  DISALLOW_COPY_AND_ASSIGN(VideoCapture);
-};
-
-VideoCapture::VideoCapture(const HostResource& resource)
-    : PPB_VideoCapture_Shared(resource) {
-}
-
-VideoCapture::~VideoCapture() {
-  Close();
-}
-
-bool VideoCapture::OnStatus(PP_VideoCaptureStatus_Dev status) {
-  switch (status) {
-    case PP_VIDEO_CAPTURE_STATUS_STARTED:
-    case PP_VIDEO_CAPTURE_STATUS_PAUSED:
-    case PP_VIDEO_CAPTURE_STATUS_STOPPED:
-      return SetStatus(status, false);
-    case PP_VIDEO_CAPTURE_STATUS_STARTING:
-    case PP_VIDEO_CAPTURE_STATUS_STOPPING:
-      // Those states are not sent by the browser.
-      break;
-  }
-
-  NOTREACHED();
-  return false;
-}
-
-int32_t VideoCapture::InternalEnumerateDevices(
-    PP_Resource* devices,
-    scoped_refptr<TrackedCallback> callback) {
-  devices_ = devices;
-  enumerate_devices_callback_ = callback;
-  GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_EnumerateDevices(
-      API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource()));
-  return PP_OK_COMPLETIONPENDING;
-}
-
-int32_t VideoCapture::InternalOpen(
-    const std::string& device_id,
-    const PP_VideoCaptureDeviceInfo_Dev& requested_info,
-    uint32_t buffer_count,
-    scoped_refptr<TrackedCallback> callback) {
-  open_callback_ = callback;
-  GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_Open(
-      API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource(), device_id, requested_info,
-      buffer_count));
-  return PP_OK_COMPLETIONPENDING;
-}
-
-int32_t VideoCapture::InternalStartCapture() {
-  buffer_in_use_.clear();
-  GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_StartCapture(
-      API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource()));
-  return PP_OK;
-}
-
-int32_t VideoCapture::InternalReuseBuffer(uint32_t buffer) {
-  if (buffer >= buffer_in_use_.size() || !buffer_in_use_[buffer])
-    return PP_ERROR_BADARGUMENT;
-  GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_ReuseBuffer(
-      API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource(), buffer));
-  return PP_OK;
-}
-
-int32_t VideoCapture::InternalStopCapture() {
-  GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_StopCapture(
-      API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource()));
-  return PP_OK;
-}
-
-void VideoCapture::InternalClose() {
-  GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_Close(
-      API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource()));
-}
-
-int32_t VideoCapture::InternalStartCapture0_1(
-    const PP_VideoCaptureDeviceInfo_Dev& requested_info,
-    uint32_t buffer_count) {
-  buffer_in_use_.clear();
-  GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_StartCapture0_1(
-      API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource(), requested_info,
-      buffer_count));
-  return PP_OK;
-}
-
-const std::vector<DeviceRefData>&
-    VideoCapture::InternalGetDeviceRefData() const {
-  // This should never be called at the plugin side.
-  NOTREACHED();
-  static std::vector<DeviceRefData> result;
-  return result;
-}
-
-PPB_VideoCapture_Proxy::PPB_VideoCapture_Proxy(Dispatcher* dispatcher)
-    : InterfaceProxy(dispatcher),
-      ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) {
-}
-
-PPB_VideoCapture_Proxy::~PPB_VideoCapture_Proxy() {
-}
-
-// static
-PP_Resource PPB_VideoCapture_Proxy::CreateProxyResource(PP_Instance instance) {
-  PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
-  if (!dispatcher)
-    return 0;
-
-  HostResource result;
-  dispatcher->Send(new PpapiHostMsg_PPBVideoCapture_Create(
-      API_ID_PPB_VIDEO_CAPTURE_DEV, instance, &result));
-  if (result.is_null())
-    return 0;
-  return (new VideoCapture(result))->GetReference();
-}
-
-bool PPB_VideoCapture_Proxy::OnMessageReceived(const IPC::Message& msg) {
-  bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP(PPB_VideoCapture_Proxy, msg)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_Create, OnMsgCreate)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_EnumerateDevices,
-                        OnMsgEnumerateDevices)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_Open, OnMsgOpen)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_StartCapture,
-                        OnMsgStartCapture)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_ReuseBuffer,
-                        OnMsgReuseBuffer)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_StopCapture,
-                        OnMsgStopCapture)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_Close, OnMsgClose)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_StartCapture0_1,
-                        OnMsgStartCapture0_1)
-
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPBVideoCapture_EnumerateDevicesACK,
-                        OnMsgEnumerateDevicesACK)
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPBVideoCapture_OpenACK,
-                        OnMsgOpenACK)
-    IPC_MESSAGE_UNHANDLED(handled = false)
-  IPC_END_MESSAGE_MAP()
-  // TODO(brettw) handle bad messages!
-  return handled;
-}
-
-void PPB_VideoCapture_Proxy::OnMsgCreate(PP_Instance instance,
-                                         HostResource* result_resource) {
-  thunk::EnterResourceCreation enter(instance);
-  if (enter.succeeded()) {
-    result_resource->SetHostResource(
-        instance,
-        enter.functions()->CreateVideoCapture(instance));
-  }
-}
-
-void PPB_VideoCapture_Proxy::OnMsgEnumerateDevices(
-    const HostResource& resource) {
-  EnterHostFromHostResourceForceCallback<PPB_VideoCapture_API> enter(
-      resource, callback_factory_,
-      &PPB_VideoCapture_Proxy::EnumerateDevicesACKInHost, resource);
-
-  if (enter.succeeded())
-    enter.SetResult(enter.object()->EnumerateDevices(NULL, enter.callback()));
-}
-
-void PPB_VideoCapture_Proxy::OnMsgOpen(
-    const ppapi::HostResource& resource,
-    const std::string& device_id,
-    const PP_VideoCaptureDeviceInfo_Dev& info,
-    uint32_t buffers) {
-  EnterHostFromHostResourceForceCallback<PPB_VideoCapture_API> enter(
-      resource, callback_factory_, &PPB_VideoCapture_Proxy::OpenACKInHost,
-      resource);
-
-  if (enter.succeeded()) {
-    enter.SetResult(enter.object()->Open(device_id, info, buffers,
-                                         enter.callback()));
-  }
-}
-
-void PPB_VideoCapture_Proxy::OnMsgStartCapture(const HostResource& resource) {
-  EnterHostFromHostResource<PPB_VideoCapture_API> enter(resource);
-  if (enter.succeeded())
-    enter.object()->StartCapture();
-}
-
-void PPB_VideoCapture_Proxy::OnMsgReuseBuffer(const HostResource& resource,
-                                              uint32_t buffer) {
-  EnterHostFromHostResource<PPB_VideoCapture_API> enter(resource);
-  if (enter.succeeded())
-    enter.object()->ReuseBuffer(buffer);
-}
-
-void PPB_VideoCapture_Proxy::OnMsgStopCapture(const HostResource& resource) {
-  EnterHostFromHostResource<PPB_VideoCapture_API> enter(resource);
-  if (enter.succeeded())
-    enter.object()->StopCapture();
-}
-
-void PPB_VideoCapture_Proxy::OnMsgClose(const HostResource& resource) {
-  EnterHostFromHostResource<PPB_VideoCapture_API> enter(resource);
-  if (enter.succeeded())
-    enter.object()->Close();
-}
-
-void PPB_VideoCapture_Proxy::OnMsgStartCapture0_1(
-    const HostResource& resource,
-    const PP_VideoCaptureDeviceInfo_Dev& info,
-    uint32_t buffers) {
-  EnterHostFromHostResource<PPB_VideoCapture_API> enter(resource);
-  if (enter.succeeded())
-    enter.object()->StartCapture0_1(info, buffers);
-}
-
-void PPB_VideoCapture_Proxy::OnMsgEnumerateDevicesACK(
-    const HostResource& resource,
-    int32_t result,
-    const std::vector<ppapi::DeviceRefData>& devices) {
-  EnterPluginFromHostResource<PPB_VideoCapture_API> enter(resource);
-  if (enter.succeeded()) {
-    static_cast<VideoCapture*>(enter.object())->OnEnumerateDevicesComplete(
-        result, devices);
-  }
-}
-
-void PPB_VideoCapture_Proxy::OnMsgOpenACK(
-    const HostResource& resource,
-    int32_t result) {
-  EnterPluginFromHostResource<PPB_VideoCapture_API> enter(resource);
-  if (enter.succeeded())
-    static_cast<VideoCapture*>(enter.object())->OnOpenComplete(result);
-}
-
-void PPB_VideoCapture_Proxy::EnumerateDevicesACKInHost(
-    int32_t result,
-    const HostResource& resource) {
-  EnterHostFromHostResource<PPB_VideoCapture_API> enter(resource);
-  dispatcher()->Send(new PpapiMsg_PPBVideoCapture_EnumerateDevicesACK(
-      API_ID_PPB_VIDEO_CAPTURE_DEV, resource, result,
-      enter.succeeded() && result == PP_OK ?
-          enter.object()->GetDeviceRefData() : std::vector<DeviceRefData>()));
-}
-
-void PPB_VideoCapture_Proxy::OpenACKInHost(int32_t result,
-                                           const HostResource& resource) {
-  dispatcher()->Send(new PpapiMsg_PPBVideoCapture_OpenACK(
-      API_ID_PPB_VIDEO_CAPTURE_DEV, resource, result));
-}
-
-PPP_VideoCapture_Proxy::PPP_VideoCapture_Proxy(Dispatcher* dispatcher)
-    : InterfaceProxy(dispatcher),
-      ppp_video_capture_impl_(NULL) {
-  if (dispatcher->IsPlugin()) {
-    ppp_video_capture_impl_ = static_cast<const PPP_VideoCapture_Dev*>(
-        dispatcher->local_get_interface()(PPP_VIDEO_CAPTURE_DEV_INTERFACE));
-  }
-}
-
-PPP_VideoCapture_Proxy::~PPP_VideoCapture_Proxy() {
-}
-
-// static
-const InterfaceProxy::Info* PPP_VideoCapture_Proxy::GetInfo() {
-  static const Info info = {
-    &ppp_video_capture,
-    PPP_VIDEO_CAPTURE_DEV_INTERFACE,
-    API_ID_PPP_VIDEO_CAPTURE_DEV,
-    false,
-    &CreatePPPVideoCaptureProxy,
-  };
-  return &info;
-}
-
-bool PPP_VideoCapture_Proxy::OnMessageReceived(const IPC::Message& msg) {
-  bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP(PPP_VideoCapture_Proxy, msg)
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoCapture_OnDeviceInfo,
-                        OnMsgOnDeviceInfo)
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoCapture_OnStatus, OnMsgOnStatus)
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoCapture_OnError, OnMsgOnError)
-    IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoCapture_OnBufferReady,
-                        OnMsgOnBufferReady)
-    IPC_MESSAGE_UNHANDLED(handled = false)
-  IPC_END_MESSAGE_MAP()
-  // TODO(brettw) handle bad messages!
-  return handled;
-}
-
-void PPP_VideoCapture_Proxy::OnMsgOnDeviceInfo(
-    const HostResource& host_resource,
-    const PP_VideoCaptureDeviceInfo_Dev& info,
-    const std::vector<PPPVideoCapture_Buffer>& buffers) {
-  EnterPluginFromHostResource<PPB_VideoCapture_API> enter(host_resource);
-  if (enter.failed() || !ppp_video_capture_impl_)
-    return;
-
-  PluginResourceTracker* tracker =
-      PluginGlobals::Get()->plugin_resource_tracker();
-  scoped_array<PP_Resource> resources(new PP_Resource[buffers.size()]);
-  for (size_t i = 0; i < buffers.size(); ++i) {
-    // We assume that the browser created a new set of resources.
-    DCHECK(!tracker->PluginResourceForHostResource(buffers[i].resource));
-    resources[i] = PPB_Buffer_Proxy::AddProxyResource(buffers[i].resource,
-                                                      buffers[i].handle,
-                                                      buffers[i].size);
-  }
-
-  VideoCapture* capture = static_cast<VideoCapture*>(enter.object());
-  capture->SetBufferCount(buffers.size());
-  ppp_video_capture_impl_->OnDeviceInfo(
-      host_resource.instance(),
-      capture->pp_resource(),
-      &info,
-      buffers.size(),
-      resources.get());
-  for (size_t i = 0; i < buffers.size(); ++i)
-    tracker->ReleaseResource(resources[i]);
-}
-
-void PPP_VideoCapture_Proxy::OnMsgOnStatus(const HostResource& host_resource,
-                                           uint32_t status) {
-  EnterPluginFromHostResource<PPB_VideoCapture_API> enter(host_resource);
-  if (enter.failed() || !ppp_video_capture_impl_)
-    return;
-
-  VideoCapture* capture = static_cast<VideoCapture*>(enter.object());
-  if (!capture->OnStatus(static_cast<PP_VideoCaptureStatus_Dev>(status)))
-    return;
-  ppp_video_capture_impl_->OnStatus(
-      host_resource.instance(), capture->pp_resource(), status);
-}
-
-void PPP_VideoCapture_Proxy::OnMsgOnError(const HostResource& host_resource,
-                                          uint32_t error_code) {
-  EnterPluginFromHostResource<PPB_VideoCapture_API> enter(host_resource);
-  if (enter.failed() || !ppp_video_capture_impl_)
-    return;
-
-  VideoCapture* capture = static_cast<VideoCapture*>(enter.object());
-  capture->set_status(PP_VIDEO_CAPTURE_STATUS_STOPPED);
-  ppp_video_capture_impl_->OnError(
-      host_resource.instance(), capture->pp_resource(), error_code);
-}
-
-void PPP_VideoCapture_Proxy::OnMsgOnBufferReady(
-    const HostResource& host_resource, uint32_t buffer) {
-  EnterPluginFromHostResource<PPB_VideoCapture_API> enter(host_resource);
-  if (enter.failed() || !ppp_video_capture_impl_)
-    return;
-
-  VideoCapture* capture = static_cast<VideoCapture*>(enter.object());
-  capture->SetBufferInUse(buffer);
-  ppp_video_capture_impl_->OnBufferReady(
-      host_resource.instance(), capture->pp_resource(), buffer);
-}
-
-}  // namespace proxy
-}  // namespace ppapi
diff --git a/ppapi/proxy/ppb_video_capture_proxy.h b/ppapi/proxy/ppb_video_capture_proxy.h
deleted file mode 100644
index aeefa33..0000000
--- a/ppapi/proxy/ppb_video_capture_proxy.h
+++ /dev/null
@@ -1,107 +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 PPAPI_PROXY_PPB_VIDEO_CAPTURE_PROXY_H_
-#define PPAPI_PROXY_PPB_VIDEO_CAPTURE_PROXY_H_
-
-#include <string>
-#include <vector>
-
-#include "ppapi/c/dev/ppp_video_capture_dev.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/proxy/proxy_completion_callback_factory.h"
-#include "ppapi/proxy/serialized_structs.h"
-#include "ppapi/shared_impl/ppb_device_ref_shared.h"
-#include "ppapi/utility/completion_callback_factory.h"
-
-struct PP_VideoCaptureDeviceInfo_Dev;
-
-namespace ppapi {
-
-class HostResource;
-
-namespace proxy {
-
-class PPB_VideoCapture_Proxy : public InterfaceProxy {
- public:
-  explicit PPB_VideoCapture_Proxy(Dispatcher* dispatcher);
-  virtual ~PPB_VideoCapture_Proxy();
-
-  static PP_Resource CreateProxyResource(PP_Instance instance);
-
-  // InterfaceProxy implementation.
-  virtual bool OnMessageReceived(const IPC::Message& msg);
-
-  static const ApiID kApiID = API_ID_PPB_VIDEO_CAPTURE_DEV;
-
- private:
-  // Message handlers in the renderer process.
-  void OnMsgCreate(PP_Instance instance, ppapi::HostResource* result_resource);
-  void OnMsgEnumerateDevices(const ppapi::HostResource& resource);
-  void OnMsgOpen(const ppapi::HostResource& resource,
-                 const std::string& device_id,
-                 const PP_VideoCaptureDeviceInfo_Dev& info,
-                 uint32_t buffers);
-  void OnMsgStartCapture(const ppapi::HostResource& resource);
-  void OnMsgReuseBuffer(const ppapi::HostResource& resource,
-                        uint32_t buffer);
-  void OnMsgStopCapture(const ppapi::HostResource& resource);
-  void OnMsgClose(const ppapi::HostResource& resource);
-  void OnMsgStartCapture0_1(const ppapi::HostResource& resource,
-                            const PP_VideoCaptureDeviceInfo_Dev& info,
-                            uint32_t buffers);
-
-  // Message handlers in the plugin process.
-  void OnMsgEnumerateDevicesACK(
-      const ppapi::HostResource& resource,
-      int32_t result,
-      const std::vector<ppapi::DeviceRefData>& devices);
-  void OnMsgOpenACK(const ppapi::HostResource& resource, int32_t result);
-
-  void EnumerateDevicesACKInHost(int32_t result,
-                                 const ppapi::HostResource& resource);
-  void OpenACKInHost(int32_t result, const ppapi::HostResource& resource);
-
-  ProxyCompletionCallbackFactory<PPB_VideoCapture_Proxy> callback_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(PPB_VideoCapture_Proxy);
-};
-
-class PPP_VideoCapture_Proxy : public InterfaceProxy {
- public:
-  explicit PPP_VideoCapture_Proxy(Dispatcher* dispatcher);
-  virtual ~PPP_VideoCapture_Proxy();
-
-  static const Info* GetInfo();
-
-  // InterfaceProxy implementation.
-  virtual bool OnMessageReceived(const IPC::Message& msg);
-
-  static const ApiID kApiID = API_ID_PPP_VIDEO_CAPTURE_DEV;
-
- private:
-  // Message handlers.
-  void OnMsgOnDeviceInfo(const ppapi::HostResource& video_capture,
-                         const PP_VideoCaptureDeviceInfo_Dev& info,
-                         const std::vector<PPPVideoCapture_Buffer>& buffers);
-  void OnMsgOnStatus(const ppapi::HostResource& video_capture,
-                     uint32_t status);
-  void OnMsgOnError(const ppapi::HostResource& video_capture,
-                    uint32_t error_code);
-  void OnMsgOnBufferReady(const ppapi::HostResource& video_capture,
-                          uint32_t buffer);
-
-  // When this proxy is in the plugin side, this value caches the interface
-  // pointer so we don't have to retrieve it from the dispatcher each time.
-  // In the host, this value is always NULL.
-  const PPP_VideoCapture_Dev* ppp_video_capture_impl_;
-
-  DISALLOW_COPY_AND_ASSIGN(PPP_VideoCapture_Proxy);
-};
-
-}  // namespace proxy
-}  // namespace ppapi
-
-#endif  // PPAPI_PROXY_PPB_VIDEO_CAPTURE_PROXY_H_
diff --git a/ppapi/proxy/ppb_video_decoder_proxy.cc b/ppapi/proxy/ppb_video_decoder_proxy.cc
index 2965fea..496646e 100644
--- a/ppapi/proxy/ppb_video_decoder_proxy.cc
+++ b/ppapi/proxy/ppb_video_decoder_proxy.cc
@@ -155,6 +155,9 @@
 }
 
 bool PPB_VideoDecoder_Proxy::OnMessageReceived(const IPC::Message& msg) {
+  if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV))
+    return false;
+
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPB_VideoDecoder_Proxy, msg)
     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoDecoder_Create,
@@ -223,7 +226,7 @@
 
 void PPB_VideoDecoder_Proxy::OnMsgDecode(
     const HostResource& decoder,
-    const HostResource& buffer, int32 id, int32 size) {
+    const HostResource& buffer, int32 id, uint32 size) {
   EnterHostFromHostResourceForceCallback<PPB_VideoDecoder_API> enter(
       decoder, callback_factory_,
       &PPB_VideoDecoder_Proxy::SendMsgEndOfBitstreamACKToPlugin, decoder, id);
diff --git a/ppapi/proxy/ppb_video_decoder_proxy.h b/ppapi/proxy/ppb_video_decoder_proxy.h
index ffb259e..e9127a7 100644
--- a/ppapi/proxy/ppb_video_decoder_proxy.h
+++ b/ppapi/proxy/ppb_video_decoder_proxy.h
@@ -40,7 +40,7 @@
                    ppapi::HostResource* result);
   void OnMsgDecode(
       const ppapi::HostResource& decoder,
-      const ppapi::HostResource& buffer, int32 id, int32 size);
+      const ppapi::HostResource& buffer, int32 id, uint32 size);
   void OnMsgAssignPictureBuffers(
       const ppapi::HostResource& decoder,
       const std::vector<PP_PictureBuffer_Dev>& buffers);
diff --git a/ppapi/proxy/ppb_x509_certificate_private_proxy.cc b/ppapi/proxy/ppb_x509_certificate_private_proxy.cc
index f673f3b..7a9b013 100644
--- a/ppapi/proxy/ppb_x509_certificate_private_proxy.cc
+++ b/ppapi/proxy/ppb_x509_certificate_private_proxy.cc
@@ -6,7 +6,6 @@
 
 #include "ppapi/c/private/ppb_x509_certificate_private.h"
 #include "ppapi/proxy/plugin_globals.h"
-#include "ppapi/proxy/plugin_proxy_delegate.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h"
 
@@ -45,7 +44,7 @@
 }
 
 void X509CertificatePrivate::SendToBrowser(IPC::Message* msg) {
-  PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(msg);
+  PluginGlobals::Get()->GetBrowserSender()->Send(msg);
 }
 
 }  // namespace
diff --git a/ppapi/proxy/ppp_class_proxy.cc b/ppapi/proxy/ppp_class_proxy.cc
index 8d44a90..3c28d0d 100644
--- a/ppapi/proxy/ppp_class_proxy.cc
+++ b/ppapi/proxy/ppp_class_proxy.cc
@@ -36,11 +36,19 @@
 };
 
 ObjectProxy* ToObjectProxy(void* data) {
-  return reinterpret_cast<ObjectProxy*>(data);
+  ObjectProxy* obj = reinterpret_cast<ObjectProxy*>(data);
+  if (!obj || !obj->dispatcher)
+    return NULL;
+  if (!obj->dispatcher->permissions().HasPermission(PERMISSION_DEV))
+    return NULL;
+  return obj;
 }
 
 bool HasProperty(void* object, PP_Var name, PP_Var* exception) {
   ObjectProxy* obj = ToObjectProxy(object);
+  if (!obj)
+    return false;
+
   bool result = false;
   ReceiveSerializedException se(obj->dispatcher, exception);
   obj->dispatcher->Send(new PpapiMsg_PPPClass_HasProperty(
@@ -51,6 +59,9 @@
 
 bool HasMethod(void* object, PP_Var name, PP_Var* exception) {
   ObjectProxy* obj = ToObjectProxy(object);
+  if (!obj)
+    return false;
+
   bool result = false;
   ReceiveSerializedException se(obj->dispatcher, exception);
   obj->dispatcher->Send(new PpapiMsg_PPPClass_HasMethod(
@@ -63,6 +74,9 @@
                    PP_Var name,
                    PP_Var* exception) {
   ObjectProxy* obj = ToObjectProxy(object);
+  if (!obj)
+    return PP_MakeUndefined();
+
   ReceiveSerializedException se(obj->dispatcher, exception);
   ReceiveSerializedVarReturnValue result;
   obj->dispatcher->Send(new PpapiMsg_PPPClass_GetProperty(
@@ -84,6 +98,9 @@
                  PP_Var value,
                  PP_Var* exception) {
   ObjectProxy* obj = ToObjectProxy(object);
+  if (!obj)
+    return;
+
   ReceiveSerializedException se(obj->dispatcher, exception);
   obj->dispatcher->Send(new PpapiMsg_PPPClass_SetProperty(
       API_ID_PPP_CLASS, obj->ppp_class, obj->user_data,
@@ -95,6 +112,9 @@
                     PP_Var name,
                     PP_Var* exception) {
   ObjectProxy* obj = ToObjectProxy(object);
+  if (!obj)
+    return;
+
   ReceiveSerializedException se(obj->dispatcher, exception);
   obj->dispatcher->Send(new PpapiMsg_PPPClass_RemoveProperty(
       API_ID_PPP_CLASS, obj->ppp_class, obj->user_data,
@@ -107,6 +127,8 @@
             PP_Var* argv,
             PP_Var* exception) {
   ObjectProxy* obj = ToObjectProxy(object);
+  if (!obj)
+    return PP_MakeUndefined();
 
   ReceiveSerializedVarReturnValue result;
   ReceiveSerializedException se(obj->dispatcher, exception);
@@ -126,6 +148,8 @@
                  PP_Var* argv,
                  PP_Var* exception) {
   ObjectProxy* obj = ToObjectProxy(object);
+  if (!obj)
+    return PP_MakeUndefined();
 
   ReceiveSerializedVarReturnValue result;
   ReceiveSerializedException se(obj->dispatcher, exception);
@@ -141,6 +165,9 @@
 
 void Deallocate(void* object) {
   ObjectProxy* obj = ToObjectProxy(object);
+  if (!obj)
+    return;
+
   obj->dispatcher->Send(new PpapiMsg_PPPClass_Deallocate(
       API_ID_PPP_CLASS, obj->ppp_class, obj->user_data));
   delete obj;
@@ -219,6 +246,9 @@
 }
 
 bool PPP_Class_Proxy::OnMessageReceived(const IPC::Message& msg) {
+  if (!dispatcher()->IsPlugin())
+    return false;  // These messages are only valid from host->plugin.
+
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPP_Class_Proxy, msg)
     IPC_MESSAGE_HANDLER(PpapiMsg_PPPClass_HasProperty,
diff --git a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc
index 1b47207..f986e7f 100644
--- a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc
+++ b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc
@@ -14,16 +14,15 @@
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/proxy/ppb_buffer_proxy.h"
 #include "ppapi/proxy/serialized_var.h"
+#include "ppapi/shared_impl/scoped_pp_resource.h"
 #include "ppapi/shared_impl/var_tracker.h"
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/ppb_buffer_api.h"
-#include "ppapi/thunk/ppb_buffer_trusted_api.h"
 #include "ppapi/thunk/ppb_instance_api.h"
 #include "ppapi/thunk/thunk.h"
 
 using ppapi::thunk::EnterResourceNoLock;
 using ppapi::thunk::PPB_Buffer_API;
-using ppapi::thunk::PPB_BufferTrusted_API;
 using ppapi::thunk::PPB_Instance_API;
 
 namespace ppapi {
@@ -45,7 +44,7 @@
     base::SharedMemoryHandle* shared_mem_handle) {
   if (!dispatcher || resource == 0 || !shared_mem_handle)
     return PP_FALSE;
-  EnterResourceNoLock<PPB_BufferTrusted_API> enter(resource, true);
+  EnterResourceNoLock<PPB_Buffer_API> enter(resource, true);
   if (enter.failed())
     return PP_FALSE;
   int handle;
@@ -75,22 +74,6 @@
   return var;
 }
 
-// Increments the reference count on |resource| to ensure that it remains valid
-// until the plugin receives the resource within the asynchronous message sent
-// from the proxy.  The plugin side takes ownership of that reference. Returns
-// PP_TRUE when the reference is successfully added, PP_FALSE otherwise.
-PP_Bool AddRefResourceForPlugin(HostDispatcher* dispatcher,
-                                PP_Resource resource) {
-  const PPB_Core* core = static_cast<const PPB_Core*>(
-      dispatcher->local_get_interface()(PPB_CORE_INTERFACE));
-  if (!core) {
-    NOTREACHED();
-    return PP_FALSE;
-  }
-  core->AddRefResource(resource);
-  return PP_TRUE;
-}
-
 bool InitializePppDecryptorBuffer(PP_Instance instance,
                                   HostDispatcher* dispatcher,
                                   PP_Resource resource,
@@ -107,9 +90,6 @@
     return true;
   }
 
-  if (!AddRefResourceForPlugin(dispatcher, resource))
-    return false;
-
   HostResource host_resource;
   host_resource.SetHostResource(instance, resource);
 
@@ -205,6 +185,11 @@
     return;
   }
 
+  // PluginResourceTracker in the plugin process assumes that resources that it
+  // tracks have been addrefed on behalf of the plugin at the renderer side. So
+  // we explicitly do it for |encryped_block| here.
+  PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(encrypted_block);
+
   dispatcher->Send(
       new PpapiMsg_PPPContentDecryptor_Decrypt(
           API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
@@ -238,6 +223,11 @@
     return;
   }
 
+  // PluginResourceTracker in the plugin process assumes that resources that it
+  // tracks have been addrefed on behalf of the plugin at the renderer side. So
+  // we explicitly do it for |extra_data_buffer| here.
+  PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(extra_data_buffer);
+
   dispatcher->Send(
       new PpapiMsg_PPPContentDecryptor_InitializeAudioDecoder(
           API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
@@ -271,6 +261,11 @@
     return;
   }
 
+  // PluginResourceTracker in the plugin process assumes that resources that it
+  // tracks have been addrefed on behalf of the plugin at the renderer side. So
+  // we explicitly do it for |extra_data_buffer| here.
+  PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(extra_data_buffer);
+
   dispatcher->Send(
       new PpapiMsg_PPPContentDecryptor_InitializeVideoDecoder(
           API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
@@ -339,6 +334,11 @@
     return;
   }
 
+  // PluginResourceTracker in the plugin process assumes that resources that it
+  // tracks have been addrefed on behalf of the plugin at the renderer side. So
+  // we explicitly do it for |encrypted_buffer| here.
+  PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(encrypted_buffer);
+
   dispatcher->Send(
       new PpapiMsg_PPPContentDecryptor_DecryptAndDecode(
           API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
@@ -384,6 +384,10 @@
 
 bool PPP_ContentDecryptor_Private_Proxy::OnMessageReceived(
     const IPC::Message& msg) {
+  if (!dispatcher()->IsPlugin())
+    return false;  // These are only valid from host->plugin.
+                   // Don't allow the plugin to send these to the host.
+
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPP_ContentDecryptor_Private_Proxy, msg)
     IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_GenerateKeyRequest,
@@ -452,17 +456,18 @@
     PP_Instance instance,
     const PPPDecryptor_Buffer& encrypted_buffer,
     const std::string& serialized_block_info) {
+  ScopedPPResource plugin_resource(
+      ScopedPPResource::PassRef(),
+      PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource,
+                                         encrypted_buffer.handle,
+                                         encrypted_buffer.size));
   if (ppp_decryptor_impl_) {
-    PP_Resource plugin_resource =
-        PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource,
-                                           encrypted_buffer.handle,
-                                           encrypted_buffer.size);
     PP_EncryptedBlockInfo block_info;
     if (!DeserializeBlockInfo(serialized_block_info, &block_info))
       return;
     CallWhileUnlocked(ppp_decryptor_impl_->Decrypt,
                       instance,
-                      plugin_resource,
+                      plugin_resource.get(),
                       const_cast<const PP_EncryptedBlockInfo*>(&block_info));
   }
 }
@@ -471,25 +476,25 @@
     PP_Instance instance,
     const std::string& serialized_decoder_config,
     const PPPDecryptor_Buffer& extra_data_buffer) {
+  ScopedPPResource plugin_resource;
+  if (extra_data_buffer.size > 0) {
+    plugin_resource = ScopedPPResource(
+        ScopedPPResource::PassRef(),
+        PPB_Buffer_Proxy::AddProxyResource(extra_data_buffer.resource,
+                                           extra_data_buffer.handle,
+                                           extra_data_buffer.size));
+  }
 
   PP_AudioDecoderConfig decoder_config;
   if (!DeserializeBlockInfo(serialized_decoder_config, &decoder_config))
       return;
 
   if (ppp_decryptor_impl_) {
-    PP_Resource plugin_resource = 0;
-    if (extra_data_buffer.size > 0) {
-      plugin_resource =
-          PPB_Buffer_Proxy::AddProxyResource(extra_data_buffer.resource,
-                                             extra_data_buffer.handle,
-                                             extra_data_buffer.size);
-    }
-
     CallWhileUnlocked(
         ppp_decryptor_impl_->InitializeAudioDecoder,
         instance,
         const_cast<const PP_AudioDecoderConfig*>(&decoder_config),
-        plugin_resource);
+        plugin_resource.get());
   }
 }
 
@@ -497,25 +502,25 @@
     PP_Instance instance,
     const std::string& serialized_decoder_config,
     const PPPDecryptor_Buffer& extra_data_buffer) {
+  ScopedPPResource plugin_resource;
+  if (extra_data_buffer.resource.host_resource() != 0) {
+    plugin_resource = ScopedPPResource(
+        ScopedPPResource::PassRef(),
+        PPB_Buffer_Proxy::AddProxyResource(extra_data_buffer.resource,
+                                           extra_data_buffer.handle,
+                                           extra_data_buffer.size));
+  }
 
   PP_VideoDecoderConfig decoder_config;
   if (!DeserializeBlockInfo(serialized_decoder_config, &decoder_config))
       return;
 
   if (ppp_decryptor_impl_) {
-    PP_Resource plugin_resource = 0;
-    if (extra_data_buffer.resource.host_resource() != 0) {
-      plugin_resource =
-          PPB_Buffer_Proxy::AddProxyResource(extra_data_buffer.resource,
-                                             extra_data_buffer.handle,
-                                             extra_data_buffer.size);
-    }
-
     CallWhileUnlocked(
         ppp_decryptor_impl_->InitializeVideoDecoder,
         instance,
         const_cast<const PP_VideoDecoderConfig*>(&decoder_config),
-        plugin_resource);
+        plugin_resource.get());
   }
 }
 
@@ -550,24 +555,24 @@
     PP_DecryptorStreamType decoder_type,
     const PPPDecryptor_Buffer& encrypted_buffer,
     const std::string& serialized_block_info) {
+  ScopedPPResource plugin_resource;
+  if (encrypted_buffer.resource.host_resource() != 0) {
+    plugin_resource = ScopedPPResource(
+        ScopedPPResource::PassRef(),
+        PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource,
+                                           encrypted_buffer.handle,
+                                           encrypted_buffer.size));
+  }
+
   if (ppp_decryptor_impl_) {
     PP_EncryptedBlockInfo block_info;
     if (!DeserializeBlockInfo(serialized_block_info, &block_info))
       return;
-
-    PP_Resource plugin_resource = 0;
-    if (encrypted_buffer.resource.host_resource() != 0) {
-      plugin_resource =
-          PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource,
-                                             encrypted_buffer.handle,
-                                             encrypted_buffer.size);
-    }
-
     CallWhileUnlocked(
         ppp_decryptor_impl_->DecryptAndDecode,
         instance,
         decoder_type,
-        plugin_resource,
+        plugin_resource.get(),
         const_cast<const PP_EncryptedBlockInfo*>(&block_info));
   }
 }
diff --git a/ppapi/proxy/ppp_graphics_3d_proxy.cc b/ppapi/proxy/ppp_graphics_3d_proxy.cc
index 8143f31..ee00a92 100644
--- a/ppapi/proxy/ppp_graphics_3d_proxy.cc
+++ b/ppapi/proxy/ppp_graphics_3d_proxy.cc
@@ -15,6 +15,7 @@
 
 namespace {
 
+#if !defined(OS_NACL)
 void ContextLost(PP_Instance instance) {
   HostDispatcher::GetForInstance(instance)->Send(
       new PpapiMsg_PPPGraphics3D_ContextLost(API_ID_PPP_GRAPHICS_3D, instance));
@@ -23,6 +24,10 @@
 static const PPP_Graphics3D graphics_3d_interface = {
   &ContextLost
 };
+#else
+// The NaCl plugin doesn't need the host side interface - stub it out.
+static const PPP_Graphics3D graphics_3d_interface = {};
+#endif  // !defined(OS_NACL)
 
 InterfaceProxy* CreateGraphics3DProxy(Dispatcher* dispatcher) {
   return new PPP_Graphics3D_Proxy(dispatcher);
@@ -55,6 +60,9 @@
 }
 
 bool PPP_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) {
+  if (!dispatcher()->IsPlugin())
+    return false;
+
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPP_Graphics3D_Proxy, msg)
     IPC_MESSAGE_HANDLER(PpapiMsg_PPPGraphics3D_ContextLost,
diff --git a/ppapi/proxy/ppp_input_event_proxy.cc b/ppapi/proxy/ppp_input_event_proxy.cc
index ce4eef0..8302dfd 100644
--- a/ppapi/proxy/ppp_input_event_proxy.cc
+++ b/ppapi/proxy/ppp_input_event_proxy.cc
@@ -4,12 +4,9 @@
 
 #include "ppapi/proxy/ppp_input_event_proxy.h"
 
-#include <algorithm>
-
 #include "ppapi/c/ppp_input_event.h"
 #include "ppapi/proxy/host_dispatcher.h"
 #include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/plugin_resource_tracker.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/shared_impl/ppb_input_event_shared.h"
 #include "ppapi/thunk/enter.h"
@@ -23,6 +20,7 @@
 
 namespace {
 
+#if !defined(OS_NACL)
 PP_Bool HandleInputEvent(PP_Instance instance, PP_Resource input_event) {
   EnterResourceNoLock<PPB_InputEvent_API> enter(input_event, false);
   if (enter.failed()) {
@@ -51,6 +49,10 @@
 static const PPP_InputEvent input_event_interface = {
   &HandleInputEvent
 };
+#else
+// The NaCl plugin doesn't need the host side interface - stub it out.
+static const PPP_InputEvent input_event_interface = {};
+#endif  // !defined(OS_NACL)
 
 InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher) {
   return new PPP_InputEvent_Proxy(dispatcher);
@@ -83,6 +85,9 @@
 }
 
 bool PPP_InputEvent_Proxy::OnMessageReceived(const IPC::Message& msg) {
+  if (!dispatcher()->IsPlugin())
+    return false;
+
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPP_InputEvent_Proxy, msg)
     IPC_MESSAGE_HANDLER(PpapiMsg_PPPInputEvent_HandleInputEvent,
@@ -101,7 +106,6 @@
   CallWhileUnlocked(ppp_input_event_impl_->HandleInputEvent,
                     instance,
                     resource->pp_resource());
-  HandleInputEventAck(instance, data.event_time_stamp);
 }
 
 void PPP_InputEvent_Proxy::OnMsgHandleFilteredInputEvent(
@@ -113,19 +117,6 @@
   *result = CallWhileUnlocked(ppp_input_event_impl_->HandleInputEvent,
                               instance,
                               resource->pp_resource());
-  HandleInputEventAck(instance, data.event_time_stamp);
-}
-
-void PPP_InputEvent_Proxy::HandleInputEventAck(
-    PP_Instance instance, PP_TimeTicks timestamp) {
-  PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
-  if (dispatcher) {
-    // Note that we're sending the message to the host PPB_InstanceProxy.
-    dispatcher->Send(new PpapiMsg_PPPInputEvent_HandleInputEvent_ACK(
-        API_ID_PPB_INSTANCE, instance, timestamp));
-  } else {
-    NOTREACHED();
-  }
 }
 
 }  // namespace proxy
diff --git a/ppapi/proxy/ppp_input_event_proxy.h b/ppapi/proxy/ppp_input_event_proxy.h
index e326aec..a7cc054 100644
--- a/ppapi/proxy/ppp_input_event_proxy.h
+++ b/ppapi/proxy/ppp_input_event_proxy.h
@@ -6,7 +6,6 @@
 #define PPAPI_PROXY_PPP_INPUT_EVENT_PROXY_H_
 
 #include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_time.h"
 #include "ppapi/c/ppp_input_event.h"
 #include "ppapi/proxy/interface_proxy.h"
 
@@ -34,8 +33,6 @@
                                      const ppapi::InputEventData& data,
                                      PP_Bool* result);
 
-  void HandleInputEventAck(PP_Instance instance, PP_TimeTicks timestamp);
-
   // When this proxy is in the plugin side, this value caches the interface
   // pointer so we don't have to retrieve it from the dispatcher each time.
   // In the host, this value is always NULL.
diff --git a/ppapi/proxy/ppp_instance_private_proxy.cc b/ppapi/proxy/ppp_instance_private_proxy.cc
index 678d30b..1d8b8d7 100644
--- a/ppapi/proxy/ppp_instance_private_proxy.cc
+++ b/ppapi/proxy/ppp_instance_private_proxy.cc
@@ -21,6 +21,9 @@
 
 PP_Var GetInstanceObject(PP_Instance instance) {
   Dispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
+  if (!dispatcher->permissions().HasPermission(PERMISSION_PRIVATE))
+    return PP_MakeUndefined();
+
   ReceiveSerializedVarReturnValue result;
   dispatcher->Send(new PpapiMsg_PPPInstancePrivate_GetInstanceObject(
       API_ID_PPP_INSTANCE_PRIVATE, instance, &result));
@@ -62,6 +65,9 @@
 }
 
 bool PPP_Instance_Private_Proxy::OnMessageReceived(const IPC::Message& msg) {
+  if (!dispatcher()->IsPlugin())
+    return false;
+
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPP_Instance_Private_Proxy, msg)
     IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstancePrivate_GetInstanceObject,
diff --git a/ppapi/proxy/ppp_instance_proxy.cc b/ppapi/proxy/ppp_instance_proxy.cc
index 16287ba..eb1d4e4 100644
--- a/ppapi/proxy/ppp_instance_proxy.cc
+++ b/ppapi/proxy/ppp_instance_proxy.cc
@@ -11,7 +11,6 @@
 #include "ppapi/c/ppb_core.h"
 #include "ppapi/c/ppb_fullscreen.h"
 #include "ppapi/c/ppp_instance.h"
-#include "ppapi/c/private/ppb_flash_fullscreen.h"
 #include "ppapi/proxy/host_dispatcher.h"
 #include "ppapi/proxy/plugin_dispatcher.h"
 #include "ppapi/proxy/plugin_resource_tracker.h"
@@ -21,22 +20,22 @@
 #include "ppapi/shared_impl/ppb_view_shared.h"
 #include "ppapi/shared_impl/scoped_pp_resource.h"
 #include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_fullscreen_api.h"
 #include "ppapi/thunk/ppb_view_api.h"
 
 namespace ppapi {
 namespace proxy {
 
+using thunk::EnterInstanceAPINoLock;
+using thunk::EnterInstanceNoLock;
+using thunk::EnterResourceNoLock;
+using thunk::PPB_Flash_Fullscreen_API;
+using thunk::PPB_Instance_API;
+using thunk::PPB_View_API;
+
 namespace {
 
-PP_Bool IsFlashFullscreen(PP_Instance instance,
-                          HostDispatcher* dispatcher) {
-  const PPB_FlashFullscreen* flash_fullscreen_interface =
-      static_cast<const PPB_FlashFullscreen*>(
-          dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE));
-  DCHECK(flash_fullscreen_interface);
-  return flash_fullscreen_interface->IsFullscreen(instance);
-}
-
+#if !defined(OS_NACL)
 PP_Bool DidCreate(PP_Instance instance,
                   uint32_t argc,
                   const char* argn[],
@@ -63,15 +62,19 @@
 void DidChangeView(PP_Instance instance, PP_Resource view_resource) {
   HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
 
-  thunk::EnterResourceNoLock<thunk::PPB_View_API> enter(view_resource, false);
-  if (enter.failed()) {
+  EnterResourceNoLock<PPB_View_API> enter_view(view_resource, false);
+  if (enter_view.failed()) {
     NOTREACHED();
     return;
   }
 
+  PP_Bool flash_fullscreen = PP_FALSE;
+  EnterInstanceNoLock enter_instance(instance);
+  if (!enter_instance.failed())
+    flash_fullscreen = enter_instance.functions()->FlashIsFullscreen(instance);
   dispatcher->Send(new PpapiMsg_PPPInstance_DidChangeView(
-      API_ID_PPP_INSTANCE, instance, enter.object()->GetData(),
-      IsFlashFullscreen(instance, dispatcher)));
+      API_ID_PPP_INSTANCE, instance, enter_view.object()->GetData(),
+      flash_fullscreen));
 }
 
 void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) {
@@ -119,6 +122,7 @@
   &DidChangeFocus,
   &HandleDocumentLoad
 };
+#endif  // !defined(OS_NACL)
 
 }  // namespace
 
@@ -142,12 +146,17 @@
 PPP_Instance_Proxy::~PPP_Instance_Proxy() {
 }
 
+#if !defined(OS_NACL)
 // static
 const PPP_Instance* PPP_Instance_Proxy::GetInstanceInterface() {
   return &instance_interface;
 }
+#endif  // !defined(OS_NACL)
 
 bool PPP_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) {
+  if (!dispatcher()->IsPlugin())
+    return false;
+
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPP_Instance_Proxy, msg)
     IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidCreate,
@@ -219,9 +228,13 @@
   InstanceData* data = dispatcher->GetInstanceData(instance);
   if (!data)
     return;
-
   data->view = new_data;
-  data->flash_fullscreen = flash_fullscreen;
+
+#if !defined(OS_NACL)
+  EnterInstanceAPINoLock<PPB_Flash_Fullscreen_API> enter(instance);
+  if (!enter.failed())
+    enter.functions()->SetLocalIsFullscreen(instance, flash_fullscreen);
+#endif  // !defined(OS_NACL)
 
   ScopedPPResource resource(
       ScopedPPResource::PassRef(),
diff --git a/ppapi/proxy/ppp_instance_proxy_unittest.cc b/ppapi/proxy/ppp_instance_proxy_unittest.cc
index 199cc51..91775b0 100644
--- a/ppapi/proxy/ppp_instance_proxy_unittest.cc
+++ b/ppapi/proxy/ppp_instance_proxy_unittest.cc
@@ -161,6 +161,7 @@
   data.is_fullscreen = false;
   data.is_page_visible = true;
   data.clip_rect = expected_clip;
+  data.device_scale = 1.0f;
   ResetReceived();
   ScopedPPResource view_resource(
       ScopedPPResource::PassRef(),
diff --git a/ppapi/proxy/ppp_messaging_proxy.cc b/ppapi/proxy/ppp_messaging_proxy.cc
index 16e639e..5a12419 100644
--- a/ppapi/proxy/ppp_messaging_proxy.cc
+++ b/ppapi/proxy/ppp_messaging_proxy.cc
@@ -21,6 +21,7 @@
 
 namespace {
 
+#if !defined(OS_NACL)
 void HandleMessage(PP_Instance instance, PP_Var message_data) {
   HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
   if (!dispatcher || (message_data.type == PP_VARTYPE_OBJECT)) {
@@ -33,12 +34,16 @@
   dispatcher->Send(new PpapiMsg_PPPMessaging_HandleMessage(
       API_ID_PPP_MESSAGING,
       instance,
-      SerializedVarSendInput(dispatcher, message_data)));
+      SerializedVarSendInputShmem(dispatcher, message_data, instance)));
 }
 
 static const PPP_Messaging messaging_interface = {
   &HandleMessage
 };
+#else
+// The NaCl plugin doesn't need the host side interface - stub it out.
+static const PPP_Messaging messaging_interface = {};
+#endif  // !defined(OS_NACL)
 
 InterfaceProxy* CreateMessagingProxy(Dispatcher* dispatcher) {
   return new PPP_Messaging_Proxy(dispatcher);
@@ -71,6 +76,9 @@
 }
 
 bool PPP_Messaging_Proxy::OnMessageReceived(const IPC::Message& msg) {
+  if (!dispatcher()->IsPlugin())
+    return false;
+
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPP_Messaging_Proxy, msg)
     IPC_MESSAGE_HANDLER(PpapiMsg_PPPMessaging_HandleMessage,
@@ -82,7 +90,7 @@
 
 void PPP_Messaging_Proxy::OnMsgHandleMessage(
     PP_Instance instance, SerializedVarReceiveInput message_data) {
-  PP_Var received_var(message_data.Get(dispatcher()));
+  PP_Var received_var(message_data.GetForInstance(dispatcher(), instance));
   // SerializedVarReceiveInput will decrement the reference count, but we want
   // to give the recipient a reference.
   PpapiGlobals::Get()->GetVarTracker()->AddRefVar(received_var);
diff --git a/ppapi/proxy/ppp_messaging_proxy_unittest.cc b/ppapi/proxy/ppp_messaging_proxy_unittest.cc
index 98cfadd..1fe0ef7 100644
--- a/ppapi/proxy/ppp_messaging_proxy_unittest.cc
+++ b/ppapi/proxy/ppp_messaging_proxy_unittest.cc
@@ -9,6 +9,7 @@
 #include "ppapi/c/ppb_var.h"
 #include "ppapi/c/ppp_messaging.h"
 #include "ppapi/proxy/ppapi_proxy_test.h"
+#include "ppapi/shared_impl/proxy_lock.h"
 #include "ppapi/shared_impl/var.h"
 
 namespace ppapi {
@@ -53,6 +54,7 @@
 void CompareAndReleaseStringVar(PluginProxyTestHarness* plugin_harness,
                                 PP_Var received_var,
                                 const std::string& test_string) {
+  ProxyAutoLock lock;
   Var* received_string = plugin_harness->var_tracker().GetVar(received_var);
   ASSERT_TRUE(received_string);
   ASSERT_TRUE(received_string->AsStringVar());
diff --git a/ppapi/proxy/ppp_mouse_lock_proxy.cc b/ppapi/proxy/ppp_mouse_lock_proxy.cc
index 10aa47f..6fd746d 100644
--- a/ppapi/proxy/ppp_mouse_lock_proxy.cc
+++ b/ppapi/proxy/ppp_mouse_lock_proxy.cc
@@ -14,6 +14,7 @@
 
 namespace {
 
+#if !defined(OS_NACL)
 void MouseLockLost(PP_Instance instance) {
   HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
   if (!dispatcher) {
@@ -29,6 +30,10 @@
 static const PPP_MouseLock mouse_lock_interface = {
   &MouseLockLost
 };
+#else
+// The NaCl plugin doesn't need the host side interface - stub it out.
+static const PPP_MouseLock mouse_lock_interface = {};
+#endif  // !defined(OS_NACL)
 
 InterfaceProxy* CreateMouseLockProxy(Dispatcher* dispatcher) {
   return new PPP_MouseLock_Proxy(dispatcher);
@@ -61,6 +66,9 @@
 }
 
 bool PPP_MouseLock_Proxy::OnMessageReceived(const IPC::Message& msg) {
+  if (!dispatcher()->IsPlugin())
+    return false;
+
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPP_MouseLock_Proxy, msg)
     IPC_MESSAGE_HANDLER(PpapiMsg_PPPMouseLock_MouseLockLost,
diff --git a/ppapi/proxy/ppp_printing_proxy.cc b/ppapi/proxy/ppp_printing_proxy.cc
index 32123e8..9d58c78 100644
--- a/ppapi/proxy/ppp_printing_proxy.cc
+++ b/ppapi/proxy/ppp_printing_proxy.cc
@@ -19,7 +19,17 @@
 
 namespace {
 
+#if !defined(OS_NACL)
+bool HasPrintingPermission(PP_Instance instance) {
+  Dispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
+  if (!dispatcher)
+    return false;
+  return dispatcher->permissions().HasPermission(PERMISSION_DEV);
+}
+
 uint32_t QuerySupportedFormats(PP_Instance instance) {
+  if (!HasPrintingPermission(instance))
+    return 0;
   uint32_t result = 0;
   HostDispatcher::GetForInstance(instance)->Send(
       new PpapiMsg_PPPPrinting_QuerySupportedFormats(API_ID_PPP_PRINTING,
@@ -29,6 +39,8 @@
 
 int32_t Begin(PP_Instance instance,
               const struct PP_PrintSettings_Dev* print_settings) {
+  if (!HasPrintingPermission(instance))
+    return 0;
   // Settings is just serialized as a string.
   std::string settings_string;
   settings_string.resize(sizeof(*print_settings));
@@ -44,6 +56,8 @@
 PP_Resource PrintPages(PP_Instance instance,
                        const PP_PrintPageNumberRange_Dev* page_ranges,
                        uint32_t page_range_count) {
+  if (!HasPrintingPermission(instance))
+    return 0;
   std::vector<PP_PrintPageNumberRange_Dev> pages(
       page_ranges, page_ranges + page_range_count);
 
@@ -65,11 +79,15 @@
 }
 
 void End(PP_Instance instance) {
+  if (!HasPrintingPermission(instance))
+    return;
   HostDispatcher::GetForInstance(instance)->Send(
       new PpapiMsg_PPPPrinting_End(API_ID_PPP_PRINTING, instance));
 }
 
 PP_Bool IsScalingDisabled(PP_Instance instance) {
+  if (!HasPrintingPermission(instance))
+    return PP_FALSE;
   bool result = false;
   HostDispatcher::GetForInstance(instance)->Send(
       new PpapiMsg_PPPPrinting_IsScalingDisabled(API_ID_PPP_PRINTING,
@@ -84,6 +102,10 @@
   &End,
   &IsScalingDisabled
 };
+#else
+// The NaCl plugin doesn't need the host side interface - stub it out.
+static const PPP_Printing_Dev ppp_printing_interface = {};
+#endif  // !defined(OS_NACL)
 
 }  // namespace
 
@@ -105,6 +127,9 @@
 }
 
 bool PPP_Printing_Proxy::OnMessageReceived(const IPC::Message& msg) {
+  if (!dispatcher()->IsPlugin())
+    return false;
+
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPP_Printing_Proxy, msg)
     IPC_MESSAGE_HANDLER(PpapiMsg_PPPPrinting_QuerySupportedFormats,
@@ -124,10 +149,12 @@
 
 void PPP_Printing_Proxy::OnPluginMsgQuerySupportedFormats(PP_Instance instance,
                                                           uint32_t* result) {
-  if (ppp_printing_impl_)
-    *result = ppp_printing_impl_->QuerySupportedFormats(instance);
-  else
+  if (ppp_printing_impl_) {
+    *result = CallWhileUnlocked(ppp_printing_impl_->QuerySupportedFormats,
+                                instance);
+  } else {
     *result = 0;
+  }
 }
 
 void PPP_Printing_Proxy::OnPluginMsgBegin(PP_Instance instance,
@@ -140,8 +167,11 @@
     return;
   memcpy(&settings, &settings_string[0], sizeof(settings));
 
-  if (ppp_printing_impl_)
-    *result = ppp_printing_impl_->Begin(instance, &settings);
+  if (ppp_printing_impl_) {
+    *result = CallWhileUnlocked(ppp_printing_impl_->Begin,
+        instance,
+        const_cast<const PP_PrintSettings_Dev*>(&settings));
+  }
 }
 
 void PPP_Printing_Proxy::OnPluginMsgPrintPages(
@@ -151,7 +181,8 @@
   if (!ppp_printing_impl_ || pages.empty())
     return;
 
-  PP_Resource plugin_resource = ppp_printing_impl_->PrintPages(
+  PP_Resource plugin_resource = CallWhileUnlocked(
+      ppp_printing_impl_->PrintPages,
       instance, &pages[0], static_cast<uint32_t>(pages.size()));
   ResourceTracker* resource_tracker = PpapiGlobals::Get()->GetResourceTracker();
   Resource* resource_object = resource_tracker->GetResource(plugin_resource);
@@ -166,15 +197,17 @@
 
 void PPP_Printing_Proxy::OnPluginMsgEnd(PP_Instance instance) {
   if (ppp_printing_impl_)
-    ppp_printing_impl_->End(instance);
+    CallWhileUnlocked(ppp_printing_impl_->End, instance);
 }
 
 void PPP_Printing_Proxy::OnPluginMsgIsScalingDisabled(PP_Instance instance,
                                                       bool* result) {
-  if (ppp_printing_impl_)
-    *result = PP_ToBool(ppp_printing_impl_->IsScalingDisabled(instance));
-  else
+  if (ppp_printing_impl_) {
+    *result = PP_ToBool(CallWhileUnlocked(ppp_printing_impl_->IsScalingDisabled,
+                                          instance));
+  } else {
     *result = false;
+  }
 }
 
 }  // namespace proxy
diff --git a/ppapi/proxy/ppp_text_input_proxy.cc b/ppapi/proxy/ppp_text_input_proxy.cc
index 8a8254a..061b73c 100644
--- a/ppapi/proxy/ppp_text_input_proxy.cc
+++ b/ppapi/proxy/ppp_text_input_proxy.cc
@@ -14,6 +14,7 @@
 
 namespace {
 
+#if !defined(OS_NACL)
 void RequestSurroundingText(PP_Instance instance,
                             uint32_t desired_number_of_characters) {
   proxy::HostDispatcher* dispatcher =
@@ -31,6 +32,10 @@
 const PPP_TextInput_Dev g_ppp_text_input_thunk = {
   &RequestSurroundingText
 };
+#else
+// The NaCl plugin doesn't need the host side interface - stub it out.
+static const PPP_TextInput_Dev g_ppp_text_input_thunk = {};
+#endif  // !defined(OS_NACL)
 
 }  // namespace
 
@@ -52,6 +57,9 @@
 }
 
 bool PPP_TextInput_Proxy::OnMessageReceived(const IPC::Message& msg) {
+  if (!dispatcher()->IsPlugin())
+    return false;
+
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPP_TextInput_Proxy, msg)
     IPC_MESSAGE_HANDLER(PpapiMsg_PPPTextInput_RequestSurroundingText,
diff --git a/ppapi/proxy/ppp_video_decoder_proxy.cc b/ppapi/proxy/ppp_video_decoder_proxy.cc
index 0f4bd25..a24d4c3 100644
--- a/ppapi/proxy/ppp_video_decoder_proxy.cc
+++ b/ppapi/proxy/ppp_video_decoder_proxy.cc
@@ -102,6 +102,9 @@
 }
 
 bool PPP_VideoDecoder_Proxy::OnMessageReceived(const IPC::Message& msg) {
+  if (!dispatcher()->IsPlugin())
+    return false;
+
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PPP_VideoDecoder_Proxy, msg)
     IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_ProvidePictureBuffers,
diff --git a/ppapi/proxy/proxy_channel.cc b/ppapi/proxy/proxy_channel.cc
index d1c47a5..81eb9a4 100644
--- a/ppapi/proxy/proxy_channel.cc
+++ b/ppapi/proxy/proxy_channel.cc
@@ -4,6 +4,8 @@
 
 #include "ppapi/proxy/proxy_channel.h"
 
+#include "base/logging.h"
+#include "base/process_util.h"
 #include "ipc/ipc_platform_file.h"
 #include "ipc/ipc_test_sink.h"
 
@@ -16,6 +18,7 @@
 
 ProxyChannel::ProxyChannel()
     : delegate_(NULL),
+      peer_pid_(base::kNullProcessId),
       test_sink_(NULL) {
 }
 
@@ -24,9 +27,11 @@
 }
 
 bool ProxyChannel::InitWithChannel(Delegate* delegate,
+                                   base::ProcessId peer_pid,
                                    const IPC::ChannelHandle& channel_handle,
                                    bool is_client) {
   delegate_ = delegate;
+  peer_pid_ = peer_pid;
   IPC::Channel::Mode mode = is_client ? IPC::Channel::MODE_CLIENT
                                       : IPC::Channel::MODE_SERVER;
   channel_.reset(new IPC::SyncChannel(channel_handle, mode, this,
@@ -38,6 +43,9 @@
 void ProxyChannel::InitWithTestSink(IPC::TestSink* test_sink) {
   DCHECK(!test_sink_);
   test_sink_ = test_sink;
+#if !defined(OS_NACL)
+  peer_pid_ = base::GetCurrentProcId();
+#endif
 }
 
 void ProxyChannel::OnChannelError() {
@@ -65,7 +73,8 @@
     }
     return IPC::InvalidPlatformFileForTransit();
   }
-  return delegate_->ShareHandleWithRemote(handle, *channel_,
+  DCHECK(peer_pid_ != base::kNullProcessId);
+  return delegate_->ShareHandleWithRemote(handle, peer_pid_,
                                           should_close_source);
 }
 
diff --git a/ppapi/proxy/proxy_channel.h b/ppapi/proxy/proxy_channel.h
index bb08f79..d35f98a 100644
--- a/ppapi/proxy/proxy_channel.h
+++ b/ppapi/proxy/proxy_channel.h
@@ -47,7 +47,7 @@
     // guarantees as ProxyChannel::ShareHandleWithRemote below.
     virtual IPC::PlatformFileForTransit ShareHandleWithRemote(
         base::PlatformFile handle,
-        const IPC::SyncChannel& channel,
+        base::ProcessId remote_pid,
         bool should_close_source) = 0;
   };
 
@@ -55,7 +55,8 @@
 
   // Alternative to InitWithChannel() for unit tests that want to send all
   // messages sent via this channel to the given test sink. The test sink
-  // must outlive this class.
+  // must outlive this class. In this case, the peer PID will be the current
+  // process ID.
   void InitWithTestSink(IPC::TestSink* test_sink);
 
   // Shares a file handle (HANDLE / file descriptor) with the remote side. It
@@ -90,6 +91,7 @@
   // The delegate pointer must outlive this class, ownership is not
   // transferred.
   virtual bool InitWithChannel(Delegate* delegate,
+                               base::ProcessId peer_pid,
                                const IPC::ChannelHandle& channel_handle,
                                bool is_client);
 
@@ -101,6 +103,11 @@
   // Non-owning pointer. Guaranteed non-NULL after init is called.
   ProxyChannel::Delegate* delegate_;
 
+  // PID of the remote process. Use this instead of the Channel::peer_pid since
+  // this is set synchronously on construction rather than waiting on the
+  // "hello" message from the peer (which introduces a race condition).
+  base::ProcessId peer_pid_;
+
   // When we're unit testing, this will indicate the sink for the messages to
   // be deposited so they can be inspected by the test. When non-NULL, this
   // indicates that the channel should not be used.
diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc
index 339bf17..4aec036 100644
--- a/ppapi/proxy/resource_creation_proxy.cc
+++ b/ppapi/proxy/resource_creation_proxy.cc
@@ -8,45 +8,47 @@
 #include "ppapi/c/pp_size.h"
 #include "ppapi/c/trusted/ppb_image_data_trusted.h"
 #include "ppapi/proxy/audio_input_resource.h"
+#include "ppapi/proxy/browser_font_resource_trusted.h"
 #include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/directory_reader_resource.h"
 #include "ppapi/proxy/file_chooser_resource.h"
+#include "ppapi/proxy/file_io_resource.h"
 #include "ppapi/proxy/flash_device_id_resource.h"
 #include "ppapi/proxy/flash_font_file_resource.h"
+#include "ppapi/proxy/flash_menu_resource.h"
+#include "ppapi/proxy/graphics_2d_resource.h"
+#include "ppapi/proxy/host_resolver_private_resource.h"
 #include "ppapi/proxy/plugin_dispatcher.h"
 #include "ppapi/proxy/plugin_globals.h"
-#include "ppapi/proxy/plugin_proxy_delegate.h"
 #include "ppapi/proxy/plugin_resource_tracker.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/proxy/ppb_audio_proxy.h"
-#include "ppapi/proxy/ppb_buffer_proxy.h"
 #include "ppapi/proxy/ppb_broker_proxy.h"
-#include "ppapi/proxy/ppb_file_io_proxy.h"
+#include "ppapi/proxy/ppb_buffer_proxy.h"
 #include "ppapi/proxy/ppb_file_ref_proxy.h"
 #include "ppapi/proxy/ppb_file_system_proxy.h"
-#include "ppapi/proxy/ppb_flash_menu_proxy.h"
 #include "ppapi/proxy/ppb_flash_message_loop_proxy.h"
-#include "ppapi/proxy/ppb_graphics_2d_proxy.h"
 #include "ppapi/proxy/ppb_graphics_3d_proxy.h"
-#include "ppapi/proxy/ppb_host_resolver_private_proxy.h"
 #include "ppapi/proxy/ppb_image_data_proxy.h"
 #include "ppapi/proxy/ppb_network_monitor_private_proxy.h"
-#include "ppapi/proxy/ppb_talk_private_proxy.h"
 #include "ppapi/proxy/ppb_tcp_server_socket_private_proxy.h"
 #include "ppapi/proxy/ppb_tcp_socket_private_proxy.h"
-#include "ppapi/proxy/ppb_udp_socket_private_proxy.h"
 #include "ppapi/proxy/ppb_url_loader_proxy.h"
-#include "ppapi/proxy/ppb_video_capture_proxy.h"
 #include "ppapi/proxy/ppb_video_decoder_proxy.h"
 #include "ppapi/proxy/ppb_x509_certificate_private_proxy.h"
 #include "ppapi/proxy/printing_resource.h"
+#include "ppapi/proxy/talk_resource.h"
+#include "ppapi/proxy/truetype_font_resource.h"
+#include "ppapi/proxy/udp_socket_private_resource.h"
 #include "ppapi/proxy/url_request_info_resource.h"
+#include "ppapi/proxy/url_response_info_resource.h"
+#include "ppapi/proxy/video_capture_resource.h"
 #include "ppapi/proxy/websocket_resource.h"
 #include "ppapi/shared_impl/api_id.h"
 #include "ppapi/shared_impl/host_resource.h"
 #include "ppapi/shared_impl/ppb_audio_config_shared.h"
 #include "ppapi/shared_impl/ppb_input_event_shared.h"
 #include "ppapi/shared_impl/ppb_resource_array_shared.h"
-#include "ppapi/shared_impl/private/ppb_browser_font_trusted_shared.h"
 #include "ppapi/shared_impl/var.h"
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/ppb_image_data_api.h"
@@ -69,7 +71,7 @@
 }
 
 PP_Resource ResourceCreationProxy::CreateFileIO(PP_Instance instance) {
-  return PPB_FileIO_Proxy::CreateProxyResource(instance);
+  return (new FileIOResource(GetConnection(), instance))->GetReference();
 }
 
 PP_Resource ResourceCreationProxy::CreateFileRef(PP_Resource file_system,
@@ -142,6 +144,14 @@
   return object->GetReference();
 }
 
+PP_Resource ResourceCreationProxy::CreateTrueTypeFont(
+    PP_Instance instance,
+    const PP_TrueTypeFontDesc_Dev& desc) {
+  return (new TrueTypeFontResource(GetConnection(),
+                                   instance, desc))->GetReference();
+
+}
+
 PP_Resource ResourceCreationProxy::CreateURLLoader(PP_Instance instance) {
   return PPB_URLLoader_Proxy::CreateProxyResource(instance);
 }
@@ -153,6 +163,15 @@
                                      instance, data))->GetReference();
 }
 
+PP_Resource ResourceCreationProxy::CreateURLResponseInfo(
+    PP_Instance instance,
+    const URLResponseInfoData& data,
+    PP_Resource file_ref_resource) {
+  return (new URLResponseInfoResource(GetConnection(), instance,
+                                      data,
+                                      file_ref_resource))->GetReference();
+}
+
 PP_Resource ResourceCreationProxy::CreateWheelInputEvent(
     PP_Instance instance,
     PP_TimeTicks time_stamp,
@@ -187,30 +206,19 @@
       OBJECT_IS_PROXY, instance, sample_rate, sample_frame_count);
 }
 
-PP_Resource ResourceCreationProxy::CreateImageData(PP_Instance instance,
-                                                   PP_ImageDataFormat format,
-                                                   const PP_Size& size,
-                                                   PP_Bool init_to_zero) {
-  return PPB_ImageData_Proxy::CreateProxyResource(instance, format, size,
-                                                  init_to_zero);
-}
-
-PP_Resource ResourceCreationProxy::CreateImageDataNaCl(
+PP_Resource ResourceCreationProxy::CreateFileChooser(
     PP_Instance instance,
-    PP_ImageDataFormat format,
-    const PP_Size& size,
-    PP_Bool init_to_zero) {
-  // These really only are different on the host side. On the plugin side, we
-  // always request a "platform" ImageData if we're trusted, or a "NaCl" one
-  // if we're untrusted (see PPB_ImageData_Proxy::CreateProxyResource()).
-  return CreateImageData(instance, format, size, init_to_zero);
+    PP_FileChooserMode_Dev mode,
+    const char* accept_types) {
+  return (new FileChooserResource(GetConnection(), instance, mode,
+                                  accept_types))->GetReference();
 }
 
 PP_Resource ResourceCreationProxy::CreateGraphics2D(PP_Instance instance,
                                                     const PP_Size& size,
                                                     PP_Bool is_always_opaque) {
-  return PPB_Graphics2D_Proxy::CreateProxyResource(instance, size,
-                                                   is_always_opaque);
+  return (new Graphics2DResource(GetConnection(), instance, size,
+                                 is_always_opaque))->GetReference();
 }
 
 PP_Resource ResourceCreationProxy::CreateGraphics3D(
@@ -232,7 +240,27 @@
 
 PP_Resource ResourceCreationProxy::CreateHostResolverPrivate(
     PP_Instance instance) {
-  return PPB_HostResolver_Private_Proxy::CreateProxyResource(instance);
+  return (new HostResolverPrivateResource(
+      GetConnection(), instance))->GetReference();
+}
+
+PP_Resource ResourceCreationProxy::CreateImageData(PP_Instance instance,
+                                                   PP_ImageDataFormat format,
+                                                   const PP_Size& size,
+                                                   PP_Bool init_to_zero) {
+  return PPB_ImageData_Proxy::CreateProxyResource(instance, format, size,
+                                                  init_to_zero);
+}
+
+PP_Resource ResourceCreationProxy::CreateImageDataNaCl(
+    PP_Instance instance,
+    PP_ImageDataFormat format,
+    const PP_Size& size,
+    PP_Bool init_to_zero) {
+  // These really only are different on the host side. On the plugin side, we
+  // always request a "platform" ImageData if we're trusted, or a "NaCl" one
+  // if we're untrusted (see PPB_ImageData_Proxy::CreateProxyResource()).
+  return CreateImageData(instance, format, size, init_to_zero);
 }
 
 PP_Resource ResourceCreationProxy::CreateNetworkMonitor(
@@ -243,6 +271,10 @@
       instance, callback, user_data);
 }
 
+PP_Resource ResourceCreationProxy::CreatePrinting(PP_Instance instance) {
+  return (new PrintingResource(GetConnection(), instance))->GetReference();
+}
+
 PP_Resource ResourceCreationProxy::CreateTCPServerSocketPrivate(
     PP_Instance instance) {
   return PPB_TCPServerSocket_Private_Proxy::CreateProxyResource(instance);
@@ -255,7 +287,8 @@
 
 PP_Resource ResourceCreationProxy::CreateUDPSocketPrivate(
     PP_Instance instance) {
-  return PPB_UDPSocket_Private_Proxy::CreateProxyResource(instance);
+  return (new UDPSocketPrivateResource(
+      GetConnection(), instance))->GetReference();
 }
 
 PP_Resource ResourceCreationProxy::CreateWebSocket(PP_Instance instance) {
@@ -283,8 +316,10 @@
   PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
   if (!dispatcher)
     return 0;
-  return PPB_BrowserFont_Trusted_Shared::Create(
-      OBJECT_IS_PROXY, instance, *description, dispatcher->preferences());
+  if (!BrowserFontResource_Trusted::IsPPFontDescriptionValid(*description))
+    return 0;
+  return (new BrowserFontResource_Trusted(GetConnection(), instance,
+      *description, dispatcher->preferences()))->GetReference();
 }
 
 PP_Resource ResourceCreationProxy::CreateBuffer(PP_Instance instance,
@@ -293,17 +328,10 @@
 }
 
 PP_Resource ResourceCreationProxy::CreateDirectoryReader(
-    PP_Resource directory_ref) {
-  NOTIMPLEMENTED();  // Not proxied yet.
-  return 0;
-}
-
-PP_Resource ResourceCreationProxy::CreateFileChooser(
     PP_Instance instance,
-    PP_FileChooserMode_Dev mode,
-    const char* accept_types) {
-  return (new FileChooserResource(GetConnection(), instance, mode,
-                                  accept_types))->GetReference();
+    PP_Resource directory_ref) {
+  return (new DirectoryReaderResource(
+      GetConnection(), instance, directory_ref))->GetReference();
 }
 
 PP_Resource ResourceCreationProxy::CreateFlashDeviceID(PP_Instance instance) {
@@ -312,7 +340,7 @@
 
 PP_Resource ResourceCreationProxy::CreateFlashFontFile(
     PP_Instance instance,
-    const PP_FontDescription_Dev* description,
+    const PP_BrowserFont_Trusted_Description* description,
     PP_PrivateFontCharset charset) {
   return (new FlashFontFileResource(
       GetConnection(), instance, description, charset))->GetReference();
@@ -321,7 +349,11 @@
 PP_Resource ResourceCreationProxy::CreateFlashMenu(
     PP_Instance instance,
     const PP_Flash_Menu* menu_data) {
-  return PPB_Flash_Menu_Proxy::CreateProxyResource(instance, menu_data);
+  scoped_refptr<FlashMenuResource> flash_menu(
+      new FlashMenuResource(GetConnection(), instance));
+  if (!flash_menu->Initialize(menu_data))
+    return 0;
+  return flash_menu->GetReference();
 }
 
 PP_Resource ResourceCreationProxy::CreateFlashMessageLoop(
@@ -329,10 +361,6 @@
   return PPB_Flash_MessageLoop_Proxy::CreateProxyResource(instance);
 }
 
-PP_Resource ResourceCreationProxy::CreatePrinting(PP_Instance instance) {
-  return (new PrintingResource(GetConnection(), instance))->GetReference();
-}
-
 PP_Resource ResourceCreationProxy::CreateScrollbar(PP_Instance instance,
                                                    PP_Bool vertical) {
   NOTIMPLEMENTED();  // Not proxied yet.
@@ -340,11 +368,15 @@
 }
 
 PP_Resource ResourceCreationProxy::CreateTalk(PP_Instance instance) {
-  return PPB_Talk_Private_Proxy::CreateProxyResource(instance);
+  return (new TalkResource(GetConnection(), instance))->GetReference();
 }
 
 PP_Resource ResourceCreationProxy::CreateVideoCapture(PP_Instance instance) {
-  return PPB_VideoCapture_Proxy::CreateProxyResource(instance);
+  PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
+  if (!dispatcher)
+    return 0;
+  return (new VideoCaptureResource(GetConnection(), instance, dispatcher))
+      ->GetReference();
 }
 
 PP_Resource ResourceCreationProxy::CreateVideoDecoder(
@@ -366,9 +398,7 @@
 }
 
 Connection ResourceCreationProxy::GetConnection() {
-  return Connection(
-      PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(),
-      dispatcher());
+  return Connection(PluginGlobals::Get()->GetBrowserSender(), dispatcher());
 }
 
 }  // namespace proxy
diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h
index b748b84..2a95c12 100644
--- a/ppapi/proxy/resource_creation_proxy.h
+++ b/ppapi/proxy/resource_creation_proxy.h
@@ -75,10 +75,17 @@
   virtual PP_Resource CreateResourceArray(PP_Instance instance,
                                           const PP_Resource elements[],
                                           uint32_t size) OVERRIDE;
+  virtual PP_Resource CreateTrueTypeFont(
+      PP_Instance instance,
+      const PP_TrueTypeFontDesc_Dev& desc) OVERRIDE;
   virtual PP_Resource CreateURLLoader(PP_Instance instance) OVERRIDE;
   virtual PP_Resource CreateURLRequestInfo(
       PP_Instance instance,
       const URLRequestInfoData& data) OVERRIDE;
+  virtual PP_Resource CreateURLResponseInfo(
+      PP_Instance instance,
+      const URLResponseInfoData& data,
+      PP_Resource file_ref_resource) OVERRIDE;
   virtual PP_Resource CreateWheelInputEvent(
       PP_Instance instance,
       PP_TimeTicks time_stamp,
@@ -95,14 +102,9 @@
   virtual PP_Resource CreateAudioConfig(PP_Instance instance,
                                         PP_AudioSampleRate sample_rate,
                                         uint32_t sample_frame_count) OVERRIDE;
-  virtual PP_Resource CreateImageData(PP_Instance instance,
-                                      PP_ImageDataFormat format,
-                                      const PP_Size& size,
-                                      PP_Bool init_to_zero) OVERRIDE;
-  virtual PP_Resource CreateImageDataNaCl(PP_Instance instance,
-                                          PP_ImageDataFormat format,
-                                          const PP_Size& size,
-                                          PP_Bool init_to_zero) OVERRIDE;
+  virtual PP_Resource CreateFileChooser(PP_Instance instance,
+                                        PP_FileChooserMode_Dev mode,
+                                        const char* accept_types) OVERRIDE;
   virtual PP_Resource CreateGraphics2D(PP_Instance pp_instance,
                                        const PP_Size& size,
                                        PP_Bool is_always_opaque) OVERRIDE;
@@ -114,10 +116,19 @@
       PP_Resource share_context,
       const int32_t* attrib_list) OVERRIDE;
   virtual PP_Resource CreateHostResolverPrivate(PP_Instance instance) OVERRIDE;
+  virtual PP_Resource CreateImageData(PP_Instance instance,
+                                      PP_ImageDataFormat format,
+                                      const PP_Size& size,
+                                      PP_Bool init_to_zero) OVERRIDE;
+  virtual PP_Resource CreateImageDataNaCl(PP_Instance instance,
+                                          PP_ImageDataFormat format,
+                                          const PP_Size& size,
+                                          PP_Bool init_to_zero) OVERRIDE;
   virtual PP_Resource CreateNetworkMonitor(
       PP_Instance instance,
       PPB_NetworkMonitor_Callback callback,
       void* user_data) OVERRIDE;
+  virtual PP_Resource CreatePrinting(PP_Instance) OVERRIDE;
   virtual PP_Resource CreateTCPServerSocketPrivate(
       PP_Instance instance) OVERRIDE;
   virtual PP_Resource CreateTCPSocketPrivate(PP_Instance instance) OVERRIDE;
@@ -133,20 +144,17 @@
       const PP_BrowserFont_Trusted_Description* description) OVERRIDE;
   virtual PP_Resource CreateBuffer(PP_Instance instance,
                                    uint32_t size) OVERRIDE;
-  virtual PP_Resource CreateDirectoryReader(PP_Resource directory_ref) OVERRIDE;
-  virtual PP_Resource CreateFileChooser(
+  virtual PP_Resource CreateDirectoryReader(
       PP_Instance instance,
-      PP_FileChooserMode_Dev mode,
-      const char* accept_types) OVERRIDE;
+      PP_Resource directory_ref) OVERRIDE;
   virtual PP_Resource CreateFlashDeviceID(PP_Instance instance) OVERRIDE;
   virtual PP_Resource CreateFlashFontFile(
       PP_Instance instance,
-      const PP_FontDescription_Dev* description,
+      const PP_BrowserFont_Trusted_Description* description,
       PP_PrivateFontCharset charset) OVERRIDE;
   virtual PP_Resource CreateFlashMenu(PP_Instance instance,
                                       const PP_Flash_Menu* menu_data) OVERRIDE;
   virtual PP_Resource CreateFlashMessageLoop(PP_Instance instance) OVERRIDE;
-  virtual PP_Resource CreatePrinting(PP_Instance) OVERRIDE;
   virtual PP_Resource CreateScrollbar(PP_Instance instance,
                                       PP_Bool vertical) OVERRIDE;
   virtual PP_Resource CreateTalk(PP_Instance instance) OVERRIDE;
diff --git a/ppapi/proxy/resource_message_params.cc b/ppapi/proxy/resource_message_params.cc
index 9228d7e..e4858da 100644
--- a/ppapi/proxy/resource_message_params.cc
+++ b/ppapi/proxy/resource_message_params.cc
@@ -41,22 +41,46 @@
 }
 
 void ResourceMessageParams::Serialize(IPC::Message* msg) const {
-  IPC::ParamTraits<PP_Resource>::Write(msg, pp_resource_);
-  IPC::ParamTraits<int32_t>::Write(msg, sequence_);
-  IPC::ParamTraits<std::vector<SerializedHandle> >::Write(msg,
-                                                          handles_->data());
+  WriteHeader(msg);
+  WriteHandles(msg);
 }
 
 bool ResourceMessageParams::Deserialize(const IPC::Message* msg,
                                         PickleIterator* iter) {
+  return ReadHeader(msg, iter) && ReadHandles(msg, iter);
+}
+
+void ResourceMessageParams::WriteHeader(IPC::Message* msg) const {
+  IPC::ParamTraits<PP_Resource>::Write(msg, pp_resource_);
+  IPC::ParamTraits<int32_t>::Write(msg, sequence_);
+}
+
+void ResourceMessageParams::WriteHandles(IPC::Message* msg) const {
+  IPC::ParamTraits<std::vector<SerializedHandle> >::Write(msg,
+                                                          handles_->data());
+}
+
+bool ResourceMessageParams::ReadHeader(const IPC::Message* msg,
+                                       PickleIterator* iter) {
   DCHECK(handles_->data().empty());
   handles_->set_should_close(true);
   return IPC::ParamTraits<PP_Resource>::Read(msg, iter, &pp_resource_) &&
-         IPC::ParamTraits<int32_t>::Read(msg, iter, &sequence_) &&
-         IPC::ParamTraits<std::vector<SerializedHandle> >::Read(
+         IPC::ParamTraits<int32_t>::Read(msg, iter, &sequence_);
+}
+
+bool ResourceMessageParams::ReadHandles(const IPC::Message* msg,
+                                        PickleIterator* iter) {
+  return IPC::ParamTraits<std::vector<SerializedHandle> >::Read(
              msg, iter, &handles_->data());
 }
 
+void ResourceMessageParams::ConsumeHandles() const {
+  // Note: we must not invalidate the handles. This is used for converting
+  // handles from the host OS to NaCl, and that conversion will not work if we
+  // invalidate the handles (see HandleConverter).
+  handles_->set_should_close(false);
+}
+
 SerializedHandle ResourceMessageParams::TakeHandleOfTypeAtIndex(
     size_t index,
     SerializedHandle::Type type) const {
@@ -91,6 +115,26 @@
   return true;
 }
 
+bool ResourceMessageParams::TakeFileHandleAtIndex(
+    size_t index,
+    IPC::PlatformFileForTransit* handle) const {
+  SerializedHandle serialized = TakeHandleOfTypeAtIndex(
+      index, SerializedHandle::FILE);
+  if (!serialized.is_file())
+    return false;
+  *handle = serialized.descriptor();
+  return true;
+}
+
+void ResourceMessageParams::TakeAllSharedMemoryHandles(
+    std::vector<base::SharedMemoryHandle>* handles) const {
+  for (size_t i = 0; i < handles_->data().size(); ++i) {
+    base::SharedMemoryHandle handle;
+    if (TakeSharedMemoryHandleAtIndex(i, &handle))
+      handles->push_back(handle);
+  }
+}
+
 void ResourceMessageParams::AppendHandle(const SerializedHandle& handle) const {
   handles_->data().push_back(handle);
 }
@@ -136,15 +180,24 @@
 }
 
 void ResourceMessageReplyParams::Serialize(IPC::Message* msg) const {
-  ResourceMessageParams::Serialize(msg);
-  IPC::ParamTraits<int32_t>::Write(msg, result_);
+  // Rather than serialize all of ResourceMessageParams first, we serialize all
+  // non-handle data first, then the handles. When transferring to NaCl on
+  // Windows, we need to be able to translate Windows-style handles to POSIX-
+  // style handles, and it's easier to put all the regular stuff at the front.
+  WriteReplyHeader(msg);
+  WriteHandles(msg);
 }
 
 bool ResourceMessageReplyParams::Deserialize(const IPC::Message* msg,
                                              PickleIterator* iter) {
-  if (!ResourceMessageParams::Deserialize(msg, iter))
-    return false;
-  return IPC::ParamTraits<int32_t>::Read(msg, iter, &result_);
+  return (ReadHeader(msg, iter) &&
+          IPC::ParamTraits<int32_t>::Read(msg, iter, &result_) &&
+          ReadHandles(msg, iter));
+}
+
+void ResourceMessageReplyParams::WriteReplyHeader(IPC::Message* msg) const {
+  WriteHeader(msg);
+  IPC::ParamTraits<int32_t>::Write(msg, result_);
 }
 
 }  // namespace proxy
diff --git a/ppapi/proxy/resource_message_params.h b/ppapi/proxy/resource_message_params.h
index 780adb0..21b0f73 100644
--- a/ppapi/proxy/resource_message_params.h
+++ b/ppapi/proxy/resource_message_params.h
@@ -11,7 +11,7 @@
 #include "ipc/ipc_message_utils.h"
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/proxy/ppapi_proxy_export.h"
-#include "ppapi/proxy/serialized_structs.h"
+#include "ppapi/proxy/serialized_handle.h"
 
 namespace ppapi {
 namespace proxy {
@@ -29,6 +29,11 @@
     return handles_->data();
   }
 
+  // Makes ResourceMessageParams leave its handles open, even if they weren't
+  // taken using a Take.* function. After this call, no Take.* calls are
+  // allowed.
+  void ConsumeHandles() const;
+
   // Returns the handle at the given index if it exists and is of the given
   // type. The corresponding slot in the list is set to an invalid handle.
   // If the index doesn't exist or the handle isn't of the given type, returns
@@ -38,8 +43,8 @@
   SerializedHandle TakeHandleOfTypeAtIndex(size_t index,
                                            SerializedHandle::Type type) const;
 
-  // Helper functions to return shared memory or socket handles passed in the
-  // params struct.
+  // Helper functions to return shared memory, socket or file handles passed in
+  // the params struct.
   // If the index has a valid handle of the given type, it will be placed in the
   // output parameter, the corresponding slot in the list will be set to an
   // invalid handle, and the function will return true. If the handle doesn't
@@ -54,6 +59,10 @@
                                      base::SharedMemoryHandle* handle) const;
   bool TakeSocketHandleAtIndex(size_t index,
                                IPC::PlatformFileForTransit* handle) const;
+  bool TakeFileHandleAtIndex(size_t index,
+                             IPC::PlatformFileForTransit* handle) const;
+  void TakeAllSharedMemoryHandles(
+      std::vector<base::SharedMemoryHandle>* handles) const;
 
   // Appends the given handle to the list of handles sent with the call or
   // reply.
@@ -66,8 +75,17 @@
   virtual void Serialize(IPC::Message* msg) const;
   virtual bool Deserialize(const IPC::Message* msg, PickleIterator* iter);
 
+  // Writes everything except the handles to |msg|.
+  void WriteHeader(IPC::Message* msg) const;
+  // Writes the handles to |msg|.
+  void WriteHandles(IPC::Message* msg) const;
+  // Matching deserialize helpers.
+  bool ReadHeader(const IPC::Message* msg, PickleIterator* iter);
+  bool ReadHandles(const IPC::Message* msg, PickleIterator* iter);
+
  private:
-  class SerializedHandles : public base::RefCounted<SerializedHandles> {
+  class SerializedHandles
+      : public base::RefCountedThreadSafe<SerializedHandles> {
    public:
     SerializedHandles();
     ~SerializedHandles();
@@ -76,7 +94,7 @@
     std::vector<SerializedHandle>& data() { return data_; }
 
    private:
-    friend class base::RefCounted<SerializedHandles>;
+    friend class base::RefCountedThreadSafe<SerializedHandles>;
 
     // Whether the handles stored in |data_| should be closed when this object
     // goes away.
@@ -149,6 +167,9 @@
   virtual bool Deserialize(const IPC::Message* msg,
                            PickleIterator* iter) OVERRIDE;
 
+  // Writes everything except the handles to |msg|.
+  void WriteReplyHeader(IPC::Message* msg) const;
+
  private:
   // Pepper "result code" for the callback.
   int32_t result_;
diff --git a/ppapi/proxy/resource_message_test_sink.h b/ppapi/proxy/resource_message_test_sink.h
index 7694fb0..f5f97cf 100644
--- a/ppapi/proxy/resource_message_test_sink.h
+++ b/ppapi/proxy/resource_message_test_sink.h
@@ -5,6 +5,7 @@
 #ifndef PPAPI_PROXY_RESOURCE_MESSAGE_TEST_SINK_H_
 #define PPAPI_PROXY_RESOURCE_MESSAGE_TEST_SINK_H_
 
+#include "ipc/ipc_listener.h"
 #include "ipc/ipc_test_sink.h"
 #include "ppapi/c/pp_stdint.h"
 
diff --git a/ppapi/proxy/serialized_flash_menu.cc b/ppapi/proxy/serialized_flash_menu.cc
index 2784485..bbd698c 100644
--- a/ppapi/proxy/serialized_flash_menu.cc
+++ b/ppapi/proxy/serialized_flash_menu.cc
@@ -15,6 +15,7 @@
 // Maximum depth of submenus allowed (e.g., 1 indicates that submenus are
 // allowed, but not sub-submenus).
 const int kMaxMenuDepth = 2;
+const uint32_t kMaxMenuEntries = 1000;
 
 bool CheckMenu(int depth, const PP_Flash_Menu* menu);
 void FreeMenu(const PP_Flash_Menu* menu);
@@ -123,6 +124,11 @@
   if (menu->count == 0)
     return menu;
 
+  if (menu->count > kMaxMenuEntries) {
+    FreeMenu(menu);
+    return NULL;
+  }
+
   menu->items = new PP_Flash_MenuItem[menu->count];
   memset(menu->items, 0, sizeof(PP_Flash_MenuItem) * menu->count);
   for (uint32_t i = 0; i < menu->count; ++i) {
diff --git a/ppapi/proxy/serialized_handle.cc b/ppapi/proxy/serialized_handle.cc
new file mode 100644
index 0000000..0159e6f
--- /dev/null
+++ b/ppapi/proxy/serialized_handle.cc
@@ -0,0 +1,133 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/serialized_handle.h"
+
+#include "base/pickle.h"
+#include "base/platform_file.h"
+#include "base/shared_memory.h"
+#include "build/build_config.h"
+#include "ipc/ipc_platform_file.h"
+
+#if defined(OS_NACL)
+#include <unistd.h>
+#endif
+
+namespace ppapi {
+namespace proxy {
+
+SerializedHandle::SerializedHandle()
+    : type_(INVALID),
+      shm_handle_(base::SharedMemory::NULLHandle()),
+      size_(0),
+      descriptor_(IPC::InvalidPlatformFileForTransit()) {
+}
+
+SerializedHandle::SerializedHandle(Type type_param)
+    : type_(type_param),
+      shm_handle_(base::SharedMemory::NULLHandle()),
+      size_(0),
+      descriptor_(IPC::InvalidPlatformFileForTransit()) {
+}
+
+SerializedHandle::SerializedHandle(const base::SharedMemoryHandle& handle,
+                                   uint32 size)
+    : type_(SHARED_MEMORY),
+      shm_handle_(handle),
+      size_(size),
+      descriptor_(IPC::InvalidPlatformFileForTransit()) {
+}
+
+SerializedHandle::SerializedHandle(
+    Type type,
+    const IPC::PlatformFileForTransit& socket_descriptor)
+    : type_(type),
+      shm_handle_(base::SharedMemory::NULLHandle()),
+      size_(0),
+      descriptor_(socket_descriptor) {
+}
+
+bool SerializedHandle::IsHandleValid() const {
+  switch (type_) {
+    case SHARED_MEMORY:
+      return base::SharedMemory::IsHandleValid(shm_handle_);
+    case SOCKET:
+    case CHANNEL_HANDLE:
+    case FILE:
+      return !(IPC::InvalidPlatformFileForTransit() == descriptor_);
+    case INVALID:
+      return false;
+    // No default so the compiler will warn us if a new type is added.
+  }
+  return false;
+}
+
+void SerializedHandle::Close() {
+  if (IsHandleValid()) {
+    switch (type_) {
+      case INVALID:
+        NOTREACHED();
+        break;
+      case SHARED_MEMORY:
+        base::SharedMemory::CloseHandle(shm_handle_);
+        break;
+      case SOCKET:
+      case CHANNEL_HANDLE:
+      case FILE:
+        base::PlatformFile file =
+            IPC::PlatformFileForTransitToPlatformFile(descriptor_);
+#if !defined(OS_NACL)
+        base::ClosePlatformFile(file);
+#else
+        close(file);
+#endif
+        break;
+      // No default so the compiler will warn us if a new type is added.
+    }
+  }
+  *this = SerializedHandle();
+}
+
+// static
+bool SerializedHandle::WriteHeader(const Header& hdr, Pickle* pickle) {
+  if (!pickle->WriteInt(hdr.type))
+    return false;
+  if (hdr.type == SHARED_MEMORY) {
+    if (!pickle->WriteUInt32(hdr.size))
+      return false;
+  }
+  return true;
+}
+
+// static
+bool SerializedHandle::ReadHeader(PickleIterator* iter, Header* hdr) {
+  *hdr = Header(INVALID, 0);
+  int type = 0;
+  if (!iter->ReadInt(&type))
+    return false;
+  bool valid_type = false;
+  switch (type) {
+    case SHARED_MEMORY: {
+      uint32 size = 0;
+      if (!iter->ReadUInt32(&size))
+        return false;
+      hdr->size = size;
+      valid_type = true;
+      break;
+    }
+    case SOCKET:
+    case CHANNEL_HANDLE:
+    case FILE:
+    case INVALID:
+      valid_type = true;
+      break;
+    // No default so the compiler will warn us if a new type is added.
+  }
+  if (valid_type)
+    hdr->type = Type(type);
+  return valid_type;
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/serialized_handle.h b/ppapi/proxy/serialized_handle.h
new file mode 100644
index 0000000..9e4136f
--- /dev/null
+++ b/ppapi/proxy/serialized_handle.h
@@ -0,0 +1,141 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_SERIALIZED_HANDLES_H_
+#define PPAPI_PROXY_SERIALIZED_HANDLES_H_
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "base/shared_memory.h"
+#include "build/build_config.h"
+#include "ipc/ipc_platform_file.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+
+class Pickle;
+
+namespace ppapi {
+namespace proxy {
+
+// SerializedHandle is a unified structure for holding a handle (e.g., a shared
+// memory handle, socket descriptor, etc). This is useful for passing handles in
+// resource messages and also makes it easier to translate handles in
+// NaClIPCAdapter for use in NaCl.
+class PPAPI_PROXY_EXPORT SerializedHandle {
+ public:
+  enum Type { INVALID, SHARED_MEMORY, SOCKET, CHANNEL_HANDLE, FILE };
+  struct Header {
+    Header() : type(INVALID), size(0) {}
+    Header(Type type_arg, uint32 size_arg)
+        : type(type_arg), size(size_arg) {
+    }
+    Type type;
+    uint32 size;
+  };
+
+  SerializedHandle();
+  // Create an invalid handle of the given type.
+  explicit SerializedHandle(Type type);
+
+  // Create a shared memory handle.
+  SerializedHandle(const base::SharedMemoryHandle& handle, uint32 size);
+
+  // Create a socket, channel or file handle.
+  SerializedHandle(const Type type,
+                   const IPC::PlatformFileForTransit& descriptor);
+
+  Type type() const { return type_; }
+  bool is_shmem() const { return type_ == SHARED_MEMORY; }
+  bool is_socket() const { return type_ == SOCKET; }
+  bool is_channel_handle() const { return type_ == CHANNEL_HANDLE; }
+  bool is_file() const { return type_ == FILE; }
+  const base::SharedMemoryHandle& shmem() const {
+    DCHECK(is_shmem());
+    return shm_handle_;
+  }
+  uint32 size() const {
+    DCHECK(is_shmem());
+    return size_;
+  }
+  const IPC::PlatformFileForTransit& descriptor() const {
+    DCHECK(is_socket() || is_channel_handle() || is_file());
+    return descriptor_;
+  }
+  void set_shmem(const base::SharedMemoryHandle& handle, uint32 size) {
+    type_ = SHARED_MEMORY;
+    shm_handle_ = handle;
+    size_ = size;
+
+    descriptor_ = IPC::InvalidPlatformFileForTransit();
+  }
+  void set_socket(const IPC::PlatformFileForTransit& socket) {
+    type_ = SOCKET;
+    descriptor_ = socket;
+
+    shm_handle_ = base::SharedMemory::NULLHandle();
+    size_ = 0;
+  }
+  void set_channel_handle(const IPC::PlatformFileForTransit& descriptor) {
+    type_ = CHANNEL_HANDLE;
+
+    descriptor_ = descriptor;
+    shm_handle_ = base::SharedMemory::NULLHandle();
+    size_ = 0;
+  }
+  void set_file_handle(const IPC::PlatformFileForTransit& descriptor) {
+    type_ = FILE;
+
+    descriptor_ = descriptor;
+    shm_handle_ = base::SharedMemory::NULLHandle();
+    size_ = 0;
+  }
+  void set_null_shmem() {
+    set_shmem(base::SharedMemory::NULLHandle(), 0);
+  }
+  void set_null_socket() {
+    set_socket(IPC::InvalidPlatformFileForTransit());
+  }
+  void set_null_channel_handle() {
+    set_channel_handle(IPC::InvalidPlatformFileForTransit());
+  }
+  void set_null_file_handle() {
+    set_file_handle(IPC::InvalidPlatformFileForTransit());
+  }
+  bool IsHandleValid() const;
+
+  Header header() const {
+    return Header(type_, size_);
+  }
+
+  // Closes the handle and sets it to invalid.
+  void Close();
+
+  // Write/Read a Header, which contains all the data except the handle. This
+  // allows us to write the handle in a platform-specific way, as is necessary
+  // in NaClIPCAdapter to share handles with NaCl from Windows.
+  static bool WriteHeader(const Header& hdr, Pickle* pickle);
+  static bool ReadHeader(PickleIterator* iter, Header* hdr);
+
+ private:
+  // The kind of handle we're holding.
+  Type type_;
+
+  // We hold more members than we really need; we can't easily use a union,
+  // because we hold non-POD types. But these types are pretty light-weight. If
+  // we add more complex things later, we should come up with a more memory-
+  // efficient strategy.
+  // These are valid if type == SHARED_MEMORY.
+  base::SharedMemoryHandle shm_handle_;
+  uint32 size_;
+
+  // This is valid if type == SOCKET || type == CHANNEL_HANDLE.
+  IPC::PlatformFileForTransit descriptor_;
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_SERIALIZED_HANDLES_H_
diff --git a/ppapi/proxy/serialized_structs.cc b/ppapi/proxy/serialized_structs.cc
index f83ae0b..8c984d5 100644
--- a/ppapi/proxy/serialized_structs.cc
+++ b/ppapi/proxy/serialized_structs.cc
@@ -5,19 +5,13 @@
 #include "ppapi/proxy/serialized_structs.h"
 
 #include "base/pickle.h"
-#include "base/platform_file.h"
-#include "base/shared_memory.h"
 #include "build/build_config.h"
-#include "ipc/ipc_platform_file.h"
 #include "ppapi/c/dev/ppb_font_dev.h"
 #include "ppapi/c/pp_file_info.h"
 #include "ppapi/c/pp_rect.h"
+#include "ppapi/c/trusted/ppb_browser_font_trusted.h"
 #include "ppapi/shared_impl/var.h"
 
-#if defined(OS_NACL)
-#include <unistd.h>
-#endif
-
 namespace ppapi {
 namespace proxy {
 
@@ -48,6 +42,20 @@
   word_spacing = desc.word_spacing;
 }
 
+void SerializedFontDescription::SetFromPPBrowserFontDescription(
+    const PP_BrowserFont_Trusted_Description& desc) {
+  StringVar* string_var = StringVar::FromPPVar(desc.face);
+  face = string_var ? string_var->value() : std::string();
+
+  family = desc.family;
+  size = desc.size;
+  weight = desc.weight;
+  italic = desc.italic;
+  small_caps = desc.small_caps;
+  letter_spacing = desc.letter_spacing;
+  word_spacing = desc.word_spacing;
+}
+
 void SerializedFontDescription::SetToPPFontDescription(
     PP_FontDescription_Dev* desc) const {
   desc->face = StringVar::StringToPPVar(face);
@@ -60,6 +68,52 @@
   desc->word_spacing = word_spacing;
 }
 
+void SerializedFontDescription::SetToPPBrowserFontDescription(
+    PP_BrowserFont_Trusted_Description* desc) const {
+  desc->face = StringVar::StringToPPVar(face);
+  desc->family = static_cast<PP_BrowserFont_Trusted_Family>(family);
+  desc->size = size;
+  desc->weight = static_cast<PP_BrowserFont_Trusted_Weight>(weight);
+  desc->italic = italic;
+  desc->small_caps = small_caps;
+  desc->letter_spacing = letter_spacing;
+  desc->word_spacing = word_spacing;
+}
+
+SerializedTrueTypeFontDesc::SerializedTrueTypeFontDesc()
+    : family(),
+      generic_family(),
+      style(),
+      weight(),
+      width(),
+      charset() {
+}
+
+SerializedTrueTypeFontDesc::~SerializedTrueTypeFontDesc() {}
+
+void SerializedTrueTypeFontDesc::SetFromPPTrueTypeFontDesc(
+    const PP_TrueTypeFontDesc_Dev& desc) {
+  StringVar* string_var = StringVar::FromPPVar(desc.family);
+  family = string_var ? string_var->value() : std::string();
+
+  generic_family = desc.generic_family;
+  style = desc.style;
+  weight = desc.weight;
+  width = desc.width;
+  charset = desc.charset;
+}
+
+void SerializedTrueTypeFontDesc::CopyToPPTrueTypeFontDesc(
+    PP_TrueTypeFontDesc_Dev* desc) const {
+  desc->family = StringVar::StringToPPVar(family);
+
+  desc->generic_family = generic_family;
+  desc->style = style;
+  desc->weight = weight;
+  desc->width = width;
+  desc->charset = charset;
+}
+
 PPBFlash_DrawGlyphs_Params::PPBFlash_DrawGlyphs_Params()
     : instance(0),
       font_desc(),
@@ -75,108 +129,5 @@
 
 PPBFlash_DrawGlyphs_Params::~PPBFlash_DrawGlyphs_Params() {}
 
-SerializedHandle::SerializedHandle()
-    : type_(INVALID),
-      shm_handle_(base::SharedMemory::NULLHandle()),
-      size_(0),
-      descriptor_(IPC::InvalidPlatformFileForTransit()) {
-}
-
-SerializedHandle::SerializedHandle(Type type_param)
-    : type_(type_param),
-      shm_handle_(base::SharedMemory::NULLHandle()),
-      size_(0),
-      descriptor_(IPC::InvalidPlatformFileForTransit()) {
-}
-
-SerializedHandle::SerializedHandle(const base::SharedMemoryHandle& handle,
-                                   uint32_t size)
-    : type_(SHARED_MEMORY),
-      shm_handle_(handle),
-      size_(size),
-      descriptor_(IPC::InvalidPlatformFileForTransit()) {
-}
-
-SerializedHandle::SerializedHandle(
-    Type type,
-    const IPC::PlatformFileForTransit& socket_descriptor)
-    : type_(type),
-      shm_handle_(base::SharedMemory::NULLHandle()),
-      size_(0),
-      descriptor_(socket_descriptor) {
-}
-
-bool SerializedHandle::IsHandleValid() const {
-  if (type_ == SHARED_MEMORY)
-    return base::SharedMemory::IsHandleValid(shm_handle_);
-  else if (type_ == SOCKET || type_ == CHANNEL_HANDLE)
-    return !(IPC::InvalidPlatformFileForTransit() == descriptor_);
-  return false;
-}
-
-void SerializedHandle::Close() {
-  if (IsHandleValid()) {
-    switch (type_) {
-      case INVALID:
-        NOTREACHED();
-        break;
-      case SHARED_MEMORY:
-        base::SharedMemory::CloseHandle(shm_handle_);
-        break;
-      case SOCKET:
-      case CHANNEL_HANDLE:
-        base::PlatformFile file =
-            IPC::PlatformFileForTransitToPlatformFile(descriptor_);
-#if !defined(OS_NACL)
-        base::ClosePlatformFile(file);
-#else
-        close(file);
-#endif
-        break;
-      // No default so the compiler will warn us if a new type is added.
-    }
-  }
-  *this = SerializedHandle();
-}
-
-// static
-bool SerializedHandle::WriteHeader(const Header& hdr, Pickle* pickle) {
-  if (!pickle->WriteInt(hdr.type))
-    return false;
-  if (hdr.type == SHARED_MEMORY) {
-    if (!pickle->WriteUInt32(hdr.size))
-      return false;
-  }
-  return true;
-}
-
-// static
-bool SerializedHandle::ReadHeader(PickleIterator* iter, Header* hdr) {
-  *hdr = Header(INVALID, 0);
-  int type = 0;
-  if (!iter->ReadInt(&type))
-    return false;
-  bool valid_type = false;
-  switch (type) {
-    case SHARED_MEMORY: {
-      uint32_t size = 0;
-      if (!iter->ReadUInt32(&size))
-        return false;
-      hdr->size = size;
-      valid_type = true;
-      break;
-    }
-    case SOCKET:
-    case CHANNEL_HANDLE:
-    case INVALID:
-      valid_type = true;
-      break;
-    // No default so the compiler will warn us if a new type is added.
-  }
-  if (valid_type)
-    hdr->type = Type(type);
-  return valid_type;
-}
-
 }  // namespace proxy
 }  // namespace ppapi
diff --git a/ppapi/proxy/serialized_structs.h b/ppapi/proxy/serialized_structs.h
index e577a8f..4844d6b 100644
--- a/ppapi/proxy/serialized_structs.h
+++ b/ppapi/proxy/serialized_structs.h
@@ -11,7 +11,7 @@
 #include "base/logging.h"
 #include "base/shared_memory.h"
 #include "build/build_config.h"
-#include "ipc/ipc_platform_file.h"
+#include "ppapi/c/dev/ppb_truetype_font_dev.h"
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_point.h"
@@ -21,12 +21,14 @@
 
 class Pickle;
 struct PP_FontDescription_Dev;
+struct PP_BrowserFont_Trusted_Description;
 
 namespace ppapi {
 namespace proxy {
 
-// PP_FontDescript_Dev has to be redefined with a string in place of the PP_Var
-// used for the face name.
+// PP_FontDescription_Dev/PP_BrowserFontDescription (same definition, different
+// names) has to be redefined with a string in place of the PP_Var used for the
+// face name.
 struct PPAPI_PROXY_EXPORT SerializedFontDescription {
   SerializedFontDescription();
   ~SerializedFontDescription();
@@ -36,10 +38,14 @@
   // The reference of |face| owned by the PP_FontDescription_Dev will be
   // unchanged and the caller is responsible for freeing it.
   void SetFromPPFontDescription(const PP_FontDescription_Dev& desc);
+  void SetFromPPBrowserFontDescription(
+      const PP_BrowserFont_Trusted_Description& desc);
 
   // Converts to a PP_FontDescription_Dev. The face name will have one ref
   // assigned to it. The caller is responsible for freeing it.
   void SetToPPFontDescription(PP_FontDescription_Dev* desc) const;
+  void SetToPPBrowserFontDescription(
+      PP_BrowserFont_Trusted_Description* desc) const;
 
   std::string face;
   int32_t family;
@@ -51,12 +57,36 @@
   int32_t word_spacing;
 };
 
+struct PPAPI_PROXY_EXPORT SerializedTrueTypeFontDesc {
+  SerializedTrueTypeFontDesc();
+  ~SerializedTrueTypeFontDesc();
+
+  // Sets this to correspond to the contents of a PP_TrueTypeFontDesc_Dev.
+  //
+  // The reference count of the desc.family PP_Var will be unchanged and the
+  // caller is responsible for releasing it.
+  void SetFromPPTrueTypeFontDesc(const PP_TrueTypeFontDesc_Dev& desc);
+
+  // Converts this to a PP_FontDescription_Dev.
+  //
+  // The desc.family PP_Var will have one reference assigned to it. The caller
+  // is responsible for releasing it.
+  void CopyToPPTrueTypeFontDesc(PP_TrueTypeFontDesc_Dev* desc) const;
+
+  std::string family;
+  PP_TrueTypeFontFamily_Dev generic_family;
+  PP_TrueTypeFontStyle_Dev style;
+  PP_TrueTypeFontWeight_Dev weight;
+  PP_TrueTypeFontWidth_Dev width;
+  PP_TrueTypeFontCharset_Dev charset;
+};
+
 struct SerializedDirEntry {
   std::string name;
   bool is_dir;
 };
 
-struct PPBFlash_DrawGlyphs_Params {
+struct PPAPI_PROXY_EXPORT PPBFlash_DrawGlyphs_Params {
   PPBFlash_DrawGlyphs_Params();
   ~PPBFlash_DrawGlyphs_Params();
 
@@ -81,116 +111,6 @@
   int64_t total_bytes_to_be_received;
 };
 
-struct PPPVideoCapture_Buffer {
-  ppapi::HostResource resource;
-  uint32_t size;
-  base::SharedMemoryHandle handle;
-};
-
-// We put all our handles in a unified structure to make it easy to translate
-// them in NaClIPCAdapter for use in NaCl.
-class PPAPI_PROXY_EXPORT SerializedHandle {
- public:
-  enum Type { INVALID, SHARED_MEMORY, SOCKET, CHANNEL_HANDLE };
-  struct Header {
-    Header() : type(INVALID), size(0) {}
-    Header(Type type_arg, uint32_t size_arg)
-        : type(type_arg), size(size_arg) {
-    }
-    Type type;
-    uint32_t size;
-  };
-
-  SerializedHandle();
-  // Create an invalid handle of the given type.
-  explicit SerializedHandle(Type type);
-
-  // Create a shared memory handle.
-  SerializedHandle(const base::SharedMemoryHandle& handle, uint32_t size);
-
-  // Create a socket or channel handle.
-  SerializedHandle(const Type type,
-                   const IPC::PlatformFileForTransit& descriptor);
-
-  Type type() const { return type_; }
-  bool is_shmem() const { return type_ == SHARED_MEMORY; }
-  bool is_socket() const { return type_ == SOCKET; }
-  bool is_channel_handle() const { return type_ == CHANNEL_HANDLE; }
-  const base::SharedMemoryHandle& shmem() const {
-    DCHECK(is_shmem());
-    return shm_handle_;
-  }
-  uint32_t size() const {
-    DCHECK(is_shmem());
-    return size_;
-  }
-  const IPC::PlatformFileForTransit& descriptor() const {
-    DCHECK(is_socket() || is_channel_handle());
-    return descriptor_;
-  }
-  void set_shmem(const base::SharedMemoryHandle& handle, uint32_t size) {
-    type_ = SHARED_MEMORY;
-    shm_handle_ = handle;
-    size_ = size;
-
-    descriptor_ = IPC::InvalidPlatformFileForTransit();
-  }
-  void set_socket(const IPC::PlatformFileForTransit& socket) {
-    type_ = SOCKET;
-    descriptor_ = socket;
-
-    shm_handle_ = base::SharedMemory::NULLHandle();
-    size_ = 0;
-  }
-  void set_channel_handle(const IPC::PlatformFileForTransit& descriptor) {
-    type_ = CHANNEL_HANDLE;
-
-    descriptor_ = descriptor;
-    shm_handle_ = base::SharedMemory::NULLHandle();
-    size_ = 0;
-  }
-  void set_null_shmem() {
-    set_shmem(base::SharedMemory::NULLHandle(), 0);
-  }
-  void set_null_socket() {
-    set_socket(IPC::InvalidPlatformFileForTransit());
-  }
-  void set_null_channel_handle() {
-    set_channel_handle(IPC::InvalidPlatformFileForTransit());
-  }
-  bool IsHandleValid() const;
-
-  Header header() const {
-    return Header(type_, size_);
-  }
-
-  // Closes the handle and sets it to invalid.
-  void Close();
-
-  // Write/Read a Header, which contains all the data except the handle. This
-  // allows us to write the handle in a platform-specific way, as is necessary
-  // in NaClIPCAdapter to share handles with NaCl from Windows.
-  static bool WriteHeader(const Header& hdr, Pickle* pickle);
-  static bool ReadHeader(PickleIterator* iter, Header* hdr);
-
- private:
-  // The kind of handle we're holding.
-  Type type_;
-
-  // We hold more members than we really need; we can't easily use a union,
-  // because we hold non-POD types. But these types are pretty light-weight. If
-  // we add more complex things later, we should come up with a more memory-
-  // efficient strategy.
-  // These are valid if type == SHARED_MEMORY.
-  base::SharedMemoryHandle shm_handle_;
-  uint32_t size_;
-
-  // This is valid if type == SOCKET || type == CHANNEL_HANDLE.
-  IPC::PlatformFileForTransit descriptor_;
-};
-
-// TODO(tomfinegan): This is identical to PPPVideoCapture_Buffer, maybe replace
-// both with a single type?
 struct PPPDecryptor_Buffer {
   ppapi::HostResource resource;
   uint32_t size;
diff --git a/ppapi/proxy/serialized_var.cc b/ppapi/proxy/serialized_var.cc
index ad416db..698d920 100644
--- a/ppapi/proxy/serialized_var.cc
+++ b/ppapi/proxy/serialized_var.cc
@@ -6,20 +6,29 @@
 
 #include "base/logging.h"
 #include "ipc/ipc_message_utils.h"
+#include "ppapi/c/pp_instance.h"
 #include "ppapi/proxy/dispatcher.h"
 #include "ppapi/proxy/interface_proxy.h"
 #include "ppapi/proxy/ppapi_param_traits.h"
+#include "ppapi/proxy/ppb_buffer_proxy.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
 #include "ppapi/shared_impl/var.h"
+#include "ppapi/thunk/enter.h"
 
 namespace ppapi {
 namespace proxy {
 
+// When sending array buffers, if the size is over 256K, we use shared
+// memory instead of sending the data over IPC. Light testing suggests
+// shared memory is much faster for 256K and larger messages.
+static const uint32 kMinimumArrayBufferSizeForShmem = 256 * 1024;
+
 // SerializedVar::Inner --------------------------------------------------------
 
 SerializedVar::Inner::Inner()
     : serialization_rules_(NULL),
       var_(PP_MakeUndefined()),
+      instance_(0),
       cleanup_mode_(CLEANUP_NONE) {
 #ifndef NDEBUG
   has_been_serialized_ = false;
@@ -30,6 +39,7 @@
 SerializedVar::Inner::Inner(VarSerializationRules* serialization_rules)
     : serialization_rules_(serialization_rules),
       var_(PP_MakeUndefined()),
+      instance_(0),
       cleanup_mode_(CLEANUP_NONE) {
 #ifndef NDEBUG
   has_been_serialized_ = false;
@@ -65,11 +75,30 @@
   raw_var_data_.reset(NULL);
 }
 
+void SerializedVar::Inner::SetInstance(PP_Instance instance) {
+  instance_ = instance;
+}
+
 void SerializedVar::Inner::ForceSetVarValueForTest(PP_Var value) {
   var_ = value;
   raw_var_data_.reset(NULL);
 }
 
+void SerializedVar::Inner::WriteRawVarHeader(IPC::Message* m) const {
+  // Write raw_var_data_ when we're called from
+  // chrome/nacl/nacl_ipc_adapter.cc.
+  DCHECK(raw_var_data_.get());
+  DCHECK_EQ(PP_VARTYPE_ARRAY_BUFFER, raw_var_data_->type);
+  DCHECK(raw_var_data_->shmem_size != 0);
+
+  // The serialization for this message MUST MATCH the implementation at
+  // SerializedVar::Inner::WriteToMessage for ARRAY_BUFFER_SHMEM_PLUGIN.
+  m->WriteInt(static_cast<int>(raw_var_data_->type));
+  m->WriteInt(ARRAY_BUFFER_SHMEM_PLUGIN);
+  m->WriteInt(raw_var_data_->shmem_size);
+  // NaClIPCAdapter will write the handles for us.
+}
+
 void SerializedVar::Inner::WriteToMessage(IPC::Message* m) const {
   // When writing to the IPC messages, a serialization rules handler should
   // always have been set.
@@ -124,14 +153,45 @@
       // handle the invalid string as if it was in process rather than seeing
       // what looks like a valid empty ArraryBuffer.
       ArrayBufferVar* buffer_var = ArrayBufferVar::FromPPVar(var_);
-      if (buffer_var) {
-        // TODO(dmichael): If it wasn't already Mapped, Unmap it. (Though once
-        //                 we use shared memory, this will probably be
-        //                 completely different anyway).
-        m->WriteData(static_cast<const char*>(buffer_var->Map()),
-                     buffer_var->ByteLength());
-      } else {
-        m->WriteData(NULL, 0);
+      bool using_shmem = false;
+      if (buffer_var &&
+          buffer_var->ByteLength() >= kMinimumArrayBufferSizeForShmem &&
+          instance_ != 0) {
+        int host_shm_handle_id;
+        base::SharedMemoryHandle plugin_shm_handle;
+        using_shmem = buffer_var->CopyToNewShmem(instance_,
+                                                 &host_shm_handle_id,
+                                                 &plugin_shm_handle);
+        if (using_shmem) {
+          // The serialization for this message MUST MATCH the implementation
+          // at SerializedVar::Inner::WriteRawVarHeader for
+          // ARRAY_BUFFER_SHMEM_PLUGIN.
+          if (host_shm_handle_id != -1) {
+            DCHECK(!base::SharedMemory::IsHandleValid(plugin_shm_handle));
+            DCHECK(PpapiGlobals::Get()->IsPluginGlobals());
+            m->WriteInt(ARRAY_BUFFER_SHMEM_HOST);
+            m->WriteInt(host_shm_handle_id);
+          } else {
+            DCHECK(base::SharedMemory::IsHandleValid(plugin_shm_handle));
+            DCHECK(PpapiGlobals::Get()->IsHostGlobals());
+            m->WriteInt(ARRAY_BUFFER_SHMEM_PLUGIN);
+            m->WriteInt(buffer_var->ByteLength());
+            SerializedHandle handle(plugin_shm_handle,
+                                    buffer_var->ByteLength());
+            IPC::ParamTraits<SerializedHandle>::Write(m, handle);
+          }
+        }
+      }
+      if (!using_shmem) {
+        if (buffer_var) {
+          m->WriteInt(ARRAY_BUFFER_NO_SHMEM);
+          m->WriteData(static_cast<const char*>(buffer_var->Map()),
+                       buffer_var->ByteLength());
+        } else {
+          // TODO(teravest): Introduce an ARRAY_BUFFER_EMPTY message type.
+          m->WriteBool(ARRAY_BUFFER_NO_SHMEM);
+          m->WriteData(NULL, 0);
+        }
       }
       break;
     }
@@ -140,7 +200,7 @@
       break;
     case PP_VARTYPE_ARRAY:
     case PP_VARTYPE_DICTIONARY:
-      // TODO(brettw) when these are supported, implement this.
+      // TODO(yzshen) when these are supported, implement this.
       NOTIMPLEMENTED();
       break;
   }
@@ -159,7 +219,6 @@
   DCHECK(!has_been_deserialized_);
   has_been_deserialized_ = true;
 #endif
-
   // When reading, the dispatcher should be set when we get a Deserialize
   // call (which will supply a dispatcher).
   int type;
@@ -197,11 +256,40 @@
     case PP_VARTYPE_ARRAY_BUFFER: {
       int length = 0;
       const char* message_bytes = NULL;
-      success = m->ReadData(iter, &message_bytes, &length);
+      int shmem_type;
+      success = m->ReadInt(iter, &shmem_type);
       if (success) {
-        raw_var_data_.reset(new RawVarData);
-        raw_var_data_->type = PP_VARTYPE_ARRAY_BUFFER;
-        raw_var_data_->data.assign(message_bytes, length);
+        if (shmem_type == ARRAY_BUFFER_NO_SHMEM) {
+          success = m->ReadData(iter, &message_bytes, &length);
+          if (success) {
+            raw_var_data_.reset(new RawVarData);
+            raw_var_data_->type = PP_VARTYPE_ARRAY_BUFFER;
+            raw_var_data_->shmem_type = static_cast<ShmemType>(shmem_type);
+            raw_var_data_->shmem_size = 0;
+            raw_var_data_->data.assign(message_bytes, length);
+          }
+        } else if (shmem_type == ARRAY_BUFFER_SHMEM_HOST) {
+          int host_handle_id;
+          success = m->ReadInt(iter, &host_handle_id);
+          if (success) {
+            raw_var_data_.reset(new RawVarData);
+            raw_var_data_->type = PP_VARTYPE_ARRAY_BUFFER;
+            raw_var_data_->shmem_type = static_cast<ShmemType>(shmem_type);
+            raw_var_data_->host_handle_id = host_handle_id;
+          }
+        } else if (shmem_type == ARRAY_BUFFER_SHMEM_PLUGIN) {
+          SerializedHandle plugin_handle;
+          success = m->ReadInt(iter, &length);
+          success &= IPC::ParamTraits<SerializedHandle>::Read(
+              m, iter, &plugin_handle);
+          if (success) {
+            raw_var_data_.reset(new RawVarData);
+            raw_var_data_->type = PP_VARTYPE_ARRAY_BUFFER;
+            raw_var_data_->shmem_type = static_cast<ShmemType>(shmem_type);
+            raw_var_data_->shmem_size = length;
+            raw_var_data_->plugin_handle = plugin_handle;
+          }
+        }
       }
       break;
     }
@@ -210,7 +298,7 @@
       break;
     case PP_VARTYPE_ARRAY:
     case PP_VARTYPE_DICTIONARY:
-      // TODO(brettw) when these types are supported, implement this.
+      // TODO(yzshen) when these types are supported, implement this.
       NOTIMPLEMENTED();
       break;
     default:
@@ -237,6 +325,9 @@
 }
 
 void SerializedVar::Inner::ConvertRawVarData() {
+#if defined(NACL_WIN64)
+  NOTREACHED();
+#else
   if (!raw_var_data_.get())
     return;
 
@@ -248,15 +339,49 @@
       break;
     }
     case PP_VARTYPE_ARRAY_BUFFER: {
-      var_ = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
-          static_cast<uint32>(raw_var_data_->data.size()),
-          raw_var_data_->data.data());
+      if (raw_var_data_->shmem_type == ARRAY_BUFFER_SHMEM_HOST) {
+        base::SharedMemoryHandle host_handle;
+        uint32 size_in_bytes;
+        bool ok =
+            PpapiGlobals::Get()->GetVarTracker()->
+            StopTrackingSharedMemoryHandle(raw_var_data_->host_handle_id,
+                                           instance_,
+                                           &host_handle,
+                                           &size_in_bytes);
+        if (ok) {
+          var_ = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
+              size_in_bytes, host_handle);
+        } else {
+          LOG(ERROR) << "Couldn't find array buffer id: "
+                     <<  raw_var_data_->host_handle_id;
+          var_ = PP_MakeUndefined();
+        }
+      } else if (raw_var_data_->shmem_type == ARRAY_BUFFER_SHMEM_PLUGIN) {
+        var_ = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
+            raw_var_data_->shmem_size,
+            raw_var_data_->plugin_handle.shmem());
+      } else {
+        var_ = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
+            static_cast<uint32>(raw_var_data_->data.size()),
+            raw_var_data_->data.data());
+      }
       break;
     }
     default:
       NOTREACHED();
   }
   raw_var_data_.reset(NULL);
+#endif
+}
+
+SerializedHandle* SerializedVar::Inner::GetPluginShmemHandle() const {
+  if (raw_var_data_.get()) {
+    if (raw_var_data_->type == PP_VARTYPE_ARRAY_BUFFER) {
+      if (raw_var_data_->shmem_size != 0)
+        return &raw_var_data_->plugin_handle;
+    }
+  }
+  return NULL;
 }
 
 // SerializedVar ---------------------------------------------------------------
@@ -289,6 +414,17 @@
     output->push_back(SerializedVarSendInput(dispatcher, input[i]));
 }
 
+// SerializedVarSendInputShmem -------------------------------------------------
+
+SerializedVarSendInputShmem::SerializedVarSendInputShmem(
+    Dispatcher* dispatcher,
+    const PP_Var& var,
+    const PP_Instance& instance)
+    : SerializedVar(dispatcher->serialization_rules()) {
+  inner_->SetVar(dispatcher->serialization_rules()->SendCallerOwned(var));
+  inner_->SetInstance(instance);
+}
+
 // ReceiveSerializedVarReturnValue ---------------------------------------------
 
 ReceiveSerializedVarReturnValue::ReceiveSerializedVarReturnValue() {
@@ -394,6 +530,13 @@
   return serialized_.inner_->GetVar();
 }
 
+
+PP_Var SerializedVarReceiveInput::GetForInstance(Dispatcher* dispatcher,
+                                                 PP_Instance instance) {
+  serialized_.inner_->SetInstance(instance);
+  return Get(dispatcher);
+}
+
 // SerializedVarVectorReceiveInput ---------------------------------------------
 
 SerializedVarVectorReceiveInput::SerializedVarVectorReceiveInput(
diff --git a/ppapi/proxy/serialized_var.h b/ppapi/proxy/serialized_var.h
index 3b74a3e..f283590 100644
--- a/ppapi/proxy/serialized_var.h
+++ b/ppapi/proxy/serialized_var.h
@@ -11,8 +11,12 @@
 #include "base/basictypes.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
+#include "base/shared_memory.h"
+#include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_var.h"
 #include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/proxy/serialized_handle.h"
+#include "ppapi/proxy/serialized_structs.h"
 #include "ppapi/proxy/var_serialization_rules.h"
 
 class PickleIterator;
@@ -79,11 +83,20 @@
     return inner_->ReadFromMessage(m, iter);
   }
 
+  // Used by chrome/nacl/nacl_ipc_adapter.cc
+  SerializedHandle* GetPluginShmemHandle() const {
+    return inner_->GetPluginShmemHandle();
+  }
+  void WriteRawVarHeader(IPC::Message* m) const {
+    inner_->WriteRawVarHeader(m);
+  }
+
  protected:
   friend class SerializedVarReceiveInput;
   friend class SerializedVarReturnValue;
   friend class SerializedVarOutParam;
   friend class SerializedVarSendInput;
+  friend class SerializedVarSendInputShmem;
   friend class SerializedVarTestConstructor;
   friend class SerializedVarVectorReceiveInput;
 
@@ -103,6 +116,7 @@
     // See outer class's declarations above.
     PP_Var GetVar();
     void SetVar(PP_Var var);
+    void SetInstance(PP_Instance instance);
 
     // For the SerializedVarTestConstructor, this writes the Var value as if
     // it was just received off the wire, without any serialization rules.
@@ -115,6 +129,12 @@
     void SetCleanupModeToEndSendPassRef();
     void SetCleanupModeToEndReceiveCallerOwned();
 
+    // Returns a handle in the underlying data, if it exists.
+    SerializedHandle* GetPluginShmemHandle() const;
+
+    // Writes raw var data, excluding handles.
+    void WriteRawVarHeader(IPC::Message* m) const;
+
    private:
     enum CleanupMode {
       // The serialized var won't do anything special in the destructor
@@ -128,6 +148,13 @@
       END_RECEIVE_CALLER_OWNED
     };
 
+    // Enum for array buffer message types.
+    enum ShmemType {
+      ARRAY_BUFFER_NO_SHMEM,
+      ARRAY_BUFFER_SHMEM_HOST,
+      ARRAY_BUFFER_SHMEM_PLUGIN,
+    };
+
     // ReadFromMessage() may be called on the I/O thread, e.g., when reading the
     // reply to a sync message. We cannot use the var tracker on the I/O thread,
     // which means we cannot create PP_Var for PP_VARTYPE_STRING and
@@ -136,7 +163,11 @@
     // the main thread.
     struct RawVarData {
       PP_VarType type;
+      ShmemType shmem_type;
       std::string data;
+      uint32 shmem_size;
+      int host_handle_id;
+      SerializedHandle plugin_handle;
     };
 
     // Converts |raw_var_data_| to |var_|. It is a no-op if |raw_var_data_| is
@@ -158,6 +189,8 @@
     // a string ID. Before this, the as_id will be 0 for VARTYPE_STRING.
     PP_Var var_;
 
+    PP_Instance instance_;
+
     CleanupMode cleanup_mode_;
 
 #ifndef NDEBUG
@@ -208,6 +241,19 @@
   SerializedVarSendInput();
 };
 
+// Specialization for optionally sending over shared memory.
+class PPAPI_PROXY_EXPORT SerializedVarSendInputShmem : public SerializedVar {
+ public:
+  SerializedVarSendInputShmem(Dispatcher* dispatcher, const PP_Var& var,
+                              const PP_Instance& instance);
+
+ private:
+  // Disallow the empty constructor, but keep the default copy constructor
+  // which is required to send the object to the IPC system.
+  SerializedVarSendInputShmem();
+};
+
+
 // For the calling side of a function returning a var. The sending side uses
 // SerializedVarReturnValue.
 //
@@ -324,6 +370,7 @@
   ~SerializedVarReceiveInput();
 
   PP_Var Get(Dispatcher* dispatcher);
+  PP_Var GetForInstance(Dispatcher* dispatcher, PP_Instance instance);
 
  private:
   const SerializedVar& serialized_;
diff --git a/ppapi/proxy/talk_resource.cc b/ppapi/proxy/talk_resource.cc
new file mode 100644
index 0000000..557e306
--- /dev/null
+++ b/ppapi/proxy/talk_resource.cc
@@ -0,0 +1,44 @@
+// 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 "ppapi/proxy/talk_resource.h"
+
+#include "ppapi/proxy/ppapi_messages.h"
+
+namespace ppapi {
+namespace proxy {
+
+TalkResource::TalkResource(Connection connection, PP_Instance instance)
+    : PluginResource(connection, instance) {
+}
+
+TalkResource::~TalkResource() {
+}
+
+thunk::PPB_Talk_Private_API* TalkResource::AsPPB_Talk_Private_API() {
+  return this;
+}
+
+int32_t TalkResource::GetPermission(scoped_refptr<TrackedCallback> callback) {
+  if (TrackedCallback::IsPending(callback_))
+    return PP_ERROR_INPROGRESS;
+  callback_ = callback;
+
+  if (!sent_create_to_browser())
+    SendCreate(BROWSER, PpapiHostMsg_Talk_Create());
+
+  Call<PpapiPluginMsg_Talk_GetPermissionReply>(
+      BROWSER,
+      PpapiHostMsg_Talk_GetPermission(),
+      base::Bind(&TalkResource::GetPermissionReply, base::Unretained(this)));
+  return PP_OK_COMPLETIONPENDING;
+}
+
+void TalkResource::GetPermissionReply(
+    const ResourceMessageReplyParams& params) {
+  callback_->Run(params.result());
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/talk_resource.h b/ppapi/proxy/talk_resource.h
new file mode 100644
index 0000000..c73f458
--- /dev/null
+++ b/ppapi/proxy/talk_resource.h
@@ -0,0 +1,41 @@
+// 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 PPAPI_PROXY_TALK_RESOURCE_H_
+#define PPAPI_PROXY_TALK_RESOURCE_H_
+
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/ppb_talk_private_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+class PPAPI_PROXY_EXPORT TalkResource
+    : public PluginResource,
+      public NON_EXPORTED_BASE(thunk::PPB_Talk_Private_API) {
+ public:
+  TalkResource(Connection connection, PP_Instance instance);
+  virtual ~TalkResource();
+
+  // Resource overrides.
+  thunk::PPB_Talk_Private_API* AsPPB_Talk_Private_API();
+
+  // PPB_Talk_API implementation.
+  virtual int32_t GetPermission(
+      scoped_refptr<TrackedCallback> callback) OVERRIDE;
+
+ private:
+  void GetPermissionReply(const ResourceMessageReplyParams& params);
+
+  scoped_refptr<TrackedCallback> callback_;
+
+  DISALLOW_COPY_AND_ASSIGN(TalkResource);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_TALK_RESOURCE_H_
diff --git a/ppapi/proxy/truetype_font_resource.cc b/ppapi/proxy/truetype_font_resource.cc
new file mode 100644
index 0000000..0b07195
--- /dev/null
+++ b/ppapi/proxy/truetype_font_resource.cc
@@ -0,0 +1,130 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/truetype_font_resource.h"
+
+#include "base/bind.h"
+#include "ipc/ipc_message.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/array_writer.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/resource_tracker.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/thunk/enter.h"
+
+using ppapi::thunk::EnterResourceNoLock;
+using ppapi::thunk::PPB_TrueTypeFont_API;
+
+namespace {
+
+}  // namespace
+
+namespace ppapi {
+namespace proxy {
+
+TrueTypeFontResource::TrueTypeFontResource(
+    Connection connection,
+    PP_Instance instance,
+    const PP_TrueTypeFontDesc_Dev& desc)
+    : PluginResource(connection, instance) {
+  SerializedTrueTypeFontDesc serialized_desc;
+  serialized_desc.SetFromPPTrueTypeFontDesc(desc);
+  SendCreate(RENDERER, PpapiHostMsg_TrueTypeFont_Create(serialized_desc));
+}
+
+TrueTypeFontResource::~TrueTypeFontResource() {
+}
+
+PPB_TrueTypeFont_API* TrueTypeFontResource::AsPPB_TrueTypeFont_API() {
+  return this;
+}
+
+int32_t TrueTypeFontResource::Describe(
+    PP_TrueTypeFontDesc_Dev* desc,
+    scoped_refptr<TrackedCallback> callback) {
+
+  Call<PpapiPluginMsg_TrueTypeFont_DescribeReply>(RENDERER,
+      PpapiHostMsg_TrueTypeFont_Describe(),
+      base::Bind(&TrueTypeFontResource::OnPluginMsgDescribeComplete, this,
+                 callback, desc));
+  return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t TrueTypeFontResource::GetTableTags(
+    const PP_ArrayOutput& output,
+    scoped_refptr<TrackedCallback> callback) {
+  Call<PpapiPluginMsg_TrueTypeFont_GetTableTagsReply>(RENDERER,
+      PpapiHostMsg_TrueTypeFont_GetTableTags(),
+      base::Bind(&TrueTypeFontResource::OnPluginMsgGetTableTagsComplete, this,
+                 callback, output));
+  return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t TrueTypeFontResource::GetTable(
+    uint32_t table,
+    int32_t offset,
+    int32_t max_data_length,
+    const PP_ArrayOutput& output,
+    scoped_refptr<TrackedCallback> callback) {
+  Call<PpapiPluginMsg_TrueTypeFont_GetTableReply>(RENDERER,
+      PpapiHostMsg_TrueTypeFont_GetTable(table, offset, max_data_length),
+      base::Bind(&TrueTypeFontResource::OnPluginMsgGetTableComplete, this,
+                 callback, output));
+  return PP_OK_COMPLETIONPENDING;
+}
+
+void TrueTypeFontResource::OnPluginMsgDescribeComplete(
+    scoped_refptr<TrackedCallback> callback,
+    PP_TrueTypeFontDesc_Dev* pp_desc,
+    const ResourceMessageReplyParams& params,
+    const ppapi::proxy::SerializedTrueTypeFontDesc& desc) {
+  int32_t result = params.result();
+  if (result == PP_OK)
+    desc.CopyToPPTrueTypeFontDesc(pp_desc);
+  callback->Run(result);
+}
+
+void TrueTypeFontResource::OnPluginMsgGetTableTagsComplete(
+    scoped_refptr<TrackedCallback> callback,
+    PP_ArrayOutput array_output,
+    const ResourceMessageReplyParams& params,
+    const std::vector<uint32_t>& tag_array) {
+  // The result code should contain the data size if it's positive.
+  int32_t result = params.result();
+  DCHECK((result < 0 && tag_array.size() == 0) ||
+         result == static_cast<int32_t>(tag_array.size()));
+
+  ArrayWriter output;
+  output.set_pp_array_output(array_output);
+  if (output.is_valid())
+    output.StoreArray(&tag_array[0], std::max(0, result));
+  else
+    result = PP_ERROR_FAILED;
+
+  callback->Run(result);
+}
+
+void TrueTypeFontResource::OnPluginMsgGetTableComplete(
+    scoped_refptr<TrackedCallback> callback,
+    PP_ArrayOutput array_output,
+    const ResourceMessageReplyParams& params,
+    const std::string& data) {
+  // The result code should contain the data size if it's positive.
+  int32_t result = params.result();
+  DCHECK((result < 0 && data.size() == 0) ||
+         result == static_cast<int32_t>(data.size()));
+
+  ArrayWriter output;
+  output.set_pp_array_output(array_output);
+  if (output.is_valid())
+    output.StoreArray(data.data(), std::max(0, result));
+  else
+    result = PP_ERROR_FAILED;
+
+  callback->Run(result);
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/truetype_font_resource.h b/ppapi/proxy/truetype_font_resource.h
new file mode 100644
index 0000000..6aac2d5
--- /dev/null
+++ b/ppapi/proxy/truetype_font_resource.h
@@ -0,0 +1,73 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_TRUETYPE_FONT_RESOURCE_H_
+#define PPAPI_PROXY_TRUETYPE_FONT_RESOURCE_H_
+
+#include <string>
+
+#include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/thunk/ppb_truetype_font_api.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace proxy {
+
+struct SerializedTrueTypeFontDesc;
+
+class PPAPI_PROXY_EXPORT TrueTypeFontResource
+    : public PluginResource,
+      public thunk::PPB_TrueTypeFont_API {
+ public:
+  TrueTypeFontResource(Connection connection,
+                       PP_Instance instance,
+                       const PP_TrueTypeFontDesc_Dev& desc);
+  virtual ~TrueTypeFontResource();
+
+  // Resource overrides.
+  virtual thunk::PPB_TrueTypeFont_API* AsPPB_TrueTypeFont_API() OVERRIDE;
+
+  // PPB_TrueTypeFont_API implementation.
+  virtual int32_t Describe(
+      PP_TrueTypeFontDesc_Dev* desc,
+      scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual int32_t GetTableTags(
+      const PP_ArrayOutput& output,
+      scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual int32_t GetTable(
+      uint32_t table,
+      int32_t offset,
+      int32_t max_data_length,
+      const PP_ArrayOutput& output,
+      scoped_refptr<TrackedCallback> callback) OVERRIDE;
+
+ private:
+  void OnPluginMsgDescribeComplete(
+      scoped_refptr<TrackedCallback> callback,
+      PP_TrueTypeFontDesc_Dev* pp_desc,
+      const ResourceMessageReplyParams& params,
+      const ppapi::proxy::SerializedTrueTypeFontDesc& desc);
+  void OnPluginMsgGetTableTagsComplete(
+      scoped_refptr<TrackedCallback> callback,
+      PP_ArrayOutput array_output,
+      const ResourceMessageReplyParams& params,
+      const std::vector<uint32_t>& data);
+  void OnPluginMsgGetTableComplete(
+      scoped_refptr<TrackedCallback> callback,
+      PP_ArrayOutput array_output,
+      const ResourceMessageReplyParams& params,
+      const std::string& data);
+
+  DISALLOW_COPY_AND_ASSIGN(TrueTypeFontResource);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_TRUETYPE_FONT_RESOURCE_H_
diff --git a/ppapi/proxy/truetype_font_singleton_resource.cc b/ppapi/proxy/truetype_font_singleton_resource.cc
new file mode 100644
index 0000000..b812bf1
--- /dev/null
+++ b/ppapi/proxy/truetype_font_singleton_resource.cc
@@ -0,0 +1,68 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/truetype_font_singleton_resource.h"
+
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/array_writer.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/shared_impl/var.h"
+
+namespace ppapi {
+namespace proxy {
+
+TrueTypeFontSingletonResource::TrueTypeFontSingletonResource(
+    Connection connection,
+    PP_Instance instance)
+    : PluginResource(connection, instance) {
+  SendCreate(BROWSER, PpapiHostMsg_TrueTypeFontSingleton_Create());
+}
+
+TrueTypeFontSingletonResource::~TrueTypeFontSingletonResource() {
+}
+
+thunk::PPB_TrueTypeFont_Singleton_API*
+TrueTypeFontSingletonResource::AsPPB_TrueTypeFont_Singleton_API() {
+  return this;
+}
+
+int32_t TrueTypeFontSingletonResource::GetFontFamilies(
+    PP_Instance instance,
+    const PP_ArrayOutput& output,
+    const scoped_refptr<TrackedCallback>& callback) {
+  Call<PpapiPluginMsg_TrueTypeFontSingleton_GetFontFamiliesReply>(BROWSER,
+      PpapiHostMsg_TrueTypeFontSingleton_GetFontFamilies(),
+      base::Bind(
+          &TrueTypeFontSingletonResource::OnPluginMsgGetFontFamiliesComplete,
+          this, callback, output));
+  return PP_OK_COMPLETIONPENDING;
+}
+
+void TrueTypeFontSingletonResource::OnPluginMsgGetFontFamiliesComplete(
+    scoped_refptr<TrackedCallback> callback,
+    PP_ArrayOutput array_output,
+    const ResourceMessageReplyParams& params,
+    const std::vector<std::string>& font_families) {
+  // The result code should contain the data size if it's positive.
+  int32_t result = params.result();
+  DCHECK((result < 0 && font_families.size() == 0) ||
+         result == static_cast<int32_t>(font_families.size()));
+
+  ArrayWriter output;
+  output.set_pp_array_output(array_output);
+  if (output.is_valid()) {
+    std::vector< scoped_refptr<Var> > font_family_vars;
+    for (size_t i = 0; i < font_families.size(); i++)
+      font_family_vars.push_back(
+          scoped_refptr<Var>(new StringVar(font_families[i])));
+    output.StoreVarVector(font_family_vars);
+  } else {
+    result = PP_ERROR_FAILED;
+  }
+
+  callback->Run(result);
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/truetype_font_singleton_resource.h b/ppapi/proxy/truetype_font_singleton_resource.h
new file mode 100644
index 0000000..03c9c7d
--- /dev/null
+++ b/ppapi/proxy/truetype_font_singleton_resource.h
@@ -0,0 +1,55 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_TRUETYPE_FONT_SINGLETON_RESOURCE_H_
+#define PPAPI_PROXY_TRUETYPE_FONT_SINGLETON_RESOURCE_H_
+
+#include <string>
+#include <vector>
+
+#include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/thunk/ppb_truetype_font_singleton_api.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace proxy {
+
+struct SerializedTrueTypeFontDescription;
+
+// This handles the singleton calls (that don't take a PP_Resource parameter)
+// on the TrueType font interface.
+class TrueTypeFontSingletonResource
+    : public PluginResource,
+      public thunk::PPB_TrueTypeFont_Singleton_API {
+ public:
+  TrueTypeFontSingletonResource(Connection connection, PP_Instance instance);
+  virtual ~TrueTypeFontSingletonResource();
+
+  // Resource override.
+  virtual thunk::PPB_TrueTypeFont_Singleton_API*
+      AsPPB_TrueTypeFont_Singleton_API() OVERRIDE;
+
+  // thunk::PPB_TrueTypeFont_Singleton_API implementation.
+  virtual int32_t GetFontFamilies(
+      PP_Instance instance,
+      const PP_ArrayOutput& output,
+      const scoped_refptr<TrackedCallback>& callback) OVERRIDE;
+
+ private:
+  void OnPluginMsgGetFontFamiliesComplete(
+      scoped_refptr<TrackedCallback> callback,
+      PP_ArrayOutput array_output,
+      const ResourceMessageReplyParams& params,
+      const std::vector<std::string>& data);
+
+  DISALLOW_COPY_AND_ASSIGN(TrueTypeFontSingletonResource);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_TRUETYPE_FONT_SINGLETON_RESOURCE_H_
diff --git a/ppapi/proxy/udp_socket_private_resource.cc b/ppapi/proxy/udp_socket_private_resource.cc
new file mode 100644
index 0000000..608fc00
--- /dev/null
+++ b/ppapi/proxy/udp_socket_private_resource.cc
@@ -0,0 +1,252 @@
+// 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 "ppapi/proxy/udp_socket_private_resource.h"
+
+#include <algorithm>
+#include <cstring>
+
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/ppapi_messages.h"
+
+namespace ppapi {
+namespace proxy {
+
+const int32_t UDPSocketPrivateResource::kMaxReadSize = 1024 * 1024;
+const int32_t UDPSocketPrivateResource::kMaxWriteSize = 1024 * 1024;
+
+UDPSocketPrivateResource::UDPSocketPrivateResource(Connection connection,
+                                                   PP_Instance instance)
+    : PluginResource(connection, instance),
+      bound_(false),
+      closed_(false),
+      read_buffer_(NULL),
+      bytes_to_read_(-1) {
+  recvfrom_addr_.size = 0;
+  memset(recvfrom_addr_.data, 0,
+         arraysize(recvfrom_addr_.data) * sizeof(*recvfrom_addr_.data));
+  bound_addr_.size = 0;
+  memset(bound_addr_.data, 0,
+         arraysize(bound_addr_.data) * sizeof(*bound_addr_.data));
+
+  SendCreate(BROWSER, PpapiHostMsg_UDPSocketPrivate_Create());
+}
+
+UDPSocketPrivateResource::~UDPSocketPrivateResource() {
+}
+
+thunk::PPB_UDPSocket_Private_API*
+UDPSocketPrivateResource::AsPPB_UDPSocket_Private_API() {
+  return this;
+}
+
+int32_t UDPSocketPrivateResource::SetSocketFeature(
+    PP_UDPSocketFeature_Private name,
+    PP_Var value) {
+  if (bound_ || closed_)
+    return PP_ERROR_FAILED;
+
+  switch (name) {
+    case PP_UDPSOCKETFEATURE_ADDRESS_REUSE:
+    case PP_UDPSOCKETFEATURE_BROADCAST:
+      if (value.type != PP_VARTYPE_BOOL)
+        return PP_ERROR_BADARGUMENT;
+      SendBoolSocketFeature(static_cast<int32_t>(name),
+                            PP_ToBool(value.value.as_bool));
+      break;
+    default:
+      return PP_ERROR_BADARGUMENT;
+  }
+  return PP_OK;
+}
+
+int32_t UDPSocketPrivateResource::Bind(
+    const PP_NetAddress_Private* addr,
+    scoped_refptr<TrackedCallback> callback) {
+  if (!addr)
+    return PP_ERROR_BADARGUMENT;
+  if (bound_ || closed_)
+    return PP_ERROR_FAILED;
+  if (TrackedCallback::IsPending(bind_callback_))
+    return PP_ERROR_INPROGRESS;
+
+  bind_callback_ = callback;
+
+  // Send the request, the browser will call us back via BindReply.
+  SendBind(*addr);
+  return PP_OK_COMPLETIONPENDING;
+}
+
+PP_Bool UDPSocketPrivateResource::GetBoundAddress(PP_NetAddress_Private* addr) {
+  if (!addr || !bound_ || closed_)
+    return PP_FALSE;
+
+  *addr = bound_addr_;
+  return PP_TRUE;
+}
+
+int32_t UDPSocketPrivateResource::RecvFrom(
+    char* buffer,
+    int32_t num_bytes,
+    scoped_refptr<TrackedCallback> callback) {
+  if (!buffer || num_bytes <= 0)
+    return PP_ERROR_BADARGUMENT;
+  if (!bound_)
+    return PP_ERROR_FAILED;
+  if (TrackedCallback::IsPending(recvfrom_callback_))
+    return PP_ERROR_INPROGRESS;
+
+  read_buffer_ = buffer;
+  bytes_to_read_ = std::min(num_bytes, kMaxReadSize);
+  recvfrom_callback_ = callback;
+
+  // Send the request, the browser will call us back via RecvFromReply.
+  SendRecvFrom(bytes_to_read_);
+  return PP_OK_COMPLETIONPENDING;
+}
+
+PP_Bool UDPSocketPrivateResource::GetRecvFromAddress(
+    PP_NetAddress_Private* addr) {
+  if (!addr)
+    return PP_FALSE;
+  *addr = recvfrom_addr_;
+  return PP_TRUE;
+}
+
+void UDPSocketPrivateResource::PostAbortIfNecessary(
+    scoped_refptr<TrackedCallback>* callback) {
+  if (TrackedCallback::IsPending(*callback))
+    (*callback)->PostAbort();
+}
+
+int32_t UDPSocketPrivateResource::SendTo(
+    const char* buffer,
+    int32_t num_bytes,
+    const PP_NetAddress_Private* addr,
+    scoped_refptr<TrackedCallback> callback) {
+  if (!buffer || num_bytes <= 0 || !addr)
+    return PP_ERROR_BADARGUMENT;
+  if (!bound_)
+    return PP_ERROR_FAILED;
+  if (TrackedCallback::IsPending(sendto_callback_))
+    return PP_ERROR_INPROGRESS;
+
+  if (num_bytes > kMaxWriteSize)
+    num_bytes = kMaxWriteSize;
+
+  sendto_callback_ = callback;
+
+  // Send the request, the browser will call us back via SendToReply.
+  SendSendTo(std::string(buffer, num_bytes), *addr);
+  return PP_OK_COMPLETIONPENDING;
+}
+
+void UDPSocketPrivateResource::Close() {
+  if(closed_)
+    return;
+
+  bound_ = false;
+  closed_ = true;
+
+  SendClose();
+
+  PostAbortIfNecessary(&bind_callback_);
+  PostAbortIfNecessary(&recvfrom_callback_);
+  PostAbortIfNecessary(&sendto_callback_);
+}
+
+void UDPSocketPrivateResource::SendBoolSocketFeature(int32_t name, bool value) {
+  PpapiHostMsg_UDPSocketPrivate_SetBoolSocketFeature msg(name, value);
+  Post(BROWSER, msg);
+}
+
+void UDPSocketPrivateResource::SendBind(const PP_NetAddress_Private& addr) {
+  PpapiHostMsg_UDPSocketPrivate_Bind msg(addr);
+  Call<PpapiPluginMsg_UDPSocketPrivate_BindReply>(
+      BROWSER,
+      msg,
+      base::Bind(&UDPSocketPrivateResource::OnPluginMsgBindReply,
+                 base::Unretained(this)));
+}
+
+void UDPSocketPrivateResource::SendRecvFrom(int32_t num_bytes) {
+  PpapiHostMsg_UDPSocketPrivate_RecvFrom msg(num_bytes);
+  Call<PpapiPluginMsg_UDPSocketPrivate_RecvFromReply>(
+      BROWSER,
+      msg,
+      base::Bind(&UDPSocketPrivateResource::OnPluginMsgRecvFromReply,
+                 base::Unretained(this)));
+}
+
+void UDPSocketPrivateResource::SendSendTo(const std::string& buffer,
+                                          const PP_NetAddress_Private& addr) {
+  PpapiHostMsg_UDPSocketPrivate_SendTo msg(buffer, addr);
+  Call<PpapiPluginMsg_UDPSocketPrivate_SendToReply>(
+      BROWSER,
+      msg,
+      base::Bind(&UDPSocketPrivateResource::OnPluginMsgSendToReply,
+                 base::Unretained(this)));
+}
+
+void UDPSocketPrivateResource::SendClose() {
+  PpapiHostMsg_UDPSocketPrivate_Close msg;
+  Post(BROWSER, msg);
+}
+
+void UDPSocketPrivateResource::OnPluginMsgBindReply(
+    const ResourceMessageReplyParams& params,
+    const PP_NetAddress_Private& bound_addr) {
+  if (!TrackedCallback::IsPending(bind_callback_)) {
+    NOTREACHED();
+    return;
+  }
+  if (params.result() == PP_OK)
+    bound_ = true;
+  bound_addr_ = bound_addr;
+  bind_callback_->Run(params.result());
+}
+
+void UDPSocketPrivateResource::OnPluginMsgRecvFromReply(
+    const ResourceMessageReplyParams& params,
+    const std::string& data,
+    const PP_NetAddress_Private& addr) {
+  if (!TrackedCallback::IsPending(recvfrom_callback_) || !read_buffer_) {
+    NOTREACHED();
+    return;
+  }
+  bool succeeded = (params.result() == PP_OK);
+  if (succeeded) {
+    CHECK_LE(static_cast<int32_t>(data.size()), bytes_to_read_);
+    if (!data.empty())
+      memcpy(read_buffer_, data.c_str(), data.size());
+  }
+  read_buffer_ = NULL;
+  bytes_to_read_ = -1;
+  recvfrom_addr_ = addr;
+
+  if (succeeded)
+    recvfrom_callback_->Run(static_cast<int32_t>(data.size()));
+  else
+    recvfrom_callback_->Run(params.result());
+}
+
+void UDPSocketPrivateResource::OnPluginMsgSendToReply(
+    const ResourceMessageReplyParams& params,
+    int32_t bytes_written) {
+  if (!TrackedCallback::IsPending(sendto_callback_)) {
+    NOTREACHED();
+    return;
+  }
+  if (params.result() == PP_OK)
+    sendto_callback_->Run(bytes_written);
+  else
+    sendto_callback_->Run(params.result());
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/udp_socket_private_resource.h b/ppapi/proxy/udp_socket_private_resource.h
new file mode 100644
index 0000000..6403f6b
--- /dev/null
+++ b/ppapi/proxy/udp_socket_private_resource.h
@@ -0,0 +1,91 @@
+// 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 PPAPI_PROXY_UDP_SOCKET_PRIVATE_RESOURCE_H_
+#define PPAPI_PROXY_UDP_SOCKET_PRIVATE_RESOURCE_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/ppb_udp_socket_private_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+class PPAPI_PROXY_EXPORT UDPSocketPrivateResource
+    : public PluginResource,
+      public thunk::PPB_UDPSocket_Private_API {
+ public:
+  UDPSocketPrivateResource(Connection connection,
+                           PP_Instance instance);
+  virtual ~UDPSocketPrivateResource();
+
+  // The maximum number of bytes that each PpapiHostMsg_PPBUDPSocket_RecvFrom
+  // message is allowed to request.
+  static const int32_t kMaxReadSize;
+  // The maximum number of bytes that each PpapiHostMsg_PPBUDPSocket_SendTo
+  // message is allowed to carry.
+  static const int32_t kMaxWriteSize;
+
+  // PluginResource implementation.
+  virtual thunk::PPB_UDPSocket_Private_API*
+      AsPPB_UDPSocket_Private_API() OVERRIDE;
+
+  // PPB_UDPSocket_Private_API implementation.
+  virtual int32_t SetSocketFeature(PP_UDPSocketFeature_Private name,
+                                   PP_Var value) OVERRIDE;
+  virtual int32_t Bind(const PP_NetAddress_Private* addr,
+                       scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual PP_Bool GetBoundAddress(PP_NetAddress_Private* addr) OVERRIDE;
+  virtual int32_t RecvFrom(char* buffer,
+                           int32_t num_bytes,
+                           scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual PP_Bool GetRecvFromAddress(PP_NetAddress_Private* addr) OVERRIDE;
+  virtual int32_t SendTo(const char* buffer,
+                         int32_t num_bytes,
+                         const PP_NetAddress_Private* addr,
+                         scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual void Close() OVERRIDE;
+
+ private:
+  void PostAbortIfNecessary(scoped_refptr<TrackedCallback>* callback);
+
+  void SendBoolSocketFeature(int32_t name, bool value);
+  void SendBind(const PP_NetAddress_Private& addr);
+  void SendRecvFrom(int32_t num_bytes);
+  void SendSendTo(const std::string& buffer,
+                  const PP_NetAddress_Private& addr);
+  void SendClose();
+
+  // IPC message handlers.
+  void OnPluginMsgBindReply(const ResourceMessageReplyParams& params,
+                            const PP_NetAddress_Private& bound_addr);
+  void OnPluginMsgRecvFromReply(const ResourceMessageReplyParams& params,
+                                const std::string& data,
+                                const PP_NetAddress_Private& addr);
+  void OnPluginMsgSendToReply(const ResourceMessageReplyParams& params,
+                              int32_t bytes_written);
+
+  bool bound_;
+  bool closed_;
+
+  scoped_refptr<TrackedCallback> bind_callback_;
+  scoped_refptr<TrackedCallback> recvfrom_callback_;
+  scoped_refptr<TrackedCallback> sendto_callback_;
+
+  char* read_buffer_;
+  int32_t bytes_to_read_;
+
+  PP_NetAddress_Private recvfrom_addr_;
+  PP_NetAddress_Private bound_addr_;
+
+  DISALLOW_COPY_AND_ASSIGN(UDPSocketPrivateResource);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_UDP_SOCKET_PRIVATE_RESOURCE_H_
diff --git a/ppapi/proxy/url_response_info_resource.cc b/ppapi/proxy/url_response_info_resource.cc
new file mode 100644
index 0000000..91c9990
--- /dev/null
+++ b/ppapi/proxy/url_response_info_resource.cc
@@ -0,0 +1,82 @@
+// 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 "ppapi/proxy/url_response_info_resource.h"
+
+#include "ppapi/proxy/ppb_file_ref_proxy.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+
+bool IsRedirect(int32_t status) {
+  return status >= 300 && status <= 399;
+}
+
+}  // namespace
+
+URLResponseInfoResource::URLResponseInfoResource(
+    Connection connection,
+    PP_Instance instance,
+    const URLResponseInfoData& data,
+    PP_Resource file_ref_resource)
+    : PluginResource(connection, instance),
+      data_(data),
+      body_as_file_ref_(ScopedPPResource::PassRef(), file_ref_resource) {
+}
+
+URLResponseInfoResource::~URLResponseInfoResource() {
+}
+
+thunk::PPB_URLResponseInfo_API*
+URLResponseInfoResource::AsPPB_URLResponseInfo_API() {
+  return this;
+}
+
+PP_Var URLResponseInfoResource::GetProperty(PP_URLResponseProperty property) {
+  switch (property) {
+    case PP_URLRESPONSEPROPERTY_URL:
+      return StringVar::StringToPPVar(data_.url);
+    case PP_URLRESPONSEPROPERTY_REDIRECTURL:
+      if (IsRedirect(data_.status_code))
+        return StringVar::StringToPPVar(data_.redirect_url);
+      break;
+    case PP_URLRESPONSEPROPERTY_REDIRECTMETHOD:
+      if (IsRedirect(data_.status_code))
+        return StringVar::StringToPPVar(data_.status_text);
+      break;
+    case PP_URLRESPONSEPROPERTY_STATUSCODE:
+      return PP_MakeInt32(data_.status_code);
+    case PP_URLRESPONSEPROPERTY_STATUSLINE:
+      return StringVar::StringToPPVar(data_.status_text);
+    case PP_URLRESPONSEPROPERTY_HEADERS:
+      return StringVar::StringToPPVar(data_.headers);
+  }
+  // The default is to return an undefined PP_Var.
+  return PP_MakeUndefined();
+}
+
+PP_Resource URLResponseInfoResource::GetBodyAsFileRef() {
+  if (!body_as_file_ref_.get())
+    return 0;
+  PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(
+      body_as_file_ref_.get());
+  return body_as_file_ref_.get();
+}
+
+URLResponseInfoData URLResponseInfoResource::GetData() {
+  // One ref is passed to the caller if there's a file ref.
+  if (body_as_file_ref_.get()) {
+    PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(
+        body_as_file_ref_.get());
+  }
+  return data_;
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/url_response_info_resource.h b/ppapi/proxy/url_response_info_resource.h
new file mode 100644
index 0000000..d3902d8
--- /dev/null
+++ b/ppapi/proxy/url_response_info_resource.h
@@ -0,0 +1,53 @@
+// 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 PPAPI_PROXY_URL_RESPONSE_INFO_RESOURCE_H_
+#define PPAPI_PROXY_URL_RESPONSE_INFO_RESOURCE_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/shared_impl/scoped_pp_resource.h"
+#include "ppapi/shared_impl/url_response_info_data.h"
+#include "ppapi/thunk/ppb_url_response_info_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+class PPAPI_PROXY_EXPORT URLResponseInfoResource
+    : public PluginResource,
+      public NON_EXPORTED_BASE(thunk::PPB_URLResponseInfo_API) {
+ public:
+  // The file_ref_resource should be the body_as_file_ref host resource in the
+  // |data| converted to a resource valid in the current process (if we're
+  // downloading to a file; it will be 0 if we're not). A reference
+  // is passed from the caller and is taken over by this object.
+  URLResponseInfoResource(Connection connection,
+                          PP_Instance instance,
+                          const URLResponseInfoData& data,
+                          PP_Resource file_ref_resource);
+  virtual ~URLResponseInfoResource();
+
+  // Resource override.
+  virtual PPB_URLResponseInfo_API* AsPPB_URLResponseInfo_API() OVERRIDE;
+
+  // PPB_URLResponseInfo_API implementation.
+  virtual PP_Var GetProperty(PP_URLResponseProperty property) OVERRIDE;
+  virtual PP_Resource GetBodyAsFileRef() OVERRIDE;
+  virtual URLResponseInfoData GetData() OVERRIDE;
+
+ private:
+  URLResponseInfoData data_;
+
+  // Non-zero when the load is being streamed to a file.
+  ScopedPPResource body_as_file_ref_;
+
+  DISALLOW_COPY_AND_ASSIGN(URLResponseInfoResource);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_URL_RESPONSE_INFO_RESOURCE_H_
diff --git a/ppapi/proxy/video_capture_resource.cc b/ppapi/proxy/video_capture_resource.cc
new file mode 100644
index 0000000..ca88adf
--- /dev/null
+++ b/ppapi/proxy/video_capture_resource.cc
@@ -0,0 +1,240 @@
+// 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 "ppapi/proxy/video_capture_resource.h"
+
+#include "ppapi/c/dev/ppp_video_capture_dev.h"
+#include "ppapi/proxy/dispatch_reply_message.h"
+#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/plugin_globals.h"
+#include "ppapi/proxy/plugin_resource_tracker.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/ppb_buffer_proxy.h"
+#include "ppapi/proxy/resource_message_params.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+
+namespace ppapi {
+namespace proxy {
+
+VideoCaptureResource::VideoCaptureResource(
+    Connection connection,
+    PP_Instance instance,
+    PluginDispatcher* dispatcher)
+    : PluginResource(connection, instance),
+      open_state_(BEFORE_OPEN),
+      ALLOW_THIS_IN_INITIALIZER_LIST(enumeration_helper_(this)) {
+  SendCreate(RENDERER, PpapiHostMsg_VideoCapture_Create());
+
+  ppp_video_capture_impl_ = static_cast<const PPP_VideoCapture_Dev*>(
+      dispatcher->local_get_interface()(PPP_VIDEO_CAPTURE_DEV_INTERFACE));
+}
+
+VideoCaptureResource::~VideoCaptureResource() {
+}
+
+void VideoCaptureResource::OnReplyReceived(
+    const ResourceMessageReplyParams& params,
+    const IPC::Message& msg) {
+  if (enumeration_helper_.HandleReply(params, msg))
+    return;
+
+  if (params.sequence()) {
+    PluginResource::OnReplyReceived(params, msg);
+    return;
+  }
+
+  IPC_BEGIN_MESSAGE_MAP(VideoCaptureResource, msg)
+    PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL(
+        PpapiPluginMsg_VideoCapture_OnDeviceInfo,
+        OnPluginMsgOnDeviceInfo)
+    PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL(
+        PpapiPluginMsg_VideoCapture_OnStatus,
+        OnPluginMsgOnStatus)
+    PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL(
+        PpapiPluginMsg_VideoCapture_OnError,
+        OnPluginMsgOnError)
+    PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL(
+        PpapiPluginMsg_VideoCapture_OnBufferReady,
+        OnPluginMsgOnBufferReady)
+    PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL_UNHANDLED(NOTREACHED())
+  IPC_END_MESSAGE_MAP()
+}
+
+int32_t VideoCaptureResource::EnumerateDevices0_2(
+    PP_Resource* devices,
+    scoped_refptr<TrackedCallback> callback) {
+  return enumeration_helper_.EnumerateDevices0_2(devices, callback);
+}
+
+int32_t VideoCaptureResource::EnumerateDevices(
+    const PP_ArrayOutput& output,
+    scoped_refptr<TrackedCallback> callback) {
+  return enumeration_helper_.EnumerateDevices(output, callback);
+}
+
+int32_t VideoCaptureResource::MonitorDeviceChange(
+    PP_MonitorDeviceChangeCallback callback,
+    void* user_data) {
+  return enumeration_helper_.MonitorDeviceChange(callback, user_data);
+}
+
+int32_t VideoCaptureResource::Open(
+    const std::string& device_id,
+    const PP_VideoCaptureDeviceInfo_Dev& requested_info,
+    uint32_t buffer_count,
+    scoped_refptr<TrackedCallback> callback) {
+  if (open_state_ != BEFORE_OPEN)
+    return PP_ERROR_FAILED;
+
+  if (TrackedCallback::IsPending(open_callback_))
+    return PP_ERROR_INPROGRESS;
+
+  open_callback_ = callback;
+
+  Call<PpapiPluginMsg_VideoCapture_OpenReply>(
+      RENDERER,
+      PpapiHostMsg_VideoCapture_Open(device_id, requested_info, buffer_count),
+      base::Bind(&VideoCaptureResource::OnPluginMsgOpenReply, this));
+  return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t VideoCaptureResource::StartCapture() {
+  if (open_state_ != OPENED)
+    return PP_ERROR_FAILED;
+
+  Post(RENDERER, PpapiHostMsg_VideoCapture_StartCapture());
+  return PP_OK;
+}
+
+int32_t VideoCaptureResource::ReuseBuffer(uint32_t buffer) {
+  if (buffer >= buffer_in_use_.size() || !buffer_in_use_[buffer])
+    return PP_ERROR_BADARGUMENT;
+  Post(RENDERER, PpapiHostMsg_VideoCapture_ReuseBuffer(buffer));
+  return PP_OK;
+}
+
+int32_t VideoCaptureResource::StopCapture() {
+  if (open_state_ != OPENED)
+    return PP_ERROR_FAILED;
+
+  Post(RENDERER, PpapiHostMsg_VideoCapture_StopCapture());
+  return PP_OK;
+}
+
+void VideoCaptureResource::Close() {
+  if (open_state_ == CLOSED)
+    return;
+
+  Post(RENDERER, PpapiHostMsg_VideoCapture_Close());
+
+  open_state_ = CLOSED;
+
+  if (TrackedCallback::IsPending(open_callback_))
+    open_callback_->PostAbort();
+}
+
+int32_t VideoCaptureResource::EnumerateDevicesSync(
+    const PP_ArrayOutput& devices) {
+  return enumeration_helper_.EnumerateDevicesSync(devices);
+}
+
+void VideoCaptureResource::LastPluginRefWasDeleted() {
+  enumeration_helper_.LastPluginRefWasDeleted();
+}
+
+void VideoCaptureResource::OnPluginMsgOnDeviceInfo(
+    const ResourceMessageReplyParams& params,
+    const struct PP_VideoCaptureDeviceInfo_Dev& info,
+    const std::vector<HostResource>& buffers,
+    uint32_t buffer_size) {
+  if (!ppp_video_capture_impl_)
+    return;
+
+  std::vector<base::SharedMemoryHandle> handles;
+  params.TakeAllSharedMemoryHandles(&handles);
+  CHECK(handles.size() == buffers.size());
+
+  PluginResourceTracker* tracker =
+      PluginGlobals::Get()->plugin_resource_tracker();
+  scoped_array<PP_Resource> resources(new PP_Resource[buffers.size()]);
+  for (size_t i = 0; i < buffers.size(); ++i) {
+    // We assume that the browser created a new set of resources.
+    DCHECK(!tracker->PluginResourceForHostResource(buffers[i]));
+    resources[i] = ppapi::proxy::PPB_Buffer_Proxy::AddProxyResource(
+        buffers[i], handles[i], buffer_size);
+  }
+
+  buffer_in_use_ = std::vector<bool>(buffers.size());
+
+  CallWhileUnlocked(ppp_video_capture_impl_->OnDeviceInfo,
+                    pp_instance(),
+                    pp_resource(),
+                    &info,
+                    static_cast<uint32_t>(buffers.size()),
+                    const_cast<const PP_Resource*>(resources.get()));
+
+  for (size_t i = 0; i < buffers.size(); ++i)
+    tracker->ReleaseResource(resources[i]);
+}
+
+void VideoCaptureResource::OnPluginMsgOnStatus(
+    const ResourceMessageReplyParams& params,
+    uint32_t status) {
+  switch (status) {
+    case PP_VIDEO_CAPTURE_STATUS_STARTING:
+    case PP_VIDEO_CAPTURE_STATUS_STOPPING:
+      // Those states are not sent by the browser.
+      NOTREACHED();
+      break;
+  }
+  if (ppp_video_capture_impl_) {
+    CallWhileUnlocked(ppp_video_capture_impl_->OnStatus,
+                      pp_instance(),
+                      pp_resource(),
+                      status);
+  }
+}
+
+void VideoCaptureResource::OnPluginMsgOnError(
+    const ResourceMessageReplyParams& params,
+    uint32_t error_code) {
+  open_state_ = CLOSED;
+  if (ppp_video_capture_impl_) {
+    CallWhileUnlocked(ppp_video_capture_impl_->OnError,
+                      pp_instance(),
+                      pp_resource(),
+                      error_code);
+  }
+}
+
+void VideoCaptureResource::OnPluginMsgOnBufferReady(
+    const ResourceMessageReplyParams& params,
+    uint32_t buffer) {
+  SetBufferInUse(buffer);
+  if (ppp_video_capture_impl_) {
+    CallWhileUnlocked(ppp_video_capture_impl_->OnBufferReady,
+                      pp_instance(),
+                      pp_resource(),
+                      buffer);
+  }
+}
+
+void VideoCaptureResource::OnPluginMsgOpenReply(
+    const ResourceMessageReplyParams& params) {
+  if (open_state_ == BEFORE_OPEN && params.result() == PP_OK)
+    open_state_ = OPENED;
+
+  // The callback may have been aborted by Close().
+  if (TrackedCallback::IsPending(open_callback_))
+    open_callback_->Run(params.result());
+}
+
+void VideoCaptureResource::SetBufferInUse(uint32_t buffer_index) {
+  CHECK(buffer_index < buffer_in_use_.size());
+  buffer_in_use_[buffer_index] = true;
+}
+
+}  // namespace proxy
+}  // namespace ppapi
diff --git a/ppapi/proxy/video_capture_resource.h b/ppapi/proxy/video_capture_resource.h
new file mode 100644
index 0000000..e533ef0
--- /dev/null
+++ b/ppapi/proxy/video_capture_resource.h
@@ -0,0 +1,99 @@
+// 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 PPAPI_PROXY_VIDEO_CAPTURE_RESOURCE_H_
+#define PPAPI_PROXY_VIDEO_CAPTURE_RESOURCE_H_
+
+#include "base/compiler_specific.h"
+#include "ppapi/c/dev/ppp_video_capture_dev.h"
+#include "ppapi/proxy/device_enumeration_resource_helper.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/thunk/ppb_video_capture_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+class VideoCaptureResource
+    : public PluginResource,
+      public ::ppapi::thunk::PPB_VideoCapture_API {
+ public:
+  VideoCaptureResource(Connection connection,
+                       PP_Instance instance,
+                       PluginDispatcher* dispatcher);
+  virtual ~VideoCaptureResource();
+
+  // PluginResource override.
+  virtual thunk::PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE {
+    return this;
+  }
+
+  // PPB_VideoCapture_API implementation.
+  virtual int32_t EnumerateDevices0_2(
+      PP_Resource* devices,
+      scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual int32_t EnumerateDevices(
+      const PP_ArrayOutput& output,
+      scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual int32_t MonitorDeviceChange(
+      PP_MonitorDeviceChangeCallback callback,
+      void* user_data) OVERRIDE;
+  virtual int32_t Open(const std::string& device_id,
+                       const PP_VideoCaptureDeviceInfo_Dev& requested_info,
+                       uint32_t buffer_count,
+                       scoped_refptr<TrackedCallback> callback) OVERRIDE;
+  virtual int32_t StartCapture() OVERRIDE;
+  virtual int32_t ReuseBuffer(uint32_t buffer) OVERRIDE;
+  virtual int32_t StopCapture() OVERRIDE;
+  virtual void Close() OVERRIDE;
+  virtual int32_t EnumerateDevicesSync(const PP_ArrayOutput& devices) OVERRIDE;
+
+ protected:
+  // Resource override.
+  virtual void LastPluginRefWasDeleted() OVERRIDE;
+
+ private:
+  enum OpenState {
+    BEFORE_OPEN,
+    OPENED,
+    CLOSED
+  };
+
+  // PluginResource overrides.
+  virtual void OnReplyReceived(const ResourceMessageReplyParams& params,
+                               const IPC::Message& msg) OVERRIDE;
+
+  void OnPluginMsgOnDeviceInfo(const ResourceMessageReplyParams& params,
+                               const struct PP_VideoCaptureDeviceInfo_Dev& info,
+                               const std::vector<HostResource>& buffers,
+                               uint32_t buffer_size);
+  void OnPluginMsgOnStatus(const ResourceMessageReplyParams& params,
+                           uint32_t status);
+  void OnPluginMsgOnError(const ResourceMessageReplyParams& params,
+                          uint32_t error);
+  void OnPluginMsgOnBufferReady(const ResourceMessageReplyParams& params,
+                                uint32_t buffer);
+
+  void OnPluginMsgOpenReply(const ResourceMessageReplyParams& params);
+
+  void SetBufferInUse(uint32_t buffer_index);
+
+  // Points to the C interface of client implementation.
+  const PPP_VideoCapture_Dev* ppp_video_capture_impl_;
+
+  // Indicates that the i-th buffer is currently in use.
+  std::vector<bool> buffer_in_use_;
+
+  // Holds a reference of the callback so that Close() can cancel it.
+  scoped_refptr<TrackedCallback> open_callback_;
+  OpenState open_state_;
+
+  DeviceEnumerationResourceHelper enumeration_helper_;
+
+  DISALLOW_COPY_AND_ASSIGN(VideoCaptureResource);
+};
+
+}  // namespace proxy
+}  // namespace ppapi
+
+#endif  // PPAPI_PROXY_VIDEO_CAPTURE_RESOURCE_H_
diff --git a/ppapi/proxy/websocket_resource.cc b/ppapi/proxy/websocket_resource.cc
index c45de90..7439826 100644
--- a/ppapi/proxy/websocket_resource.cc
+++ b/ppapi/proxy/websocket_resource.cc
@@ -423,10 +423,10 @@
     return;
 
   // Append received data to queue.
-  scoped_refptr<Var> message_var(ArrayBufferVar::FromPPVar(
-      PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
+  scoped_refptr<Var> message_var(
+      PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferVar(
           message.size(),
-          &message.front())));
+          &message.front()));
   received_messages_.push(message_var);
 
   if (!TrackedCallback::IsPending(receive_callback_))
diff --git a/ppapi/shared_impl/DEPS b/ppapi/shared_impl/DEPS
index 823b983..9f93141 100644
--- a/ppapi/shared_impl/DEPS
+++ b/ppapi/shared_impl/DEPS
@@ -14,4 +14,7 @@
 
   "-ppapi/cpp",
   "-ppapi/proxy",
+
+  # For testing purpose.
+  "+ppapi/proxy/ppapi_proxy_test.h",
 ]
diff --git a/ppapi/shared_impl/api_id.h b/ppapi/shared_impl/api_id.h
index 360b8cb..00706bf 100644
--- a/ppapi/shared_impl/api_id.h
+++ b/ppapi/shared_impl/api_id.h
@@ -24,7 +24,6 @@
   API_ID_PPB_FILE_IO,
   API_ID_PPB_FILE_REF,
   API_ID_PPB_FILE_SYSTEM,
-  API_ID_PPB_FLASH,
   API_ID_PPB_FLASH_DEVICE_ID,
   API_ID_PPB_FLASH_FONTFILE,
   API_ID_PPB_FLASH_MENU,
diff --git a/ppapi/shared_impl/array_var.cc b/ppapi/shared_impl/array_var.cc
new file mode 100644
index 0000000..def1bb5
--- /dev/null
+++ b/ppapi/shared_impl/array_var.cc
@@ -0,0 +1,83 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/shared_impl/array_var.h"
+
+#include <limits>
+
+#include "base/logging.h"
+#include "base/memory/ref_counted.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/var_tracker.h"
+
+namespace ppapi {
+
+ArrayVar::ArrayVar() {
+}
+
+ArrayVar::~ArrayVar() {
+}
+
+// static
+ArrayVar* ArrayVar::FromPPVar(const PP_Var& var) {
+  if (var.type != PP_VARTYPE_ARRAY)
+    return NULL;
+
+  scoped_refptr<Var> var_object(
+      PpapiGlobals::Get()->GetVarTracker()->GetVar(var));
+  if (!var_object.get())
+    return NULL;
+  return var_object->AsArrayVar();
+}
+
+ArrayVar* ArrayVar::AsArrayVar() {
+  return this;
+}
+
+PP_VarType ArrayVar::GetType() const {
+  return PP_VARTYPE_ARRAY;
+}
+
+PP_Var ArrayVar::Get(uint32_t index) const {
+  if (index >= elements_.size())
+    return PP_MakeUndefined();
+
+  const PP_Var& element = elements_[index].get();
+  if (PpapiGlobals::Get()->GetVarTracker()->AddRefVar(element))
+    return element;
+  else
+    return PP_MakeUndefined();
+}
+
+PP_Bool ArrayVar::Set(uint32_t index, const PP_Var& value) {
+  if (index == std::numeric_limits<uint32_t>::max())
+    return PP_FALSE;
+
+  if (index >= elements_.size()) {
+    // Insert ScopedPPVars of type PP_VARTYPE_UNDEFINED to reach the new size
+    // (index + 1).
+    elements_.resize(index + 1);
+  }
+
+  elements_[index] = value;
+  return PP_TRUE;
+}
+
+uint32_t ArrayVar::GetLength() const {
+  if (elements_.size() > std::numeric_limits<uint32_t>::max()) {
+    CHECK(false);
+    return 0;
+  }
+
+  return static_cast<uint32_t>(elements_.size());
+}
+
+PP_Bool ArrayVar::SetLength(uint32_t length) {
+  // If |length| is larger than the current size, ScopedPPVars of type
+  // PP_VARTYPE_UNDEFINED will be inserted to reach the new length.
+  elements_.resize(length);
+  return PP_TRUE;
+}
+
+}  // namespace ppapi
diff --git a/ppapi/shared_impl/array_var.h b/ppapi/shared_impl/array_var.h
new file mode 100644
index 0000000..1214d87
--- /dev/null
+++ b/ppapi/shared_impl/array_var.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_SHARED_IMPL_ARRAY_VAR_H_
+#define PPAPI_SHARED_IMPL_ARRAY_VAR_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/ppapi_shared_export.h"
+#include "ppapi/shared_impl/scoped_pp_var.h"
+#include "ppapi/shared_impl/var.h"
+
+namespace ppapi {
+
+class PPAPI_SHARED_EXPORT ArrayVar : public Var {
+ public:
+  typedef std::vector<ScopedPPVar> ElementVector;
+
+  ArrayVar();
+
+  // Helper function that converts a PP_Var to an ArrayVar. This will return
+  // NULL if the PP_Var is not of type PP_VARTYPE_ARRAY or the array cannot be
+  // found from the var tracker.
+  static ArrayVar* FromPPVar(const PP_Var& var);
+
+  // Var overrides.
+  virtual ArrayVar* AsArrayVar() OVERRIDE;
+  virtual PP_VarType GetType() const OVERRIDE;
+
+  // The returned PP_Var has had a ref added on behalf of the caller.
+  PP_Var Get(uint32_t index) const;
+  PP_Bool Set(uint32_t index, const PP_Var& value);
+  uint32_t GetLength() const;
+  PP_Bool SetLength(uint32_t length);
+
+  const ElementVector& elements() const {
+    return elements_;
+  }
+
+  ElementVector& elements() {
+    return elements_;
+  }
+
+ protected:
+  virtual ~ArrayVar();
+
+ private:
+  ElementVector elements_;
+
+  DISALLOW_COPY_AND_ASSIGN(ArrayVar);
+};
+
+}  // namespace ppapi
+
+#endif  // PPAPI_SHARED_IMPL_ARRAY_VAR_H_
diff --git a/ppapi/shared_impl/array_writer.cc b/ppapi/shared_impl/array_writer.cc
index 957ff77..26ee1bd 100644
--- a/ppapi/shared_impl/array_writer.cc
+++ b/ppapi/shared_impl/array_writer.cc
@@ -9,6 +9,8 @@
 #include "ppapi/shared_impl/ppapi_globals.h"
 #include "ppapi/shared_impl/resource.h"
 #include "ppapi/shared_impl/resource_tracker.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/shared_impl/var_tracker.h"
 
 namespace ppapi {
 
@@ -76,4 +78,52 @@
   return true;
 }
 
+bool ArrayWriter::StoreVarVector(
+    const std::vector< scoped_refptr<Var> >& input) {
+  // Always call the alloc function, even on 0 array size.
+  void* dest = pp_array_output_.GetDataBuffer(
+      pp_array_output_.user_data,
+      static_cast<uint32_t>(input.size()),
+      sizeof(PP_Var));
+
+  // Regardless of success, we clear the output to prevent future calls on
+  // this same output object.
+  Reset();
+
+  if (input.empty())
+    return true;  // Allow plugin to return NULL on 0 elements.
+  if (!dest)
+    return false;
+
+  // Convert to PP_Vars.
+  PP_Var* dest_vars = static_cast<PP_Var*>(dest);
+  for (size_t i = 0; i < input.size(); i++)
+    dest_vars[i] = input[i]->GetPPVar();
+  return true;
+}
+
+bool ArrayWriter::StoreVarVector(const std::vector<PP_Var>& input) {
+  // Always call the alloc function, even on 0 array size.
+  void* dest = pp_array_output_.GetDataBuffer(
+      pp_array_output_.user_data,
+      static_cast<uint32_t>(input.size()),
+      sizeof(PP_Var));
+
+  // Regardless of success, we clear the output to prevent future calls on
+  // this same output object.
+  Reset();
+
+  if (input.empty())
+    return true;  // Allow plugin to return NULL on 0 elements.
+  if (!dest) {
+    // Free the vars.
+    for (size_t i = 0; i < input.size(); i++)
+      PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(input[i]);
+    return false;
+  }
+
+  std::copy(input.begin(), input.end(), static_cast<PP_Var*>(dest));
+  return true;
+}
+
 }  // namespace ppapi
diff --git a/ppapi/shared_impl/array_writer.h b/ppapi/shared_impl/array_writer.h
index cabd0af..7e6c349 100644
--- a/ppapi/shared_impl/array_writer.h
+++ b/ppapi/shared_impl/array_writer.h
@@ -18,6 +18,7 @@
 namespace ppapi {
 
 class Resource;
+class Var;
 
 // Holds a PP_ArrayWriter and provides helper functions for writing arrays
 // to it. It also handles 0-initialization of the raw C struct and attempts
@@ -38,7 +39,8 @@
   // Sets the array output back to its is_null() state.
   void Reset();
 
-  // Copies the given vector of data to the plugin output array.
+  // StoreArray() and StoreVector() copy the given array/vector of data to the
+  // plugin output array.
   //
   // Returns true on success, false if the plugin reported allocation failure.
   // In either case, the object will become is_null() immediately after the
@@ -48,27 +50,35 @@
   // want to transfer a reference only on success. Likewise, if you have a
   // structure of PP_Vars or a struct that contains a PP_Resource, we need to
   // make sure that the right thing happens with the ref on success and failure.
-  template<typename T>
-  bool StoreVector(const std::vector<T>& input) {
+  template <typename T>
+  bool StoreArray(const T* input, uint32_t count) {
     // Always call the alloc function, even on 0 array size.
     void* dest = pp_array_output_.GetDataBuffer(
         pp_array_output_.user_data,
-        static_cast<uint32_t>(input.size()),
+        count,
         sizeof(T));
 
     // Regardless of success, we clear the output to prevent future calls on
     // this same output object.
     Reset();
 
-    if (input.empty())
+    if (count == 0)
       return true;  // Allow plugin to return NULL on 0 elements.
     if (!dest)
       return false;
 
-    memcpy(dest, &input[0], sizeof(T) * input.size());
+    if (input)
+      memcpy(dest, input, sizeof(T) * count);
     return true;
   }
 
+  // Copies the given array/vector of data to the plugin output array.  See
+  // comment of StoreArray() for detail.
+  template<typename T>
+  bool StoreVector(const std::vector<T>& input) {
+    return StoreArray(input.size() ? &input[0] : NULL, input.size());
+  }
+
   // Stores the given vector of resources as PP_Resources to the output vector,
   // adding one reference to each.
   //
@@ -80,13 +90,25 @@
   // Note: potentially this could be a template in case you have a vector of
   // FileRef objects, for example. However, this saves code since there's only
   // one instantiation and is sufficient for now.
-  bool StoreResourceVector(
-      const std::vector< scoped_refptr<Resource> >& input);
+  bool StoreResourceVector(const std::vector< scoped_refptr<Resource> >& input);
 
-  // Like the above version but takes an array of AddRed'ed PP_Resources. On
+  // Like the above version but takes an array of AddRef'ed PP_Resources. On
   // storage failure, this will release each resource.
   bool StoreResourceVector(const std::vector<PP_Resource>& input);
 
+  // Stores the given vector of vars as PP_Vars to the output vector,
+  // adding one reference to each.
+  //
+  // On failure this returns false, nothing will be copied, and the var
+  // refcounts will be unchanged. In either case, the object will become
+  // is_null() immediately after the call since one output function should only
+  // be issued once.
+  bool StoreVarVector(const std::vector< scoped_refptr<Var> >& input);
+
+  // Like the above version but takes an array of AddRef'ed PP_Vars. On
+  // storage failure, this will release each var.
+  bool StoreVarVector(const std::vector<PP_Var>& input);
+
  private:
   PP_ArrayOutput pp_array_output_;
 
diff --git a/ppapi/shared_impl/dictionary_var.cc b/ppapi/shared_impl/dictionary_var.cc
new file mode 100644
index 0000000..f7af7d9
--- /dev/null
+++ b/ppapi/shared_impl/dictionary_var.cc
@@ -0,0 +1,110 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/shared_impl/dictionary_var.h"
+
+#include "base/memory/ref_counted.h"
+#include "base/string_util.h"
+#include "ppapi/shared_impl/array_var.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/var_tracker.h"
+
+namespace ppapi {
+
+DictionaryVar::DictionaryVar() {
+}
+
+DictionaryVar::~DictionaryVar() {
+}
+
+// static
+DictionaryVar* DictionaryVar::FromPPVar(const PP_Var& var) {
+  if (var.type != PP_VARTYPE_DICTIONARY)
+    return NULL;
+
+  scoped_refptr<Var> var_object(
+      PpapiGlobals::Get()->GetVarTracker()->GetVar(var));
+  if (!var_object.get())
+    return NULL;
+  return var_object->AsDictionaryVar();
+}
+
+DictionaryVar* DictionaryVar::AsDictionaryVar() {
+  return this;
+}
+
+PP_VarType DictionaryVar::GetType() const {
+  return PP_VARTYPE_DICTIONARY;
+}
+
+PP_Var DictionaryVar::Get(const PP_Var& key) const {
+  StringVar* string_var = StringVar::FromPPVar(key);
+  if (!string_var)
+    return PP_MakeUndefined();
+
+  KeyValueMap::const_iterator iter = key_value_map_.find(string_var->value());
+  if (iter != key_value_map_.end()) {
+    if (PpapiGlobals::Get()->GetVarTracker()->AddRefVar(iter->second.get()))
+      return iter->second.get();
+    else
+      return PP_MakeUndefined();
+  } else {
+    return PP_MakeUndefined();
+  }
+}
+
+PP_Bool DictionaryVar::Set(const PP_Var& key, const PP_Var& value) {
+  StringVar* string_var = StringVar::FromPPVar(key);
+  if (!string_var)
+    return PP_FALSE;
+
+  key_value_map_[string_var->value()] = value;
+  return PP_TRUE;
+}
+
+void DictionaryVar::Delete(const PP_Var& key) {
+  StringVar* string_var = StringVar::FromPPVar(key);
+  if (!string_var)
+    return;
+
+  key_value_map_.erase(string_var->value());
+}
+
+PP_Bool DictionaryVar::HasKey(const PP_Var& key) const {
+  StringVar* string_var = StringVar::FromPPVar(key);
+  if (!string_var)
+    return PP_FALSE;
+
+  bool result =
+      key_value_map_.find(string_var->value()) != key_value_map_.end();
+  return PP_FromBool(result);
+}
+
+PP_Var DictionaryVar::GetKeys() const {
+  scoped_refptr<ArrayVar> array_var(new ArrayVar());
+  array_var->elements().reserve(key_value_map_.size());
+
+  for (KeyValueMap::const_iterator iter = key_value_map_.begin();
+       iter != key_value_map_.end(); ++iter) {
+    array_var->elements().push_back(
+        ScopedPPVar(ScopedPPVar::PassRef(),
+                    StringVar::StringToPPVar(iter->first)));
+  }
+  return array_var->GetPPVar();
+}
+
+bool DictionaryVar::SetWithStringKey(const std::string& utf8_key,
+                                     const PP_Var& value) {
+  if (!IsStringUTF8(utf8_key))
+    return false;
+
+  key_value_map_[utf8_key] = value;
+  return true;
+}
+
+void DictionaryVar::DeleteWithStringKey(const std::string& utf8_key) {
+  key_value_map_.erase(utf8_key);
+}
+
+}  // namespace ppapi
diff --git a/ppapi/shared_impl/dictionary_var.h b/ppapi/shared_impl/dictionary_var.h
new file mode 100644
index 0000000..cdc63bd
--- /dev/null
+++ b/ppapi/shared_impl/dictionary_var.h
@@ -0,0 +1,63 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_SHARED_IMPL_DICTIONARY_VAR_H_
+#define PPAPI_SHARED_IMPL_DICTIONARY_VAR_H_
+
+#include <map>
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/ppapi_shared_export.h"
+#include "ppapi/shared_impl/scoped_pp_var.h"
+#include "ppapi/shared_impl/var.h"
+
+namespace ppapi {
+
+class PPAPI_SHARED_EXPORT DictionaryVar : public Var {
+ public:
+  typedef std::map<std::string, ScopedPPVar> KeyValueMap;
+
+  DictionaryVar();
+
+  // Helper function that converts a PP_Var to a DictionaryVar. This will
+  // return NULL if the PP_Var is not of type PP_VARTYPE_DICTIONARY or the
+  // dictionary cannot be found from the var tracker.
+  static DictionaryVar* FromPPVar(const PP_Var& var);
+
+  // Var overrides.
+  virtual DictionaryVar* AsDictionaryVar() OVERRIDE;
+  virtual PP_VarType GetType() const OVERRIDE;
+
+  // The returned PP_Var has had a ref added on behalf of the caller.
+  PP_Var Get(const PP_Var& key) const;
+  PP_Bool Set(const PP_Var& key, const PP_Var& value);
+  void Delete(const PP_Var& key);
+  PP_Bool HasKey(const PP_Var& key) const;
+  // The returned PP_Var has had a ref added on behalf of the caller.
+  PP_Var GetKeys() const;
+
+  // Returns false and keeps the dictionary unchanged if |key| is not a valid
+  // UTF-8 string.
+  bool SetWithStringKey(const std::string& utf8_key, const PP_Var& value);
+  void DeleteWithStringKey(const std::string& utf8_key);
+
+  const KeyValueMap& key_value_map() const {
+    return key_value_map_;
+  }
+
+ protected:
+  virtual ~DictionaryVar();
+
+ private:
+  KeyValueMap key_value_map_;
+
+  DISALLOW_COPY_AND_ASSIGN(DictionaryVar);
+};
+
+}  // namespace ppapi
+
+#endif  // PPAPI_SHARED_IMPL_DICTIONARY_VAR_H_
diff --git a/ppapi/shared_impl/dir_contents.h b/ppapi/shared_impl/dir_contents.h
index 98c29f3..4d895b5 100644
--- a/ppapi/shared_impl/dir_contents.h
+++ b/ppapi/shared_impl/dir_contents.h
@@ -8,12 +8,12 @@
 
 #include <vector>
 
-#include "base/file_path.h"
+#include "base/files/file_path.h"
 
 namespace ppapi {
 
 struct DirEntry {
-  FilePath name;
+  base::FilePath name;
   bool is_dir;
 };
 
diff --git a/ppapi/shared_impl/file_io_state_manager.cc b/ppapi/shared_impl/file_io_state_manager.cc
new file mode 100644
index 0000000..9c9b6ea
--- /dev/null
+++ b/ppapi/shared_impl/file_io_state_manager.cc
@@ -0,0 +1,56 @@
+// 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 "ppapi/shared_impl/file_io_state_manager.h"
+
+#include "base/logging.h"
+#include "ppapi/c/pp_errors.h"
+
+namespace ppapi {
+
+FileIOStateManager::FileIOStateManager()
+    : num_pending_ops_(0),
+      pending_op_(OPERATION_NONE),
+      file_open_(false) {
+}
+
+FileIOStateManager::~FileIOStateManager() {
+}
+
+void FileIOStateManager::SetOpenSucceed() {
+  file_open_ = true;
+}
+
+int32_t FileIOStateManager::CheckOperationState(OperationType new_op,
+                                                bool should_be_open) {
+  if (should_be_open) {
+    if (!file_open_)
+      return PP_ERROR_FAILED;
+  } else {
+    if (file_open_)
+      return PP_ERROR_FAILED;
+  }
+
+  if (pending_op_ != OPERATION_NONE &&
+      (pending_op_ != new_op || pending_op_ == OPERATION_EXCLUSIVE))
+    return PP_ERROR_INPROGRESS;
+
+  return PP_OK;
+}
+
+void FileIOStateManager::SetPendingOperation(OperationType new_op) {
+  DCHECK(pending_op_ == OPERATION_NONE ||
+         (pending_op_ != OPERATION_EXCLUSIVE && pending_op_ == new_op));
+  pending_op_ = new_op;
+  num_pending_ops_++;
+}
+
+void FileIOStateManager::SetOperationFinished() {
+  DCHECK_GT(num_pending_ops_, 0);
+  if (--num_pending_ops_ == 0)
+    pending_op_ = OPERATION_NONE;
+}
+
+}  // namespace ppapi
+
diff --git a/ppapi/shared_impl/file_io_state_manager.h b/ppapi/shared_impl/file_io_state_manager.h
new file mode 100644
index 0000000..7b5f926
--- /dev/null
+++ b/ppapi/shared_impl/file_io_state_manager.h
@@ -0,0 +1,69 @@
+// 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 PPAPI_SHARED_IMPL_FILE_IO_STATE_MANAGER_H_
+#define PPAPI_SHARED_IMPL_FILE_IO_STATE_MANAGER_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/shared_impl/ppapi_shared_export.h"
+
+namespace ppapi {
+
+// FileIOStateManager is a helper class that maintains the state of operations.
+// For example, some operations are mutually exclusive, meaning that an
+// operation could be rejected because of the current pending operation. Also,
+// most of the operations only work when the file has been opened.
+class PPAPI_SHARED_EXPORT FileIOStateManager {
+ public:
+  FileIOStateManager();
+  ~FileIOStateManager();
+
+  enum OperationType {
+    // There is no pending operation right now.
+    OPERATION_NONE,
+
+    // If there are pending reads, any other kind of async operation is not
+    // allowed.
+    OPERATION_READ,
+
+    // If there are pending writes, any other kind of async operation is not
+    // allowed.
+    OPERATION_WRITE,
+
+    // If there is a pending operation that is neither read nor write, no
+    // further async operation is allowed.
+    OPERATION_EXCLUSIVE
+  };
+
+  OperationType get_pending_operation() const { return pending_op_; }
+
+  void SetOpenSucceed();
+
+  // Called at the beginning of each operation. It is responsible to make sure
+  // that state is correct. For example, some operations are only valid after
+  // the file is opened, or operations might need to run exclusively.
+  //
+  // It returns |PP_OK| on success, or |PP_ERROR_...| for various reasons.
+  int32_t CheckOperationState(OperationType new_op, bool should_be_open);
+
+  // Marks the state of current operations as started or finished.
+  void SetPendingOperation(OperationType op);
+  void SetOperationFinished();
+
+ private:
+  int num_pending_ops_;
+  OperationType pending_op_;
+
+  // Set to true when the file has been successfully opened.
+  bool file_open_;
+
+  DISALLOW_COPY_AND_ASSIGN(FileIOStateManager);
+};
+
+}  // namespace ppapi
+
+#endif  // PPAPI_SHARED_IMPL_FILE_IO_STATE_MANAGER_H_
+
diff --git a/ppapi/shared_impl/file_path.cc b/ppapi/shared_impl/file_path.cc
index 1208b08..d05b1b3 100644
--- a/ppapi/shared_impl/file_path.cc
+++ b/ppapi/shared_impl/file_path.cc
@@ -4,48 +4,17 @@
 
 #include "ppapi/shared_impl/file_path.h"
 
-#include <string>
-
-#if defined(OS_WIN)
-#include "base/utf_string_conversions.h"
-#endif
-
 namespace ppapi {
 
-namespace {
-
-FilePath GetFilePathFromUTF8(const std::string& utf8_path) {
-#if defined(OS_WIN)
-  return FilePath(UTF8ToUTF16(utf8_path));
-#else
-  return FilePath(utf8_path);
-#endif
-}
-
-}  // namespace
-
 PepperFilePath::PepperFilePath()
     : domain_(DOMAIN_INVALID),
       path_() {
 }
 
-PepperFilePath::PepperFilePath(Domain domain, const FilePath& path)
+PepperFilePath::PepperFilePath(Domain domain, const base::FilePath& path)
     : domain_(domain),
       path_(path) {
   // TODO(viettrungluu): Should we DCHECK() some things here?
 }
 
-// static
-PepperFilePath PepperFilePath::MakeAbsolute(const FilePath& path) {
-  return PepperFilePath(DOMAIN_ABSOLUTE, path);
-}
-
-// static
-PepperFilePath PepperFilePath::MakeModuleLocal(const std::string& name,
-                                               const char* utf8_path) {
-  FilePath full_path = GetFilePathFromUTF8(name).Append(
-      GetFilePathFromUTF8(utf8_path));
-  return PepperFilePath(DOMAIN_MODULE_LOCAL, full_path);
-}
-
 }  // namespace ppapi
diff --git a/ppapi/shared_impl/file_path.h b/ppapi/shared_impl/file_path.h
index bcec9f8..7027e81 100644
--- a/ppapi/shared_impl/file_path.h
+++ b/ppapi/shared_impl/file_path.h
@@ -5,9 +5,7 @@
 #ifndef PPAPI_SHARED_IMPL_FILE_PATH_H_
 #define PPAPI_SHARED_IMPL_FILE_PATH_H_
 
-#include <string>
-
-#include "base/file_path.h"
+#include "base/files/file_path.h"
 #include "ppapi/shared_impl/ppapi_shared_export.h"
 
 namespace ppapi {
@@ -28,18 +26,14 @@
   };
 
   PepperFilePath();
-  PepperFilePath(Domain d, const FilePath& p);
-
-  static PepperFilePath MakeAbsolute(const FilePath& path);
-  static PepperFilePath MakeModuleLocal(const std::string& name,
-                                        const char* utf8_path);
+  PepperFilePath(Domain d, const base::FilePath& p);
 
   Domain domain() const { return domain_; }
-  const FilePath& path() const { return path_; }
+  const base::FilePath& path() const { return path_; }
 
  private:
   Domain domain_;
-  FilePath path_;
+  base::FilePath path_;
 };
 
 }  // namespace ppapi
diff --git a/ppapi/shared_impl/file_type_conversion.cc b/ppapi/shared_impl/file_type_conversion.cc
index a9bd435..5185daa 100644
--- a/ppapi/shared_impl/file_type_conversion.cc
+++ b/ppapi/shared_impl/file_type_conversion.cc
@@ -26,6 +26,8 @@
       return PP_ERROR_NOSPACE;
     case base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY:
       return PP_ERROR_FAILED;
+    case base::PLATFORM_FILE_ERROR_NOT_A_FILE:
+      return PP_ERROR_NOTAFILE;
     default:
       return PP_ERROR_FAILED;
   }
diff --git a/ppapi/shared_impl/host_resource.h b/ppapi/shared_impl/host_resource.h
index c98d2d6..3645edc 100644
--- a/ppapi/shared_impl/host_resource.h
+++ b/ppapi/shared_impl/host_resource.h
@@ -15,7 +15,10 @@
 // The point is to prevent mistakes where the wrong resource value is sent.
 // Resource values are remapped in the plugin so that it can talk to multiple
 // hosts. If all values were PP_Resource, it would be easy to forget to do
-// this tranformation.
+// this transformation.
+//
+// To get the corresponding plugin PP_Resource for a HostResource, use
+// PluginResourceTracker::PluginResourceForHostResource().
 //
 // All HostResources respresent IDs valid in the host.
 class PPAPI_SHARED_EXPORT HostResource {
diff --git a/ppapi/shared_impl/ppapi_globals.cc b/ppapi/shared_impl/ppapi_globals.cc
index 270d7e8..be10d4c 100644
--- a/ppapi/shared_impl/ppapi_globals.cc
+++ b/ppapi/shared_impl/ppapi_globals.cc
@@ -26,7 +26,7 @@
   main_loop_proxy_ = base::MessageLoopProxy::current();
 }
 
-PpapiGlobals::PpapiGlobals(ForTest) {
+PpapiGlobals::PpapiGlobals(PerThreadForTest) {
   DCHECK(!ppapi_globals_);
   main_loop_proxy_ = base::MessageLoopProxy::current();
 }
diff --git a/ppapi/shared_impl/ppapi_globals.h b/ppapi/shared_impl/ppapi_globals.h
index b03d35c..84b90e7 100644
--- a/ppapi/shared_impl/ppapi_globals.h
+++ b/ppapi/shared_impl/ppapi_globals.h
@@ -10,9 +10,9 @@
 #include "base/basictypes.h"
 #include "base/memory/ref_counted.h"
 #include "base/threading/thread_local.h"  // For testing purposes only.
-#include "ppapi/c/dev/ppb_console_dev.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_module.h"
+#include "ppapi/c/ppb_console.h"
 #include "ppapi/shared_impl/api_id.h"
 #include "ppapi/shared_impl/ppapi_shared_export.h"
 
@@ -43,8 +43,8 @@
   // purposes. This avoids setting the global static ppapi_globals_. For unit
   // tests that use this feature, the "test" PpapiGlobals should be constructed
   // using this method. See SetPpapiGlobalsOnThreadForTest for more information.
-  struct ForTest {};
-  explicit PpapiGlobals(ForTest);
+  struct PerThreadForTest {};
+  explicit PpapiGlobals(PerThreadForTest);
 
   virtual ~PpapiGlobals();
 
@@ -64,7 +64,7 @@
   // the same process, e.g. for having 1 thread emulate the "host" and 1 thread
   // emulate the "plugin".
   //
-  // PpapiGlobals object must have been constructed using the "ForTest"
+  // PpapiGlobals object must have been constructed using the "PerThreadForTest"
   // parameter.
   static void SetPpapiGlobalsOnThreadForTest(PpapiGlobals* ptr);
 
@@ -79,7 +79,7 @@
   // Logs the given string to the JS console. If "source" is empty, the name of
   // the current module will be used, if it can be determined.
   virtual void LogWithSource(PP_Instance instance,
-                             PP_LogLevel_Dev level,
+                             PP_LogLevel level,
                              const std::string& source,
                              const std::string& value) = 0;
 
@@ -92,7 +92,7 @@
   // Note that in the plugin process, the module parameter is ignored since
   // there is only one possible one.
   virtual void BroadcastLogWithSource(PP_Module module,
-                                      PP_LogLevel_Dev level,
+                                      PP_LogLevel level,
                                       const std::string& source,
                                       const std::string& value) = 0;
 
diff --git a/ppapi/shared_impl/ppapi_preferences.cc b/ppapi/shared_impl/ppapi_preferences.cc
index c7bb0cb..a3ac413 100644
--- a/ppapi/shared_impl/ppapi_preferences.cc
+++ b/ppapi/shared_impl/ppapi_preferences.cc
@@ -11,7 +11,8 @@
       default_fixed_font_size(0),
       number_of_cpu_cores(0),
       is_3d_supported(true),
-      is_stage3d_supported(false) {
+      is_stage3d_supported(false),
+      is_stage3d_baseline_supported(false) {
 }
 
 Preferences::Preferences(const webkit_glue::WebPreferences& prefs)
@@ -24,10 +25,12 @@
       number_of_cpu_cores(prefs.number_of_cpu_cores),
       is_3d_supported(prefs.flash_3d_enabled),
       is_stage3d_supported(prefs.flash_stage3d_enabled),
+      is_stage3d_baseline_supported(prefs.flash_stage3d_baseline_enabled),
       // This determines both if webgl is supported (experimental_webgl_enabled)
-      // and if it runs in hardware (accelerated_plugins_enabled)
+      // and if it runs in hardware
+      // (accelerated_compositing_for_plugins_enabled)
       is_webgl_supported(prefs.experimental_webgl_enabled &&
-                         prefs.accelerated_plugins_enabled) {
+                         prefs.accelerated_compositing_for_plugins_enabled) {
 }
 
 Preferences::~Preferences() {
diff --git a/ppapi/shared_impl/ppapi_preferences.h b/ppapi/shared_impl/ppapi_preferences.h
index b098f55..dad7c0c 100644
--- a/ppapi/shared_impl/ppapi_preferences.h
+++ b/ppapi/shared_impl/ppapi_preferences.h
@@ -29,6 +29,7 @@
   int number_of_cpu_cores;
   bool is_3d_supported;
   bool is_stage3d_supported;
+  bool is_stage3d_baseline_supported;
   bool is_webgl_supported;
 };
 
diff --git a/ppapi/shared_impl/ppb_device_ref_shared.h b/ppapi/shared_impl/ppb_device_ref_shared.h
index 895baa5..9ea367e 100644
--- a/ppapi/shared_impl/ppb_device_ref_shared.h
+++ b/ppapi/shared_impl/ppb_device_ref_shared.h
@@ -21,6 +21,12 @@
 struct PPAPI_SHARED_EXPORT DeviceRefData {
   DeviceRefData();
 
+  bool operator==(const DeviceRefData& other) const {
+    return type == other.type &&
+           name == other.name &&
+           id == other.id;
+  }
+
   PP_DeviceType_Dev type;
   std::string name;
   std::string id;
diff --git a/ppapi/shared_impl/ppb_file_io_shared.cc b/ppapi/shared_impl/ppb_file_io_shared.cc
deleted file mode 100644
index b60e174..0000000
--- a/ppapi/shared_impl/ppb_file_io_shared.cc
+++ /dev/null
@@ -1,219 +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 "ppapi/shared_impl/ppb_file_io_shared.h"
-
-#include <string.h>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/message_loop.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/shared_impl/file_type_conversion.h"
-#include "ppapi/shared_impl/time_conversion.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_file_ref_api.h"
-
-namespace ppapi {
-
-using thunk::EnterResourceNoLock;
-using thunk::PPB_FileIO_API;
-using thunk::PPB_FileRef_API;
-
-PPB_FileIO_Shared::CallbackEntry::CallbackEntry()
-    : read_buffer(NULL),
-      info(NULL) {
-}
-
-PPB_FileIO_Shared::CallbackEntry::CallbackEntry(const CallbackEntry& entry)
-    : callback(entry.callback),
-      read_buffer(entry.read_buffer),
-      info(entry.info) {
-}
-
-PPB_FileIO_Shared::CallbackEntry::~CallbackEntry() {
-}
-
-PPB_FileIO_Shared::PPB_FileIO_Shared(PP_Instance instance)
-    : Resource(OBJECT_IS_IMPL, instance),
-      file_system_type_(PP_FILESYSTEMTYPE_INVALID),
-      file_open_(false),
-      pending_op_(OPERATION_NONE) {
-}
-
-PPB_FileIO_Shared::PPB_FileIO_Shared(const HostResource& host_resource)
-    : Resource(OBJECT_IS_PROXY, host_resource),
-      file_system_type_(PP_FILESYSTEMTYPE_INVALID),
-      file_open_(false),
-      pending_op_(OPERATION_NONE) {
-}
-
-PPB_FileIO_Shared::~PPB_FileIO_Shared() {
-}
-
-thunk::PPB_FileIO_API* PPB_FileIO_Shared::AsPPB_FileIO_API() {
-  return this;
-}
-
-int32_t PPB_FileIO_Shared::Open(PP_Resource file_ref,
-                                int32_t open_flags,
-                                scoped_refptr<TrackedCallback> callback) {
-  EnterResourceNoLock<PPB_FileRef_API> enter(file_ref, true);
-  if (enter.failed())
-    return PP_ERROR_BADRESOURCE;
-
-  int32_t rv = CommonCallValidation(false, OPERATION_EXCLUSIVE);
-  if (rv != PP_OK)
-    return rv;
-
-  PP_FileSystemType type = enter.object()->GetFileSystemType();
-  if (type != PP_FILESYSTEMTYPE_LOCALPERSISTENT &&
-      type != PP_FILESYSTEMTYPE_LOCALTEMPORARY &&
-      type != PP_FILESYSTEMTYPE_EXTERNAL)
-    return PP_ERROR_FAILED;
-  file_system_type_ = type;
-
-  return OpenValidated(file_ref, enter.object(), open_flags, callback);
-}
-
-int32_t PPB_FileIO_Shared::Query(PP_FileInfo* info,
-                                 scoped_refptr<TrackedCallback> callback) {
-  int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE);
-  if (rv != PP_OK)
-    return rv;
-  if (!info)
-    return PP_ERROR_BADARGUMENT;
-  return QueryValidated(info, callback);
-}
-
-int32_t PPB_FileIO_Shared::Touch(PP_Time last_access_time,
-                                 PP_Time last_modified_time,
-                                 scoped_refptr<TrackedCallback> callback) {
-  int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE);
-  if (rv != PP_OK)
-    return rv;
-  return TouchValidated(last_access_time, last_modified_time, callback);
-}
-
-int32_t PPB_FileIO_Shared::Read(int64_t offset,
-                                char* buffer,
-                                int32_t bytes_to_read,
-                                scoped_refptr<TrackedCallback> callback) {
-  int32_t rv = CommonCallValidation(true, OPERATION_READ);
-  if (rv != PP_OK)
-    return rv;
-  return ReadValidated(offset, buffer, bytes_to_read, callback);
-}
-
-int32_t PPB_FileIO_Shared::Write(int64_t offset,
-                                 const char* buffer,
-                                 int32_t bytes_to_write,
-                                 scoped_refptr<TrackedCallback> callback) {
-  int32_t rv = CommonCallValidation(true, OPERATION_WRITE);
-  if (rv != PP_OK)
-    return rv;
-  return WriteValidated(offset, buffer, bytes_to_write, callback);
-}
-
-int32_t PPB_FileIO_Shared::SetLength(int64_t length,
-                                     scoped_refptr<TrackedCallback> callback) {
-  int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE);
-  if (rv != PP_OK)
-    return rv;
-  return SetLengthValidated(length, callback);
-}
-
-int32_t PPB_FileIO_Shared::Flush(scoped_refptr<TrackedCallback> callback) {
-  int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE);
-  if (rv != PP_OK)
-    return rv;
-  return FlushValidated(callback);
-}
-
-void PPB_FileIO_Shared::ExecuteGeneralCallback(int32_t pp_error) {
-  RunAndRemoveFirstPendingCallback(pp_error);
-}
-
-void PPB_FileIO_Shared::ExecuteOpenFileCallback(int32_t pp_error) {
-  if (pp_error == PP_OK)
-    file_open_ = true;
-  ExecuteGeneralCallback(pp_error);
-}
-
-void PPB_FileIO_Shared::ExecuteQueryCallback(int32_t pp_error,
-                                             const PP_FileInfo& info) {
-  if (pending_op_ != OPERATION_EXCLUSIVE || callbacks_.empty() ||
-      !callbacks_.front().info) {
-    NOTREACHED();
-    return;
-  }
-  *callbacks_.front().info = info;
-  RunAndRemoveFirstPendingCallback(pp_error);
-}
-
-void PPB_FileIO_Shared::ExecuteReadCallback(int32_t pp_error,
-                                            const char* data) {
-  if (pending_op_ != OPERATION_READ || callbacks_.empty()) {
-    NOTREACHED();
-    return;
-  }
-
-  // The result code contains the number of bytes if it's positive.
-  if (pp_error > 0) {
-    char* read_buffer = callbacks_.front().read_buffer;
-    DCHECK(data);
-    DCHECK(read_buffer);
-    memcpy(read_buffer, data, pp_error);
-  }
-  RunAndRemoveFirstPendingCallback(pp_error);
-}
-
-int32_t PPB_FileIO_Shared::CommonCallValidation(bool should_be_open,
-                                                OperationType new_op) {
-  // Only asynchronous operation is supported.
-  if (should_be_open) {
-    if (!file_open_)
-      return PP_ERROR_FAILED;
-  } else {
-    if (file_open_)
-      return PP_ERROR_FAILED;
-  }
-
-  if (pending_op_ != OPERATION_NONE &&
-      (pending_op_ != new_op || pending_op_ == OPERATION_EXCLUSIVE)) {
-    return PP_ERROR_INPROGRESS;
-  }
-
-  return PP_OK;
-}
-
-void PPB_FileIO_Shared::RegisterCallback(
-    OperationType op,
-    scoped_refptr<TrackedCallback> callback,
-    char* read_buffer,
-    PP_FileInfo* info) {
-  DCHECK(pending_op_ == OPERATION_NONE ||
-         (pending_op_ != OPERATION_EXCLUSIVE && pending_op_ == op));
-
-  CallbackEntry entry;
-  entry.callback = callback;
-  entry.read_buffer = read_buffer;
-  entry.info = info;
-  callbacks_.push_back(entry);
-
-  pending_op_ = op;
-}
-
-void PPB_FileIO_Shared::RunAndRemoveFirstPendingCallback(int32_t result) {
-  DCHECK(!callbacks_.empty());
-
-  CallbackEntry front = callbacks_.front();
-  callbacks_.pop_front();
-  if (callbacks_.empty())
-    pending_op_ = OPERATION_NONE;
-
-  front.callback->Run(result);
-}
-
-}  // namespace ppapi
diff --git a/ppapi/shared_impl/ppb_file_io_shared.h b/ppapi/shared_impl/ppb_file_io_shared.h
deleted file mode 100644
index a062497..0000000
--- a/ppapi/shared_impl/ppb_file_io_shared.h
+++ /dev/null
@@ -1,156 +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 PPAPI_SHARED_IMPL_PPB_FILE_IO_SHARED_H_
-#define PPAPI_SHARED_IMPL_PPB_FILE_IO_SHARED_H_
-
-#include <deque>
-
-#include "base/compiler_specific.h"
-#include "ppapi/shared_impl/ppapi_shared_export.h"
-#include "ppapi/shared_impl/resource.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/thunk/ppb_file_io_api.h"
-
-namespace ppapi {
-
-namespace thunk {
-class PPB_FileRef_API;
-}
-
-class PPAPI_SHARED_EXPORT PPB_FileIO_Shared : public Resource,
-                                              public thunk::PPB_FileIO_API {
- public:
-  PPB_FileIO_Shared(PP_Instance instance);
-  PPB_FileIO_Shared(const HostResource& host_resource);
-  ~PPB_FileIO_Shared();
-
-  // Resource overrides.
-  virtual thunk::PPB_FileIO_API* AsPPB_FileIO_API() OVERRIDE;
-
-  // PPB_FileIO_API implementation.
-  virtual int32_t Open(PP_Resource file_ref,
-                       int32_t open_flags,
-                       scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t Query(PP_FileInfo* info,
-                        scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t Touch(PP_Time last_access_time,
-                        PP_Time last_modified_time,
-                        scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t Read(int64_t offset,
-                       char* buffer,
-                       int32_t bytes_to_read,
-                       scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t Write(int64_t offset,
-                        const char* buffer,
-                        int32_t bytes_to_write,
-                        scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t SetLength(int64_t length,
-                            scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) OVERRIDE;
-
-  // Callback handler for different types of operations.
-  void ExecuteGeneralCallback(int32_t pp_error);
-  void ExecuteOpenFileCallback(int32_t pp_error);
-  void ExecuteQueryCallback(int32_t pp_error, const PP_FileInfo& info);
-  void ExecuteReadCallback(int32_t pp_error, const char* data);
-
- protected:
-  struct CallbackEntry {
-    CallbackEntry();
-    CallbackEntry(const CallbackEntry& entry);
-    ~CallbackEntry();
-
-    scoped_refptr<TrackedCallback> callback;
-
-    // Pointer back to the caller's read buffer; only used by |Read()|, NULL
-    // for non-read operations. Not owned.
-    char* read_buffer;
-
-    // Pointer back to the caller's PP_FileInfo structure for Query operations.
-    // NULL for non-query operations. Not owned.
-    PP_FileInfo* info;
-  };
-
-  enum OperationType {
-    // There is no pending operation right now.
-    OPERATION_NONE,
-
-    // If there are pending reads, any other kind of async operation is not
-    // allowed.
-    OPERATION_READ,
-
-    // If there are pending writes, any other kind of async operation is not
-    // allowed.
-    OPERATION_WRITE,
-
-    // If there is a pending operation that is neither read nor write, no
-    // further async operation is allowed.
-    OPERATION_EXCLUSIVE
-  };
-
-  // Validated versions of the FileIO API. Subclasses in the proxy and impl
-  // implement these so the common error checking stays here.
-  virtual int32_t OpenValidated(PP_Resource file_ref_resource,
-                                thunk::PPB_FileRef_API* file_ref_api,
-                                int32_t open_flags,
-                                scoped_refptr<TrackedCallback> callback) = 0;
-  virtual int32_t QueryValidated(PP_FileInfo* info,
-                                 scoped_refptr<TrackedCallback> callback) = 0;
-  virtual int32_t TouchValidated(PP_Time last_access_time,
-                                 PP_Time last_modified_time,
-                                 scoped_refptr<TrackedCallback> callback) = 0;
-  virtual int32_t ReadValidated(int64_t offset,
-                                char* buffer,
-                                int32_t bytes_to_read,
-                                scoped_refptr<TrackedCallback> callback) = 0;
-  virtual int32_t WriteValidated(int64_t offset,
-                                 const char* buffer,
-                                 int32_t bytes_to_write,
-                                 scoped_refptr<TrackedCallback> callback) = 0;
-  virtual int32_t SetLengthValidated(
-      int64_t length,
-      scoped_refptr<TrackedCallback> callback) = 0;
-  virtual int32_t FlushValidated(scoped_refptr<TrackedCallback> callback) = 0;
-
-  // Called for every "Validated" function.
-  //
-  // This verifies that the callback is valid and that no callback is already
-  // pending, or it is a read(write) request and currently the pending
-  // operations are reads(writes).
-  //
-  // Returns |PP_OK| to indicate that everything is valid or |PP_ERROR_...| if
-  // the call should be aborted and that code returned to the plugin.
-  int32_t CommonCallValidation(bool should_be_open, OperationType new_op);
-
-  // Sets up a pending callback. This should only be called once it is certain
-  // that |PP_OK_COMPLETIONPENDING| will be returned.
-  //
-  // |read_buffer| is only used by read operations, |info| is used only by
-  // query operations.
-  void RegisterCallback(OperationType op,
-                        scoped_refptr<TrackedCallback> callback,
-                        char* read_buffer,
-                        PP_FileInfo* info);
-
-  // Pops the oldest callback from the queue and runs it.
-  void RunAndRemoveFirstPendingCallback(int32_t result);
-
-  // The file system type specified in the Open() call. This will be
-  // PP_FILESYSTEMTYPE_INVALID before open was called. This value does not
-  // indicate that the open command actually succeeded.
-  PP_FileSystemType file_system_type_;
-
-  // Set to true when the file has been successfully opened.
-  bool file_open_;
-
-  std::deque<CallbackEntry> callbacks_;
-  OperationType pending_op_;
-
-  DISALLOW_COPY_AND_ASSIGN(PPB_FileIO_Shared);
-};
-
-}  // namespace ppapi
-
-#endif  // PPAPI_SHARED_IMPL_PPB_FILE_IO_SHARED_H_
diff --git a/ppapi/shared_impl/ppb_flash_shared.cc b/ppapi/shared_impl/ppb_flash_shared.cc
deleted file mode 100644
index c310e0e..0000000
--- a/ppapi/shared_impl/ppb_flash_shared.cc
+++ /dev/null
@@ -1,23 +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 "ppapi/shared_impl/ppb_flash_shared.h"
-
-namespace ppapi {
-
-PPB_Flash_Shared::PPB_Flash_Shared() {
-}
-
-PPB_Flash_Shared::~PPB_Flash_Shared() {
-}
-
-void PPB_Flash_Shared::FreeDirContents(PP_Instance instance,
-                                       PP_DirContents_Dev* contents) {
-  for (int32_t i = 0; i < contents->count; ++i)
-    delete[] contents->entries[i].name;
-  delete[] contents->entries;
-  delete contents;
-}
-
-}  // namespace ppapi
diff --git a/ppapi/shared_impl/ppb_flash_shared.h b/ppapi/shared_impl/ppb_flash_shared.h
deleted file mode 100644
index 29f8973..0000000
--- a/ppapi/shared_impl/ppb_flash_shared.h
+++ /dev/null
@@ -1,30 +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 PPAPI_SHARED_IMPL_PPB_FLASH_SHARED_H_
-#define PPAPI_SHARED_IMPL_PPB_FLASH_SHARED_H_
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "ppapi/shared_impl/ppapi_shared_export.h"
-#include "ppapi/thunk/ppb_flash_api.h"
-
-namespace ppapi {
-
-class PPAPI_SHARED_EXPORT PPB_Flash_Shared : public thunk::PPB_Flash_API {
- public:
-  PPB_Flash_Shared();
-  virtual ~PPB_Flash_Shared();
-
-  // Shared implementation of PPB_Flash_API.
-  virtual void FreeDirContents(PP_Instance instance,
-                               PP_DirContents_Dev* contents) OVERRIDE;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(PPB_Flash_Shared);
-};
-
-}  // namespace ppapi
-
-#endif  // PPAPI_SHARED_IMPL_PPB_FLASH_SHARED_H_
diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.cc b/ppapi/shared_impl/ppb_graphics_3d_shared.cc
index 0278c42..e2d0154 100644
--- a/ppapi/shared_impl/ppb_graphics_3d_shared.cc
+++ b/ppapi/shared_impl/ppb_graphics_3d_shared.cc
@@ -60,6 +60,8 @@
     scoped_refptr<TrackedCallback> callback) {
   ScopedNoLocking already_locked(this);
   if (HasPendingSwap()) {
+    Log(PP_LOGLEVEL_ERROR, "PPB_Graphics3D.SwapBuffers: Plugin attempted swap "
+                           "with previous swap still pending.");
     // Already a pending SwapBuffers that hasn't returned yet.
     return PP_ERROR_INPROGRESS;
   }
diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.h b/ppapi/shared_impl/ppb_graphics_3d_shared.h
index b6185f8..96bc6bb 100644
--- a/ppapi/shared_impl/ppb_graphics_3d_shared.h
+++ b/ppapi/shared_impl/ppb_graphics_3d_shared.h
@@ -99,6 +99,10 @@
   virtual void PushAlreadyLocked();
   virtual void PopAlreadyLocked();
 
+  // The VideoDecoder needs to be able to call Graphics3D Flush() after taking
+  // the proxy lock. Hence it needs access to ScopedNoLocking.
+  friend class PPB_VideoDecoder_Shared;
+
   scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_;
   scoped_ptr<gpu::TransferBuffer> transfer_buffer_;
   scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_;
diff --git a/ppapi/shared_impl/ppb_instance_shared.cc b/ppapi/shared_impl/ppb_instance_shared.cc
index dd46bec..18033fc 100644
--- a/ppapi/shared_impl/ppb_instance_shared.cc
+++ b/ppapi/shared_impl/ppb_instance_shared.cc
@@ -6,6 +6,8 @@
 
 #include <string>
 
+#include "base/debug/trace_event.h"
+#include "base/threading/platform_thread.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/c/ppb_input_event.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
@@ -23,13 +25,13 @@
 }
 
 void PPB_Instance_Shared::Log(PP_Instance instance,
-                              PP_LogLevel_Dev level,
+                              PP_LogLevel level,
                               PP_Var value) {
   LogWithSource(instance, level, PP_MakeUndefined(), value);
 }
 
 void PPB_Instance_Shared::LogWithSource(PP_Instance instance,
-                                        PP_LogLevel_Dev level,
+                                        PP_LogLevel level,
                                         PP_Var source,
                                         PP_Var value) {
   // The source defaults to empty if it's not a string. The PpapiGlobals
diff --git a/ppapi/shared_impl/ppb_instance_shared.h b/ppapi/shared_impl/ppb_instance_shared.h
index a1845d3..61ca56d 100644
--- a/ppapi/shared_impl/ppb_instance_shared.h
+++ b/ppapi/shared_impl/ppb_instance_shared.h
@@ -19,10 +19,10 @@
 
   // Implementation of some shared PPB_Instance_FunctionAPI functions.
   virtual void Log(PP_Instance instance,
-                   PP_LogLevel_Dev log_level,
+                   PP_LogLevel log_level,
                    PP_Var value) OVERRIDE;
   virtual void LogWithSource(PP_Instance instance,
-                             PP_LogLevel_Dev log_level,
+                             PP_LogLevel log_level,
                              PP_Var source,
                              PP_Var value) OVERRIDE;
 
diff --git a/ppapi/shared_impl/ppb_trace_event_impl.cc b/ppapi/shared_impl/ppb_trace_event_impl.cc
new file mode 100644
index 0000000..439bbd4
--- /dev/null
+++ b/ppapi/shared_impl/ppb_trace_event_impl.cc
@@ -0,0 +1,74 @@
+// 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 "ppapi/shared_impl/ppb_trace_event_impl.h"
+
+#include "base/debug/trace_event.h"
+#include "ppapi/thunk/thunk.h"
+
+
+namespace ppapi {
+
+// PPB_Trace_Event_Dev is a shared implementation because Trace Events can be
+// sent from either the plugin process or renderer process depending on whether
+// the plugin is in- or out-of-process.  Also, for NaCl plugins these functions
+// will be executed from untrusted code and handled appropriately by tracing
+// functionality in the IRT.
+
+// static
+void* TraceEventImpl::GetCategoryEnabled(const char* category_name) {
+  // This casting is here because all mem_t return types in Pepper are void* and
+  // non-const.  All mem_t parameters are const void* so there is no way to
+  // return a pointer type to the caller without some const_cast.  The pointer
+  // type the tracing system works with is normally unsigned char*.
+  return const_cast<void*>(static_cast<const void*>(
+      base::debug::TraceLog::GetInstance()->GetCategoryEnabled(category_name)));
+}
+
+// static
+void TraceEventImpl::AddTraceEvent(int8_t phase,
+                                      const void* category_enabled,
+                                      const char* name,
+                                      uint64_t id,
+                                      uint32_t num_args,
+                                      const char* arg_names[],
+                                      const uint8_t arg_types[],
+                                      const uint64_t arg_values[],
+                                      uint8_t flags) {
+  base::debug::TraceLog::GetInstance()->AddTraceEvent(phase,
+      static_cast<const unsigned char*>(category_enabled), name, id, num_args,
+      arg_names, arg_types,
+      // This cast is necessary for LP64 systems, where uint64_t is defined as
+      // an unsigned long int, but trace_event internals are hermetic and
+      // accepts an |unsigned long long*|.  The pointer types are compatible but
+      // the compiler throws an error without an explicit cast.
+      reinterpret_cast<const unsigned long long*>(arg_values), flags);
+}
+
+// static
+void TraceEventImpl::SetThreadName(const char* thread_name) {
+  base::PlatformThread::SetName(thread_name);
+}
+
+namespace {
+
+const PPB_Trace_Event_Dev g_ppb_trace_event_thunk = {
+  &TraceEventImpl::GetCategoryEnabled,
+  &TraceEventImpl::AddTraceEvent,
+  &TraceEventImpl::SetThreadName,
+};
+
+}  // namespace ppapi
+
+}  // namespace
+
+namespace ppapi {
+namespace thunk {
+
+const PPB_Trace_Event_Dev_0_1* GetPPB_Trace_Event_Dev_0_1_Thunk() {
+  return &g_ppb_trace_event_thunk;
+}
+
+}  // namespace thunk
+}  // namespace ppapi
diff --git a/ppapi/shared_impl/ppb_trace_event_impl.h b/ppapi/shared_impl/ppb_trace_event_impl.h
new file mode 100644
index 0000000..21a77ac
--- /dev/null
+++ b/ppapi/shared_impl/ppb_trace_event_impl.h
@@ -0,0 +1,35 @@
+// 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 PPAPI_SHARED_IMPL_PPB_TRACE_EVENT_IMPL_H_
+#define PPAPI_SHARED_IMPL_PPB_TRACE_EVENT_IMPL_H_
+
+#include "ppapi/c/dev/ppb_trace_event_dev.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/shared_impl/ppapi_shared_export.h"
+
+namespace ppapi {
+
+// Contains the implementation of the PPB_Trace_Event_Dev functions. Since these
+// functions are to be run from whatever plugin process/thread in which they
+// originated, the implementation lives in shared_impl.
+//
+class PPAPI_SHARED_EXPORT TraceEventImpl {
+ public:
+  static void* GetCategoryEnabled(const char* category_name);
+  static void AddTraceEvent(int8_t phase,
+                               const void* category_enabled,
+                               const char* name,
+                               uint64_t id,
+                               uint32_t num_args,
+                               const char* arg_names[],
+                               const uint8_t arg_types[],
+                               const uint64_t arg_values[],
+                               uint8_t flags);
+  static void SetThreadName(const char* thread_name);
+};
+
+}  // namespace ppapi
+
+#endif  // PPAPI_SHARED_IMPL_PPB_TRACE_EVENT_IMPL_H_
diff --git a/ppapi/shared_impl/ppb_url_util_shared.cc b/ppapi/shared_impl/ppb_url_util_shared.cc
index f473530..7788f4a 100644
--- a/ppapi/shared_impl/ppb_url_util_shared.cc
+++ b/ppapi/shared_impl/ppb_url_util_shared.cc
@@ -6,6 +6,7 @@
 
 #include "googleurl/src/gurl.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/proxy_lock.h"
 #include "ppapi/shared_impl/var.h"
 #include "ppapi/shared_impl/var_tracker.h"
 
@@ -45,6 +46,7 @@
 // static
 PP_Var PPB_URLUtil_Shared::Canonicalize(PP_Var url,
                                         PP_URLComponents_Dev* components) {
+  ProxyAutoLock lock;
   StringVar* url_string = StringVar::FromPPVar(url);
   if (!url_string)
     return PP_MakeNull();
@@ -56,6 +58,7 @@
     PP_Var base_url,
     PP_Var relative,
     PP_URLComponents_Dev* components) {
+  ProxyAutoLock lock;
   StringVar* base_url_string = StringVar::FromPPVar(base_url);
   StringVar* relative_string = StringVar::FromPPVar(relative);
   if (!base_url_string || !relative_string)
@@ -70,6 +73,7 @@
 
 // static
 PP_Bool PPB_URLUtil_Shared::IsSameSecurityOrigin(PP_Var url_a, PP_Var url_b) {
+  ProxyAutoLock lock;
   StringVar* url_a_string = StringVar::FromPPVar(url_a);
   StringVar* url_b_string = StringVar::FromPPVar(url_b);
   if (!url_a_string || !url_b_string)
diff --git a/ppapi/shared_impl/ppb_var_shared.cc b/ppapi/shared_impl/ppb_var_shared.cc
index 107058a..702a89a 100644
--- a/ppapi/shared_impl/ppb_var_shared.cc
+++ b/ppapi/shared_impl/ppb_var_shared.cc
@@ -24,17 +24,17 @@
 // PPB_Var methods -------------------------------------------------------------
 
 void AddRefVar(PP_Var var) {
-  ppapi::ProxyAutoLock lock;
+  ProxyAutoLock lock;
   PpapiGlobals::Get()->GetVarTracker()->AddRefVar(var);
 }
 
 void ReleaseVar(PP_Var var) {
-  ppapi::ProxyAutoLock lock;
+  ProxyAutoLock lock;
   PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(var);
 }
 
 PP_Var VarFromUtf8(const char* data, uint32_t len) {
-  ppapi::ProxyAutoLock lock;
+  ProxyAutoLock lock;
   return StringVar::StringToPPVar(data, len);
 }
 
@@ -43,7 +43,7 @@
 }
 
 const char* VarToUtf8(PP_Var var, uint32_t* len) {
-  ppapi::ProxyAutoLock lock;
+  ProxyAutoLock lock;
   StringVar* str = StringVar::FromPPVar(var);
   if (str) {
     *len = static_cast<uint32_t>(str->value().size());
@@ -71,11 +71,13 @@
 // PPB_VarArrayBuffer methods --------------------------------------------------
 
 PP_Var CreateArrayBufferVar(uint32_t size_in_bytes) {
+  ProxyAutoLock lock;
   return PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
       size_in_bytes);
 }
 
 PP_Bool ByteLength(PP_Var array, uint32_t* byte_length) {
+  ProxyAutoLock lock;
   ArrayBufferVar* buffer = ArrayBufferVar::FromPPVar(array);
   if (!buffer)
     return PP_FALSE;
@@ -84,6 +86,7 @@
 }
 
 void* Map(PP_Var array) {
+  ProxyAutoLock lock;
   ArrayBufferVar* buffer = ArrayBufferVar::FromPPVar(array);
   if (!buffer)
     return NULL;
@@ -91,6 +94,7 @@
 }
 
 void Unmap(PP_Var array) {
+  ProxyAutoLock lock;
   ArrayBufferVar* buffer = ArrayBufferVar::FromPPVar(array);
   if (buffer)
     buffer->Unmap();
diff --git a/ppapi/shared_impl/ppb_video_capture_shared.cc b/ppapi/shared_impl/ppb_video_capture_shared.cc
deleted file mode 100644
index 2a51b95..0000000
--- a/ppapi/shared_impl/ppb_video_capture_shared.cc
+++ /dev/null
@@ -1,187 +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 "ppapi/shared_impl/ppb_video_capture_shared.h"
-
-#include "base/logging.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/shared_impl/ppb_device_ref_shared.h"
-#include "ppapi/shared_impl/ppb_resource_array_shared.h"
-
-namespace ppapi {
-
-PPB_VideoCapture_Shared::PPB_VideoCapture_Shared(PP_Instance instance)
-    : Resource(OBJECT_IS_IMPL, instance),
-      open_state_(BEFORE_OPEN),
-      status_(PP_VIDEO_CAPTURE_STATUS_STOPPED),
-      devices_(NULL),
-      resource_object_type_(OBJECT_IS_IMPL) {
-}
-
-PPB_VideoCapture_Shared::PPB_VideoCapture_Shared(
-    const HostResource& host_resource)
-    : Resource(OBJECT_IS_PROXY, host_resource),
-      open_state_(BEFORE_OPEN),
-      status_(PP_VIDEO_CAPTURE_STATUS_STOPPED),
-      devices_(NULL),
-      resource_object_type_(OBJECT_IS_PROXY) {
-}
-
-PPB_VideoCapture_Shared::~PPB_VideoCapture_Shared() {
-}
-
-thunk::PPB_VideoCapture_API* PPB_VideoCapture_Shared::AsPPB_VideoCapture_API() {
-  return this;
-}
-
-int32_t PPB_VideoCapture_Shared::EnumerateDevices(
-    PP_Resource* devices,
-    scoped_refptr<TrackedCallback> callback) {
-  if (TrackedCallback::IsPending(enumerate_devices_callback_))
-    return PP_ERROR_INPROGRESS;
-
-  return InternalEnumerateDevices(devices, callback);
-}
-
-int32_t PPB_VideoCapture_Shared::Open(
-    const std::string& device_id,
-    const PP_VideoCaptureDeviceInfo_Dev& requested_info,
-    uint32_t buffer_count,
-    scoped_refptr<TrackedCallback> callback) {
-  if (open_state_ != BEFORE_OPEN)
-    return PP_ERROR_FAILED;
-
-  if (TrackedCallback::IsPending(open_callback_))
-    return PP_ERROR_INPROGRESS;
-
-  return InternalOpen(device_id, requested_info, buffer_count, callback);
-}
-
-int32_t PPB_VideoCapture_Shared::StartCapture() {
-  if (open_state_ != OPENED ||
-      !SetStatus(PP_VIDEO_CAPTURE_STATUS_STARTING, false)) {
-    return PP_ERROR_FAILED;
-  }
-
-  return InternalStartCapture();
-}
-
-int32_t PPB_VideoCapture_Shared::ReuseBuffer(uint32_t buffer) {
-  return InternalReuseBuffer(buffer);
-}
-
-int32_t PPB_VideoCapture_Shared::StopCapture() {
-  if (open_state_ != OPENED ||
-      !SetStatus(PP_VIDEO_CAPTURE_STATUS_STOPPING, false)) {
-    return PP_ERROR_FAILED;
-  }
-
-  return InternalStopCapture();
-}
-
-void PPB_VideoCapture_Shared::Close() {
-  if (open_state_ == CLOSED)
-    return;
-
-  InternalClose();
-  open_state_ = CLOSED;
-
-  if (TrackedCallback::IsPending(open_callback_))
-    open_callback_->PostAbort();
-}
-
-int32_t PPB_VideoCapture_Shared::StartCapture0_1(
-    const PP_VideoCaptureDeviceInfo_Dev& requested_info,
-    uint32_t buffer_count) {
-  if (open_state_ == BEFORE_OPEN) {
-    if (TrackedCallback::IsPending(open_callback_))
-      return PP_ERROR_FAILED;
-    open_state_ = OPENED;
-  } else if (open_state_ == CLOSED) {
-    return PP_ERROR_FAILED;
-  }
-
-  if (!SetStatus(PP_VIDEO_CAPTURE_STATUS_STARTING, false))
-    return PP_ERROR_FAILED;
-
-  return InternalStartCapture0_1(requested_info, buffer_count);
-}
-
-const std::vector<DeviceRefData>& PPB_VideoCapture_Shared::GetDeviceRefData(
-    ) const {
-  return InternalGetDeviceRefData();
-}
-
-void PPB_VideoCapture_Shared::OnEnumerateDevicesComplete(
-    int32_t result,
-    const std::vector<DeviceRefData>& devices) {
-  DCHECK(TrackedCallback::IsPending(enumerate_devices_callback_));
-
-  if (result == PP_OK && devices_) {
-    *devices_ = PPB_DeviceRef_Shared::CreateResourceArray(
-        resource_object_type_, pp_instance(), devices);
-  }
-  devices_ = NULL;
-
-  enumerate_devices_callback_->Run(result);
-}
-
-void PPB_VideoCapture_Shared::OnOpenComplete(int32_t result) {
-  if (open_state_ == BEFORE_OPEN && result == PP_OK)
-    open_state_ = OPENED;
-
-  // The callback may have been aborted by Close(), or the open operation is
-  // completed synchronously.
-  if (TrackedCallback::IsPending(open_callback_))
-    open_callback_->Run(result);
-}
-
-bool PPB_VideoCapture_Shared::SetStatus(PP_VideoCaptureStatus_Dev status,
-                                        bool forced) {
-  if (!forced) {
-    switch (status) {
-      case PP_VIDEO_CAPTURE_STATUS_STOPPED:
-        if (status_ != PP_VIDEO_CAPTURE_STATUS_STOPPING)
-          return false;
-        break;
-      case PP_VIDEO_CAPTURE_STATUS_STARTING:
-        if (status_ != PP_VIDEO_CAPTURE_STATUS_STOPPED)
-          return false;
-        break;
-      case PP_VIDEO_CAPTURE_STATUS_STARTED:
-        switch (status_) {
-          case PP_VIDEO_CAPTURE_STATUS_STARTING:
-          case PP_VIDEO_CAPTURE_STATUS_PAUSED:
-            break;
-          default:
-            return false;
-        }
-        break;
-      case PP_VIDEO_CAPTURE_STATUS_PAUSED:
-        switch (status_) {
-          case PP_VIDEO_CAPTURE_STATUS_STARTING:
-          case PP_VIDEO_CAPTURE_STATUS_STARTED:
-            break;
-          default:
-            return false;
-        }
-        break;
-      case PP_VIDEO_CAPTURE_STATUS_STOPPING:
-        switch (status_) {
-          case PP_VIDEO_CAPTURE_STATUS_STARTING:
-          case PP_VIDEO_CAPTURE_STATUS_STARTED:
-          case PP_VIDEO_CAPTURE_STATUS_PAUSED:
-            break;
-          default:
-            return false;
-        }
-        break;
-    }
-  }
-
-  status_ = status;
-  return true;
-}
-
-}  // namespace ppapi
diff --git a/ppapi/shared_impl/ppb_video_capture_shared.h b/ppapi/shared_impl/ppb_video_capture_shared.h
deleted file mode 100644
index 80b29fe..0000000
--- a/ppapi/shared_impl/ppb_video_capture_shared.h
+++ /dev/null
@@ -1,100 +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 PPAPI_SHARED_IMPL_PPB_VIDEO_CAPTURE_SHARED_H_
-#define PPAPI_SHARED_IMPL_PPB_VIDEO_CAPTURE_SHARED_H_
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/memory/ref_counted.h"
-#include "ppapi/shared_impl/ppapi_shared_export.h"
-#include "ppapi/shared_impl/resource.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/thunk/ppb_video_capture_api.h"
-
-namespace ppapi {
-
-class PPAPI_SHARED_EXPORT PPB_VideoCapture_Shared
-    : public Resource,
-      NON_EXPORTED_BASE(public thunk::PPB_VideoCapture_API) {
- public:
-  explicit PPB_VideoCapture_Shared(PP_Instance instance);
-  explicit PPB_VideoCapture_Shared(const HostResource& host_resource);
-  virtual ~PPB_VideoCapture_Shared();
-
-  // Resource implementation.
-  virtual thunk::PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE;
-
-  // PPB_VideoCapture_API implementation.
-  virtual int32_t EnumerateDevices(
-      PP_Resource* devices,
-      scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t Open(const std::string& device_id,
-                       const PP_VideoCaptureDeviceInfo_Dev& requested_info,
-                       uint32_t buffer_count,
-                       scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual int32_t StartCapture() OVERRIDE;
-  virtual int32_t ReuseBuffer(uint32_t buffer) OVERRIDE;
-  virtual int32_t StopCapture() OVERRIDE;
-  virtual void Close() OVERRIDE;
-  virtual int32_t StartCapture0_1(
-      const PP_VideoCaptureDeviceInfo_Dev& requested_info,
-      uint32_t buffer_count) OVERRIDE;
-  virtual const std::vector<DeviceRefData>& GetDeviceRefData() const OVERRIDE;
-
-  void OnEnumerateDevicesComplete(int32_t result,
-                                  const std::vector<DeviceRefData>& devices);
-  void OnOpenComplete(int32_t result);
-
- protected:
-  enum OpenState {
-    BEFORE_OPEN,
-    OPENED,
-    CLOSED
-  };
-
-  // Subclasses should implement these methods to do impl- and proxy-specific
-  // work.
-  virtual int32_t InternalEnumerateDevices(
-      PP_Resource* devices,
-      scoped_refptr<TrackedCallback> callback) = 0;
-  virtual int32_t InternalOpen(
-      const std::string& device_id,
-      const PP_VideoCaptureDeviceInfo_Dev& requested_info,
-      uint32_t buffer_count,
-      scoped_refptr<TrackedCallback> callback) = 0;
-  virtual int32_t InternalStartCapture() = 0;
-  virtual int32_t InternalReuseBuffer(uint32_t buffer) = 0;
-  virtual int32_t InternalStopCapture() = 0;
-  virtual void InternalClose() = 0;
-  virtual int32_t InternalStartCapture0_1(
-      const PP_VideoCaptureDeviceInfo_Dev& requested_info,
-      uint32_t buffer_count) = 0;
-  virtual const std::vector<DeviceRefData>& InternalGetDeviceRefData(
-      ) const = 0;
-
-  // Checks whether |status| is expected and sets |status_| if yes. If |forced|
-  // is set to true, this method will bypass sanity check and always set
-  // |status_|.
-  bool SetStatus(PP_VideoCaptureStatus_Dev status, bool forced);
-
-  OpenState open_state_;
-  PP_VideoCaptureStatus_Dev status_;
-
-  scoped_refptr<TrackedCallback> enumerate_devices_callback_;
-  scoped_refptr<TrackedCallback> open_callback_;
-
-  // Output parameter of EnumerateDevices(). It should not be accessed after
-  // |enumerate_devices_callback_| is run.
-  PP_Resource* devices_;
-
-  ResourceObjectType resource_object_type_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(PPB_VideoCapture_Shared);
-};
-
-}  // namespace ppapi
-
-#endif  // PPAPI_SHARED_IMPL_PPB_VIDEO_CAPTURE_SHARED_H_
diff --git a/ppapi/shared_impl/ppb_video_decoder_shared.cc b/ppapi/shared_impl/ppb_video_decoder_shared.cc
index e2547aa..ffd422d 100644
--- a/ppapi/shared_impl/ppb_video_decoder_shared.cc
+++ b/ppapi/shared_impl/ppb_video_decoder_shared.cc
@@ -7,6 +7,7 @@
 #include "base/logging.h"
 #include "gpu/command_buffer/client/gles2_implementation.h"
 #include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/ppb_graphics_3d_shared.h"
 #include "ppapi/shared_impl/resource_tracker.h"
 #include "ppapi/thunk/enter.h"
 
@@ -90,8 +91,16 @@
 }
 
 void PPB_VideoDecoder_Shared::FlushCommandBuffer() {
-  if (gles2_impl_)
+  if (gles2_impl_) {
+    // To call Flush() we have to tell Graphics3D that we hold the proxy lock.
+    thunk::EnterResource<thunk::PPB_Graphics3D_API, false> enter_g3d(
+        graphics_context_, false);
+    DCHECK(enter_g3d.succeeded());
+    PPB_Graphics3D_Shared* graphics3d =
+        static_cast<PPB_Graphics3D_Shared*>(enter_g3d.object());
+    PPB_Graphics3D_Shared::ScopedNoLocking dont_lock(graphics3d);
     gles2_impl_->Flush();
+  }
 }
 
 }  // namespace ppapi
diff --git a/ppapi/shared_impl/ppb_view_shared.cc b/ppapi/shared_impl/ppb_view_shared.cc
index 54659a3..f11fe1f 100644
--- a/ppapi/shared_impl/ppb_view_shared.cc
+++ b/ppapi/shared_impl/ppb_view_shared.cc
@@ -4,11 +4,22 @@
 
 #include "ppapi/shared_impl/ppb_view_shared.h"
 
+namespace {
+
+bool IsRectNonempty(const PP_Rect& rect) {
+  return rect.size.width > 0 && rect.size.height > 0;
+}
+
+}  // namespace
+
 namespace ppapi {
 
 ViewData::ViewData() {
   // Assume POD.
   memset(this, 0, sizeof(ViewData));
+
+  device_scale = 1.0f;
+  css_scale = 1.0f;
 }
 
 ViewData::~ViewData() {
@@ -47,4 +58,38 @@
   return data_;
 }
 
+PP_Bool PPB_View_Shared::GetRect(PP_Rect* viewport) const {
+  if (!viewport)
+    return PP_FALSE;
+  *viewport = data_.rect;
+  return PP_TRUE;
+}
+
+PP_Bool PPB_View_Shared::IsFullscreen() const {
+  return PP_FromBool(data_.is_fullscreen);
+}
+
+PP_Bool PPB_View_Shared::IsVisible() const {
+  return PP_FromBool(data_.is_page_visible && IsRectNonempty(data_.clip_rect));
+}
+
+PP_Bool PPB_View_Shared::IsPageVisible() const {
+  return PP_FromBool(data_.is_page_visible);
+}
+
+PP_Bool PPB_View_Shared::GetClipRect(PP_Rect* clip) const {
+  if (!clip)
+    return PP_FALSE;
+  *clip = data_.clip_rect;
+  return PP_TRUE;
+}
+
+float PPB_View_Shared::GetDeviceScale() const {
+  return data_.device_scale;
+}
+
+float PPB_View_Shared::GetCSSScale() const {
+  return data_.css_scale;
+}
+
 }  // namespace ppapi
diff --git a/ppapi/shared_impl/ppb_view_shared.h b/ppapi/shared_impl/ppb_view_shared.h
index e3d41ac..77bf8f2 100644
--- a/ppapi/shared_impl/ppb_view_shared.h
+++ b/ppapi/shared_impl/ppb_view_shared.h
@@ -43,6 +43,14 @@
 
   // PPB_View_API implementation.
   virtual const ViewData& GetData() const OVERRIDE;
+  virtual PP_Bool GetRect(PP_Rect* viewport) const OVERRIDE;
+  virtual PP_Bool IsFullscreen() const OVERRIDE;
+  virtual PP_Bool IsVisible() const OVERRIDE;
+  virtual PP_Bool IsPageVisible() const OVERRIDE;
+  virtual PP_Bool GetClipRect(PP_Rect* clip) const
+      OVERRIDE;
+  virtual float GetDeviceScale() const OVERRIDE;
+  virtual float GetCSSScale() const OVERRIDE;
 
  private:
   ViewData data_;
diff --git a/ppapi/shared_impl/private/net_address_private_impl.cc b/ppapi/shared_impl/private/net_address_private_impl.cc
index 7a8e375..87a929f 100644
--- a/ppapi/shared_impl/private/net_address_private_impl.cc
+++ b/ppapi/shared_impl/private/net_address_private_impl.cc
@@ -24,6 +24,7 @@
 #include "build/build_config.h"
 #include "ppapi/c/pp_var.h"
 #include "ppapi/c/private/ppb_net_address_private.h"
+#include "ppapi/shared_impl/proxy_lock.h"
 #include "ppapi/shared_impl/var.h"
 #include "ppapi/thunk/thunk.h"
 
@@ -285,6 +286,9 @@
       *addr, PP_ToBool(include_port));
   if (str.empty())
     return PP_MakeUndefined();
+  // We must acquire the lock while accessing the VarTracker, which is part of
+  // the critical section of the proxy which may be accessed by other threads.
+  ProxyAutoLock lock;
   return StringVar::StringToPPVar(str);
 }
 
diff --git a/ppapi/shared_impl/private/ppb_char_set_shared.cc b/ppapi/shared_impl/private/ppb_char_set_shared.cc
index 8424b00..5ce51a6 100644
--- a/ppapi/shared_impl/private/ppb_char_set_shared.cc
+++ b/ppapi/shared_impl/private/ppb_char_set_shared.cc
@@ -9,10 +9,10 @@
 #include "base/i18n/icu_string_conversions.h"
 #include "ppapi/c/dev/ppb_memory_dev.h"
 #include "ppapi/thunk/thunk.h"
-#include "unicode/ucnv.h"
-#include "unicode/ucnv_cb.h"
-#include "unicode/ucnv_err.h"
-#include "unicode/ustring.h"
+#include "third_party/icu/public/common/unicode/ucnv.h"
+#include "third_party/icu/public/common/unicode/ucnv_cb.h"
+#include "third_party/icu/public/common/unicode/ucnv_err.h"
+#include "third_party/icu/public/common/unicode/ustring.h"
 
 namespace ppapi {
 
diff --git a/ppapi/shared_impl/private/ppb_host_resolver_shared.cc b/ppapi/shared_impl/private/ppb_host_resolver_shared.cc
deleted file mode 100644
index ba026dc..0000000
--- a/ppapi/shared_impl/private/ppb_host_resolver_shared.cc
+++ /dev/null
@@ -1,99 +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 "ppapi/shared_impl/private/ppb_host_resolver_shared.h"
-
-#include <cstddef>
-#include <cstring>
-
-#include "base/memory/scoped_ptr.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/shared_impl/private/net_address_private_impl.h"
-#include "ppapi/shared_impl/var.h"
-#include "ppapi/thunk/thunk.h"
-
-namespace ppapi {
-
-PPB_HostResolver_Shared::PPB_HostResolver_Shared(PP_Instance instance)
-    : Resource(OBJECT_IS_IMPL, instance),
-      host_resolver_id_(GenerateHostResolverID()) {
-}
-
-PPB_HostResolver_Shared::PPB_HostResolver_Shared(
-    const HostResource& resource)
-    : Resource(OBJECT_IS_PROXY, resource),
-      host_resolver_id_(GenerateHostResolverID()) {
-}
-
-PPB_HostResolver_Shared::~PPB_HostResolver_Shared() {
-}
-
-thunk::PPB_HostResolver_Private_API*
-PPB_HostResolver_Shared::AsPPB_HostResolver_Private_API() {
-  return this;
-}
-
-int32_t PPB_HostResolver_Shared::Resolve(
-    const char* host,
-    uint16_t port,
-    const PP_HostResolver_Private_Hint* hint,
-    scoped_refptr<TrackedCallback> callback) {
-  if (!host)
-    return PP_ERROR_BADARGUMENT;
-  if (ResolveInProgress())
-    return PP_ERROR_INPROGRESS;
-
-  resolve_callback_ = callback;
-
-  HostPortPair host_port;
-  host_port.host = host;
-  host_port.port = port;
-
-  SendResolve(host_port, hint);
-  return PP_OK_COMPLETIONPENDING;
-}
-
-PP_Var PPB_HostResolver_Shared::GetCanonicalName() {
-  return StringVar::StringToPPVar(canonical_name_);
-}
-
-uint32_t PPB_HostResolver_Shared::GetSize() {
-  if (ResolveInProgress())
-    return 0;
-  return static_cast<uint32_t>(net_address_list_.size());
-}
-
-bool PPB_HostResolver_Shared::GetNetAddress(uint32 index,
-                                            PP_NetAddress_Private* address) {
-  if (ResolveInProgress() || index >= GetSize())
-    return false;
-  *address = net_address_list_[index];
-  return true;
-}
-
-void PPB_HostResolver_Shared::OnResolveCompleted(
-    bool succeeded,
-    const std::string& canonical_name,
-    const std::vector<PP_NetAddress_Private>& net_address_list) {
-  if (succeeded) {
-    canonical_name_ = canonical_name;
-    net_address_list_ = net_address_list;
-  } else {
-    canonical_name_.clear();
-    net_address_list_.clear();
-  }
-
-  resolve_callback_->Run(succeeded ? PP_OK : PP_ERROR_FAILED);
-}
-
-uint32 PPB_HostResolver_Shared::GenerateHostResolverID() {
-  static uint32 host_resolver_id = 0;
-  return host_resolver_id++;
-}
-
-bool PPB_HostResolver_Shared::ResolveInProgress() const {
-  return TrackedCallback::IsPending(resolve_callback_);
-}
-
-}  // namespace ppapi
diff --git a/ppapi/shared_impl/private/ppb_host_resolver_shared.h b/ppapi/shared_impl/private/ppb_host_resolver_shared.h
deleted file mode 100644
index 7372dc5..0000000
--- a/ppapi/shared_impl/private/ppb_host_resolver_shared.h
+++ /dev/null
@@ -1,76 +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 PPAPI_SHARED_IMPL_PRIVATE_PPB_HOST_RESOLVER_SHARED_H_
-#define PPAPI_SHARED_IMPL_PRIVATE_PPB_HOST_RESOLVER_SHARED_H_
-
-#include <string>
-#include <vector>
-
-#include "base/compiler_specific.h"
-#include "base/memory/ref_counted.h"
-#include "ppapi/shared_impl/resource.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/thunk/ppb_host_resolver_private_api.h"
-
-namespace ppapi {
-
-struct HostPortPair {
-  std::string host;
-  uint16_t port;
-};
-
-class PPAPI_SHARED_EXPORT PPB_HostResolver_Shared
-    : public thunk::PPB_HostResolver_Private_API,
-      public Resource {
- public:
-  // C-tor used in Impl case.
-  explicit PPB_HostResolver_Shared(PP_Instance instance);
-
-  // C-tor used in Proxy case.
-  explicit PPB_HostResolver_Shared(const HostResource& resource);
-
-  virtual ~PPB_HostResolver_Shared();
-
-  // Resource overrides.
-  virtual PPB_HostResolver_Private_API*
-      AsPPB_HostResolver_Private_API() OVERRIDE;
-
-  // PPB_HostResolver_Private_API implementation.
-  virtual int32_t Resolve(const char* host,
-                          uint16_t port,
-                          const PP_HostResolver_Private_Hint* hint,
-                          scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual PP_Var GetCanonicalName() OVERRIDE;
-  virtual uint32_t GetSize() OVERRIDE;
-  virtual bool GetNetAddress(uint32_t index,
-                             PP_NetAddress_Private* address) OVERRIDE;
-
-  void OnResolveCompleted(
-      bool succeeded,
-      const std::string& canonical_name,
-      const std::vector<PP_NetAddress_Private>& net_address_list);
-
-  // Send functions that need to be implemented differently for the
-  // proxied and non-proxied derived classes.
-  virtual void SendResolve(const HostPortPair& host_port,
-                           const PP_HostResolver_Private_Hint* hint) = 0;
-
- protected:
-  static uint32 GenerateHostResolverID();
-  bool ResolveInProgress() const;
-
-  const uint32 host_resolver_id_;
-
-  scoped_refptr<TrackedCallback> resolve_callback_;
-
-  std::string canonical_name_;
-  std::vector<PP_NetAddress_Private> net_address_list_;
-
-  DISALLOW_COPY_AND_ASSIGN(PPB_HostResolver_Shared);
-};
-
-}  // namespace ppapi
-
-#endif  // PPAPI_SHARED_IMPL_PRIVATE_PPB_HOST_RESOLVER_SHARED_H_
diff --git a/ppapi/shared_impl/private/tcp_socket_private_impl.cc b/ppapi/shared_impl/private/tcp_socket_private_impl.cc
index e2c645f..87cc600 100644
--- a/ppapi/shared_impl/private/tcp_socket_private_impl.cc
+++ b/ppapi/shared_impl/private/tcp_socket_private_impl.cc
@@ -212,11 +212,34 @@
   PostAbortIfNecessary(&ssl_handshake_callback_);
   PostAbortIfNecessary(&read_callback_);
   PostAbortIfNecessary(&write_callback_);
+  PostAbortIfNecessary(&set_option_callback_);
   read_buffer_ = NULL;
   bytes_to_read_ = -1;
   server_certificate_ = NULL;
 }
 
+int32_t TCPSocketPrivateImpl::SetOption(
+    PP_TCPSocketOption_Private name,
+    const PP_Var& value,
+    scoped_refptr<TrackedCallback> callback) {
+  if (!IsConnected())
+    return PP_ERROR_FAILED;
+  if (TrackedCallback::IsPending(set_option_callback_))
+    return PP_ERROR_INPROGRESS;
+
+  set_option_callback_ = callback;
+
+  switch (name) {
+    case PP_TCPSOCKETOPTION_NO_DELAY:
+      if (value.type != PP_VARTYPE_BOOL)
+        return PP_ERROR_BADARGUMENT;
+      SendSetBoolOption(name, PP_ToBool(value.value.as_bool));
+      return PP_OK_COMPLETIONPENDING;
+    default:
+      return PP_ERROR_BADARGUMENT;
+  }
+}
+
 void TCPSocketPrivateImpl::OnConnectCompleted(
     bool succeeded,
     const PP_NetAddress_Private& local_addr,
@@ -293,6 +316,15 @@
       succeeded ? bytes_written : static_cast<int32_t>(PP_ERROR_FAILED));
 }
 
+void TCPSocketPrivateImpl::OnSetOptionCompleted(bool succeeded) {
+  if (!TrackedCallback::IsPending(set_option_callback_)) {
+    NOTREACHED();
+    return;
+  }
+
+  set_option_callback_->Run(succeeded ? PP_OK : PP_ERROR_FAILED);
+}
+
 void TCPSocketPrivateImpl::Init(uint32 socket_id) {
   DCHECK(socket_id != 0);
   socket_id_ = socket_id;
diff --git a/ppapi/shared_impl/private/tcp_socket_private_impl.h b/ppapi/shared_impl/private/tcp_socket_private_impl.h
index 2792102..95057e7 100644
--- a/ppapi/shared_impl/private/tcp_socket_private_impl.h
+++ b/ppapi/shared_impl/private/tcp_socket_private_impl.h
@@ -66,6 +66,9 @@
                         int32_t bytes_to_write,
                         scoped_refptr<TrackedCallback> callback) OVERRIDE;
   virtual void Disconnect() OVERRIDE;
+  virtual int32_t SetOption(PP_TCPSocketOption_Private name,
+                            const PP_Var& value,
+                            scoped_refptr<TrackedCallback> callback) OVERRIDE;
 
   // Notifications on operations completion.
   void OnConnectCompleted(bool succeeded,
@@ -76,6 +79,7 @@
       const PPB_X509Certificate_Fields& certificate_fields);
   void OnReadCompleted(bool succeeded, const std::string& data);
   void OnWriteCompleted(bool succeeded, int32_t bytes_written);
+  void OnSetOptionCompleted(bool succeeded);
 
   // Send functions that need to be implemented differently for the
   // proxied and non-proxied derived classes.
@@ -89,6 +93,8 @@
   virtual void SendRead(int32_t bytes_to_read) = 0;
   virtual void SendWrite(const std::string& buffer) = 0;
   virtual void SendDisconnect() = 0;
+  virtual void SendSetBoolOption(PP_TCPSocketOption_Private name,
+                                 bool value) = 0;
 
  protected:
   enum ConnectionState {
@@ -117,6 +123,7 @@
   scoped_refptr<TrackedCallback> ssl_handshake_callback_;
   scoped_refptr<TrackedCallback> read_callback_;
   scoped_refptr<TrackedCallback> write_callback_;
+  scoped_refptr<TrackedCallback> set_option_callback_;
 
   char* read_buffer_;
   int32_t bytes_to_read_;
diff --git a/ppapi/shared_impl/private/udp_socket_private_impl.cc b/ppapi/shared_impl/private/udp_socket_private_impl.cc
deleted file mode 100644
index 288c38f..0000000
--- a/ppapi/shared_impl/private/udp_socket_private_impl.cc
+++ /dev/null
@@ -1,223 +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 "ppapi/shared_impl/private/udp_socket_private_impl.h"
-
-#include <string.h>
-
-#include <algorithm>
-
-#include "base/basictypes.h"
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/message_loop.h"
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-
-namespace ppapi {
-
-const int32_t UDPSocketPrivateImpl::kMaxReadSize = 1024 * 1024;
-const int32_t UDPSocketPrivateImpl::kMaxWriteSize = 1024 * 1024;
-
-UDPSocketPrivateImpl::UDPSocketPrivateImpl(const HostResource& resource,
-                                           uint32 socket_id)
-    : Resource(OBJECT_IS_PROXY, resource) {
-  Init(socket_id);
-}
-
-UDPSocketPrivateImpl::UDPSocketPrivateImpl(PP_Instance instance,
-                                           uint32 socket_id)
-    : Resource(OBJECT_IS_IMPL, instance) {
-  Init(socket_id);
-}
-
-UDPSocketPrivateImpl::~UDPSocketPrivateImpl() {
-}
-
-thunk::PPB_UDPSocket_Private_API*
-UDPSocketPrivateImpl::AsPPB_UDPSocket_Private_API() {
-  return this;
-}
-
-int32_t UDPSocketPrivateImpl::SetSocketFeature(PP_UDPSocketFeature_Private name,
-                                               PP_Var value) {
-  if (bound_ || closed_)
-    return PP_ERROR_FAILED;
-
-  switch (name) {
-    case PP_UDPSOCKETFEATURE_ADDRESS_REUSE:
-    case PP_UDPSOCKETFEATURE_BROADCAST:
-      if (value.type != PP_VARTYPE_BOOL)
-        return PP_ERROR_BADARGUMENT;
-      SendBoolSocketFeature(static_cast<int32_t>(name),
-                            PP_ToBool(value.value.as_bool));
-      break;
-    default:
-      return PP_ERROR_BADARGUMENT;
-  }
-  return PP_OK;
-}
-
-int32_t UDPSocketPrivateImpl::Bind(const PP_NetAddress_Private* addr,
-                                   scoped_refptr<TrackedCallback> callback) {
-  if (!addr)
-    return PP_ERROR_BADARGUMENT;
-  if (bound_ || closed_)
-    return PP_ERROR_FAILED;
-  if (TrackedCallback::IsPending(bind_callback_))
-    return PP_ERROR_INPROGRESS;
-
-  bind_callback_ = callback;
-
-  // Send the request, the browser will call us back via BindACK.
-  SendBind(*addr);
-  return PP_OK_COMPLETIONPENDING;
-}
-
-PP_Bool UDPSocketPrivateImpl::GetBoundAddress(PP_NetAddress_Private* addr) {
-  if (!addr || !bound_ || closed_)
-    return PP_FALSE;
-
-  *addr = bound_addr_;
-  return PP_TRUE;
-}
-
-int32_t UDPSocketPrivateImpl::RecvFrom(
-    char* buffer,
-    int32_t num_bytes,
-    scoped_refptr<TrackedCallback> callback) {
-  if (!buffer || num_bytes <= 0)
-    return PP_ERROR_BADARGUMENT;
-  if (!bound_)
-    return PP_ERROR_FAILED;
-  if (TrackedCallback::IsPending(recvfrom_callback_))
-    return PP_ERROR_INPROGRESS;
-
-  read_buffer_ = buffer;
-  bytes_to_read_ = std::min(num_bytes, kMaxReadSize);
-  recvfrom_callback_ = callback;
-
-  // Send the request, the browser will call us back via RecvFromACK.
-  SendRecvFrom(bytes_to_read_);
-  return PP_OK_COMPLETIONPENDING;
-}
-
-PP_Bool UDPSocketPrivateImpl::GetRecvFromAddress(PP_NetAddress_Private* addr) {
-  if (!addr)
-    return PP_FALSE;
-
-  *addr = recvfrom_addr_;
-  return PP_TRUE;
-}
-
-int32_t UDPSocketPrivateImpl::SendTo(const char* buffer,
-                                     int32_t num_bytes,
-                                     const PP_NetAddress_Private* addr,
-                                     scoped_refptr<TrackedCallback> callback) {
-  if (!buffer || num_bytes <= 0 || !addr)
-    return PP_ERROR_BADARGUMENT;
-  if (!bound_)
-    return PP_ERROR_FAILED;
-  if (TrackedCallback::IsPending(sendto_callback_))
-    return PP_ERROR_INPROGRESS;
-
-  if (num_bytes > kMaxWriteSize)
-    num_bytes = kMaxWriteSize;
-
-  sendto_callback_ = callback;
-
-  // Send the request, the browser will call us back via SendToACK.
-  SendSendTo(std::string(buffer, num_bytes), *addr);
-  return PP_OK_COMPLETIONPENDING;
-}
-
-void UDPSocketPrivateImpl::Close() {
-  if(closed_)
-    return;
-
-  bound_ = false;
-  closed_ = true;
-
-  SendClose();
-
-  socket_id_ = 0;
-
-  PostAbortIfNecessary(&bind_callback_);
-  PostAbortIfNecessary(&recvfrom_callback_);
-  PostAbortIfNecessary(&sendto_callback_);
-}
-
-void UDPSocketPrivateImpl::OnBindCompleted(
-    bool succeeded,
-    const PP_NetAddress_Private& addr) {
-  if (!TrackedCallback::IsPending(bind_callback_)) {
-    NOTREACHED();
-    return;
-  }
-
-  if (succeeded)
-    bound_ = true;
-
-  bound_addr_ = addr;
-
-  bind_callback_->Run(succeeded ? PP_OK : PP_ERROR_FAILED);
-}
-
-void UDPSocketPrivateImpl::OnRecvFromCompleted(
-    bool succeeded,
-    const std::string& data,
-    const PP_NetAddress_Private& addr) {
-  if (!TrackedCallback::IsPending(recvfrom_callback_) || !read_buffer_) {
-    NOTREACHED();
-    return;
-  }
-
-  if (succeeded) {
-    CHECK_LE(static_cast<int32_t>(data.size()), bytes_to_read_);
-    if (!data.empty())
-      memcpy(read_buffer_, data.c_str(), data.size());
-  }
-  read_buffer_ = NULL;
-  bytes_to_read_ = -1;
-  recvfrom_addr_ = addr;
-
-  recvfrom_callback_->Run(succeeded ? static_cast<int32_t>(data.size()) :
-      static_cast<int32_t>(PP_ERROR_FAILED));
-}
-
-void UDPSocketPrivateImpl::OnSendToCompleted(bool succeeded,
-                                             int32_t bytes_written) {
-  if (!TrackedCallback::IsPending(sendto_callback_)) {
-    NOTREACHED();
-    return;
-  }
-
-  sendto_callback_->Run(
-      succeeded ? bytes_written : static_cast<int32_t>(PP_ERROR_FAILED));
-}
-
-void UDPSocketPrivateImpl::Init(uint32 socket_id) {
-  DCHECK(socket_id != 0);
-  socket_id_ = socket_id;
-  bound_ = false;
-  closed_ = false;
-  read_buffer_ = NULL;
-  bytes_to_read_ = -1;
-
-  recvfrom_addr_.size = 0;
-  memset(recvfrom_addr_.data, 0,
-         arraysize(recvfrom_addr_.data) * sizeof(*recvfrom_addr_.data));
-  bound_addr_.size = 0;
-  memset(bound_addr_.data, 0,
-         arraysize(bound_addr_.data) * sizeof(*bound_addr_.data));
-}
-
-void UDPSocketPrivateImpl::PostAbortIfNecessary(
-    scoped_refptr<TrackedCallback>* callback) {
-  if (TrackedCallback::IsPending(*callback))
-    (*callback)->PostAbort();
-}
-
-}  // namespace ppapi
diff --git a/ppapi/shared_impl/private/udp_socket_private_impl.h b/ppapi/shared_impl/private/udp_socket_private_impl.h
deleted file mode 100644
index e8e3cb2..0000000
--- a/ppapi/shared_impl/private/udp_socket_private_impl.h
+++ /dev/null
@@ -1,99 +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 PPAPI_SHARED_IMPL_PRIVATE_UDP_SOCKET_PRIVATE_IMPL_H_
-#define PPAPI_SHARED_IMPL_PRIVATE_UDP_SOCKET_PRIVATE_IMPL_H_
-
-#include <string>
-
-#include "base/compiler_specific.h"
-#include "ppapi/shared_impl/resource.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/thunk/ppb_udp_socket_private_api.h"
-
-namespace ppapi {
-
-// This class provides the shared implementation of a
-// PPB_UDPSocket_Private.  The functions that actually send messages
-// to browser are implemented differently for the proxied and
-// non-proxied derived classes.
-class PPAPI_SHARED_EXPORT UDPSocketPrivateImpl
-    : public thunk::PPB_UDPSocket_Private_API,
-      public Resource {
- public:
-  // C-tor used in Impl case.
-  UDPSocketPrivateImpl(PP_Instance instance, uint32 socket_id);
-  // C-tor used in Proxy case.
-  UDPSocketPrivateImpl(const HostResource& resource, uint32 socket_id);
-
-  virtual ~UDPSocketPrivateImpl();
-
-  // The maximum number of bytes that each PpapiHostMsg_PPBUDPSocket_RecvFrom
-  // message is allowed to request.
-  static const int32_t kMaxReadSize;
-  // The maximum number of bytes that each PpapiHostMsg_PPBUDPSocket_SendTo
-  // message is allowed to carry.
-  static const int32_t kMaxWriteSize;
-
-  // Resource overrides.
-  virtual PPB_UDPSocket_Private_API* AsPPB_UDPSocket_Private_API() OVERRIDE;
-
-  // PPB_UDPSocket_Private_API implementation.
-  virtual int32_t SetSocketFeature(PP_UDPSocketFeature_Private name,
-                                   PP_Var value) OVERRIDE;
-  virtual int32_t Bind(const PP_NetAddress_Private* addr,
-                       scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual PP_Bool GetBoundAddress(PP_NetAddress_Private* addr) OVERRIDE;
-  virtual int32_t RecvFrom(char* buffer,
-                           int32_t num_bytes,
-                           scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual PP_Bool GetRecvFromAddress(PP_NetAddress_Private* addr) OVERRIDE;
-  virtual int32_t SendTo(const char* buffer,
-                         int32_t num_bytes,
-                         const PP_NetAddress_Private* addr,
-                         scoped_refptr<TrackedCallback> callback) OVERRIDE;
-  virtual void Close() OVERRIDE;
-
-  // Notifications from the proxy.
-  void OnBindCompleted(bool succeeded,
-                       const PP_NetAddress_Private& bound_addr);
-  void OnRecvFromCompleted(bool succeeded,
-                           const std::string& data,
-                           const PP_NetAddress_Private& addr);
-  void OnSendToCompleted(bool succeeded, int32_t bytes_written);
-
-  // Send functions that need to be implemented differently for
-  // the proxied and non-proxied derived classes.
-  virtual void SendBoolSocketFeature(int32_t name, bool value) = 0;
-  virtual void SendBind(const PP_NetAddress_Private& addr) = 0;
-  virtual void SendRecvFrom(int32_t num_bytes) = 0;
-  virtual void SendSendTo(const std::string& buffer,
-                          const PP_NetAddress_Private& addr) = 0;
-  virtual void SendClose() = 0;
-
- protected:
-  void Init(uint32 socket_id);
-  void PostAbortIfNecessary(scoped_refptr<TrackedCallback>* callback);
-
-  uint32 socket_id_;
-
-  bool bound_;
-  bool closed_;
-
-  scoped_refptr<TrackedCallback> bind_callback_;
-  scoped_refptr<TrackedCallback> recvfrom_callback_;
-  scoped_refptr<TrackedCallback> sendto_callback_;
-
-  char* read_buffer_;
-  int32_t bytes_to_read_;
-
-  PP_NetAddress_Private recvfrom_addr_;
-  PP_NetAddress_Private bound_addr_;
-
-  DISALLOW_COPY_AND_ASSIGN(UDPSocketPrivateImpl);
-};
-
-}  // namespace ppapi
-
-#endif  // PPAPI_SHARED_IMPL_PRIVATE_UDP_SOCKET_PRIVATE_IMPL_H_
diff --git a/ppapi/shared_impl/proxy_lock.cc b/ppapi/shared_impl/proxy_lock.cc
index 990130a..f9f937f 100644
--- a/ppapi/shared_impl/proxy_lock.cc
+++ b/ppapi/shared_impl/proxy_lock.cc
@@ -4,30 +4,54 @@
 
 #include "ppapi/shared_impl/proxy_lock.h"
 
+#include "base/lazy_instance.h"
 #include "base/synchronization/lock.h"
+#include "base/threading/thread_local.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
 
 namespace ppapi {
 
+// Simple single-thread deadlock detector for the proxy lock.
+// |true| when the current thread has the lock.
+base::LazyInstance<base::ThreadLocalBoolean>::Leaky
+    g_proxy_locked_on_thread = LAZY_INSTANCE_INITIALIZER;
+
 // static
 void ProxyLock::Acquire() {
   base::Lock* lock(PpapiGlobals::Get()->GetProxyLock());
-  if (lock)
+  if (lock) {
+    // This thread does not already hold the lock.
+    const bool deadlock = g_proxy_locked_on_thread.Get().Get();
+    CHECK(!deadlock);
+
     lock->Acquire();
+    g_proxy_locked_on_thread.Get().Set(true);
+  }
 }
 
 // static
 void ProxyLock::Release() {
   base::Lock* lock(PpapiGlobals::Get()->GetProxyLock());
-  if (lock)
+  if (lock) {
+    // This thread currently holds the lock.
+    const bool locked = g_proxy_locked_on_thread.Get().Get();
+    CHECK(locked);
+
+    g_proxy_locked_on_thread.Get().Set(false);
     lock->Release();
+  }
 }
 
 // static
 void ProxyLock::AssertAcquired() {
   base::Lock* lock(PpapiGlobals::Get()->GetProxyLock());
-  if (lock)
+  if (lock) {
+    // This thread currently holds the lock.
+    const bool locked = g_proxy_locked_on_thread.Get().Get();
+    CHECK(locked);
+
     lock->AssertAcquired();
+  }
 }
 
 void CallWhileUnlocked(const base::Closure& closure) {
diff --git a/ppapi/shared_impl/resource.cc b/ppapi/shared_impl/resource.cc
index 88f908b..f1db8de 100644
--- a/ppapi/shared_impl/resource.cc
+++ b/ppapi/shared_impl/resource.cc
@@ -59,6 +59,10 @@
 }
 
 void Resource::NotifyInstanceWasDeleted() {
+  // Hold a reference, because InstanceWasDeleted() may cause us to be
+  // destroyed.
+  scoped_refptr<Resource> keep_alive(this);
+
   // Notify subclasses.
   InstanceWasDeleted();
 
@@ -70,7 +74,7 @@
   NOTREACHED();
 }
 
-void Resource::Log(PP_LogLevel_Dev level, const std::string& message) {
+void Resource::Log(PP_LogLevel level, const std::string& message) {
   PpapiGlobals::Get()->LogWithSource(pp_instance(), level, std::string(),
                                      message);
 }
diff --git a/ppapi/shared_impl/resource.h b/ppapi/shared_impl/resource.h
index 3f1f5ab..23522d5 100644
--- a/ppapi/shared_impl/resource.h
+++ b/ppapi/shared_impl/resource.h
@@ -13,7 +13,7 @@
 #include "base/memory/ref_counted.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_resource.h"
-#include "ppapi/c/dev/ppb_console_dev.h"
+#include "ppapi/c/ppb_console.h"
 #include "ppapi/shared_impl/host_resource.h"
 
 // All resource types should be added here. This implements our hand-rolled
@@ -24,9 +24,10 @@
   F(PPB_AudioInput_API) \
   F(PPB_AudioTrusted_API) \
   F(PPB_Broker_API) \
+  F(PPB_Broker_Instance_API) \
+  F(PPB_BrowserFont_Singleton_API) \
   F(PPB_BrowserFont_Trusted_API) \
   F(PPB_Buffer_API) \
-  F(PPB_BufferTrusted_API) \
   F(PPB_DeviceRef_API) \
   F(PPB_DirectoryReader_API) \
   F(PPB_FileChooser_API) \
@@ -36,10 +37,13 @@
   F(PPB_Find_API) \
   F(PPB_Flash_Clipboard_API) \
   F(PPB_Flash_DeviceID_API) \
+  F(PPB_Flash_File_API) \
   F(PPB_Flash_FontFile_API) \
+  F(PPB_Flash_Fullscreen_API) \
   F(PPB_Flash_Functions_API) \
   F(PPB_Flash_Menu_API) \
   F(PPB_Flash_MessageLoop_API) \
+  F(PPB_Gamepad_API) \
   F(PPB_Graphics2D_API) \
   F(PPB_Graphics3D_API) \
   F(PPB_HostResolver_Private_API) \
@@ -49,11 +53,12 @@
   F(PPB_MessageLoop_API) \
   F(PPB_NetworkList_Private_API) \
   F(PPB_NetworkMonitor_Private_API) \
-  F(PPB_PDFFont_API) \
   F(PPB_Printing_API) \
   F(PPB_ResourceArray_API) \
   F(PPB_Scrollbar_API) \
   F(PPB_Talk_Private_API) \
+  F(PPB_TrueTypeFont_API) \
+  F(PPB_TrueTypeFont_Singleton_API) \
   F(PPB_TCPServerSocket_Private_API) \
   F(PPB_TCPSocket_Private_API) \
   F(PPB_UDPSocket_Private_API) \
@@ -199,7 +204,7 @@
 
  protected:
   // Logs a message to the console from this resource.
-  void Log(PP_LogLevel_Dev level, const std::string& message);
+  void Log(PP_LogLevel level, const std::string& message);
 
   // Notifications for subclasses.
   virtual void LastPluginRefWasDeleted() {}
diff --git a/ppapi/shared_impl/resource_tracker.cc b/ppapi/shared_impl/resource_tracker.cc
index 45f127a..f7e22eb 100644
--- a/ppapi/shared_impl/resource_tracker.cc
+++ b/ppapi/shared_impl/resource_tracker.cc
@@ -10,6 +10,7 @@
 #include "ppapi/shared_impl/callback_tracker.h"
 #include "ppapi/shared_impl/id_assignment.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/proxy_lock.h"
 #include "ppapi/shared_impl/resource.h"
 
 namespace ppapi {
@@ -24,6 +25,7 @@
 
 Resource* ResourceTracker::GetResource(PP_Resource res) const {
   CHECK(thread_checker_.CalledOnValidThread());
+  ProxyLock::AssertAcquired();
   ResourceMap::const_iterator i = live_resources_.find(res);
   if (i == live_resources_.end())
     return NULL;
@@ -78,9 +80,9 @@
 void ResourceTracker::ReleaseResourceSoon(PP_Resource res) {
   MessageLoop::current()->PostNonNestableTask(
       FROM_HERE,
-      base::Bind(&ResourceTracker::ReleaseResource,
-             weak_ptr_factory_.GetWeakPtr(),
-             res));
+      RunWhileLocked(base::Bind(&ResourceTracker::ReleaseResource,
+                                weak_ptr_factory_.GetWeakPtr(),
+                                res)));
 }
 
 void ResourceTracker::DidCreateInstance(PP_Instance instance) {
diff --git a/ppapi/shared_impl/scoped_pp_resource.cc b/ppapi/shared_impl/scoped_pp_resource.cc
index 8399208..45a1ad7 100644
--- a/ppapi/shared_impl/scoped_pp_resource.cc
+++ b/ppapi/shared_impl/scoped_pp_resource.cc
@@ -55,7 +55,8 @@
 }
 
 PP_Resource ScopedPPResource::Release() {
-  CallRelease();
+  // We do NOT call CallRelease, because we want to pass our reference to the
+  // caller.
 
   PP_Resource ret = id_;
   id_ = 0;
diff --git a/ppapi/shared_impl/scoped_pp_var.cc b/ppapi/shared_impl/scoped_pp_var.cc
index fcd6806..3ae13b0 100644
--- a/ppapi/shared_impl/scoped_pp_var.cc
+++ b/ppapi/shared_impl/scoped_pp_var.cc
@@ -47,4 +47,10 @@
   return *this;
 }
 
+PP_Var ScopedPPVar::Release() {
+  PP_Var result = var_;
+  var_ = PP_MakeUndefined();
+  return result;
+}
+
 }  // namespace ppapi
diff --git a/ppapi/shared_impl/scoped_pp_var.h b/ppapi/shared_impl/scoped_pp_var.h
index 8079a91..564401d 100644
--- a/ppapi/shared_impl/scoped_pp_var.h
+++ b/ppapi/shared_impl/scoped_pp_var.h
@@ -16,7 +16,7 @@
 
   ScopedPPVar();
 
-  // Takes one reference to the given resource.
+  // Takes one reference to the given var.
   explicit ScopedPPVar(const PP_Var& v);
 
   // Assumes responsibility for one ref that the var already has.
diff --git a/ppapi/shared_impl/singleton_resource_id.h b/ppapi/shared_impl/singleton_resource_id.h
new file mode 100644
index 0000000..ef3096d
--- /dev/null
+++ b/ppapi/shared_impl/singleton_resource_id.h
@@ -0,0 +1,29 @@
+// 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 PPAPI_SHARED_IMPL_SINGLETON_RESOURCE_ID_H_
+#define PPAPI_SHARED_IMPL_SINGLETON_RESOURCE_ID_H_
+
+namespace ppapi {
+
+// These IDs are used to access singleton resource objects using
+// PPB_Instance_API.GetSingletonResource.
+enum SingletonResourceID {
+  // TODO(raymes): The broker resource isn't really a singleton. This is only
+  // a hack until PPB_Broker trusted has been fully refactored to the new
+  // resource model.
+  BROKER_SINGLETON_ID,
+  BROWSER_FONT_SINGLETON_ID,
+  FLASH_CLIPBOARD_SINGLETON_ID,
+  FLASH_FILE_SINGLETON_ID,
+  FLASH_FULLSCREEN_SINGLETON_ID,
+  FLASH_SINGLETON_ID,
+  GAMEPAD_SINGLETON_ID,
+  PDF_SINGLETON_ID,
+  TRUETYPE_FONT_SINGLETON_ID,
+};
+
+}  // namespace ppapi
+
+#endif  // PPAPI_SHARED_IMPL_SINGLETON_RESOURCE_ID_H_
diff --git a/ppapi/shared_impl/test_globals.cc b/ppapi/shared_impl/test_globals.cc
index b1dc0fe..913d53c 100644
--- a/ppapi/shared_impl/test_globals.cc
+++ b/ppapi/shared_impl/test_globals.cc
@@ -11,8 +11,8 @@
       callback_tracker_(new CallbackTracker) {
 }
 
-TestGlobals::TestGlobals(PpapiGlobals::ForTest for_test)
-    : ppapi::PpapiGlobals(for_test),
+TestGlobals::TestGlobals(PpapiGlobals::PerThreadForTest per_thread_for_test)
+    : ppapi::PpapiGlobals(per_thread_for_test),
       callback_tracker_(new CallbackTracker) {
 }
 
@@ -58,13 +58,13 @@
 }
 
 void TestGlobals::LogWithSource(PP_Instance instance,
-                                PP_LogLevel_Dev level,
+                                PP_LogLevel level,
                                 const std::string& source,
                                 const std::string& value) {
 }
 
 void TestGlobals::BroadcastLogWithSource(PP_Module module,
-                                         PP_LogLevel_Dev level,
+                                         PP_LogLevel level,
                                          const std::string& source,
                                          const std::string& value) {
 }
diff --git a/ppapi/shared_impl/test_globals.h b/ppapi/shared_impl/test_globals.h
index ca67e77..5579b09 100644
--- a/ppapi/shared_impl/test_globals.h
+++ b/ppapi/shared_impl/test_globals.h
@@ -6,6 +6,7 @@
 #define PPAPI_SHARED_IMPL_TEST_GLOBALS_H_
 
 #include "base/compiler_specific.h"
+#include "base/shared_memory.h"
 #include "ppapi/shared_impl/callback_tracker.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
 #include "ppapi/shared_impl/resource_tracker.h"
@@ -20,8 +21,24 @@
   virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) OVERRIDE {
     return NULL;
   }
+  virtual ArrayBufferVar* CreateShmArrayBuffer(
+      uint32 size_in_bytes,
+      base::SharedMemoryHandle handle) OVERRIDE {
+    return NULL;
+  }
   virtual void DidDeleteInstance(PP_Instance instance) OVERRIDE {
   }
+  virtual int TrackSharedMemoryHandle(PP_Instance instance,
+                                      base::SharedMemoryHandle handle,
+                                      uint32 size_in_bytes) OVERRIDE {
+    return -1;
+  }
+  virtual bool StopTrackingSharedMemoryHandle(int id,
+                                              PP_Instance instance,
+                                              base::SharedMemoryHandle* handle,
+                                              uint32* size_in_bytes) OVERRIDE {
+    return false;
+  }
 };
 
 // Implementation of PpapiGlobals for tests that don't need either the host- or
@@ -29,7 +46,7 @@
 class TestGlobals : public PpapiGlobals {
  public:
   TestGlobals();
-  TestGlobals(PpapiGlobals::ForTest);
+  explicit TestGlobals(PpapiGlobals::PerThreadForTest);
   virtual ~TestGlobals();
 
   // PpapiGlobals implementation.
@@ -46,11 +63,11 @@
   virtual void PreCacheFontForFlash(const void* logfontw) OVERRIDE;
   virtual base::Lock* GetProxyLock() OVERRIDE;
   virtual void LogWithSource(PP_Instance instance,
-                             PP_LogLevel_Dev level,
+                             PP_LogLevel level,
                              const std::string& source,
                              const std::string& value) OVERRIDE;
   virtual void BroadcastLogWithSource(PP_Module module,
-                                      PP_LogLevel_Dev level,
+                                      PP_LogLevel level,
                                       const std::string& source,
                                       const std::string& value) OVERRIDE;
   virtual MessageLoopShared* GetCurrentMessageLoop() OVERRIDE;
diff --git a/ppapi/shared_impl/thread_aware_callback.cc b/ppapi/shared_impl/thread_aware_callback.cc
new file mode 100644
index 0000000..9b1063b
--- /dev/null
+++ b/ppapi/shared_impl/thread_aware_callback.cc
@@ -0,0 +1,63 @@
+// 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 "ppapi/shared_impl/thread_aware_callback.h"
+
+#include "base/callback.h"
+#include "base/logging.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/ppb_message_loop_shared.h"
+
+namespace ppapi {
+namespace internal {
+
+class ThreadAwareCallbackBase::Core : public base::RefCountedThreadSafe<Core> {
+ public:
+  Core() : aborted_(false) {
+  }
+
+  void MarkAsAborted() { aborted_ = true; }
+
+  void RunIfNotAborted(const base::Closure& closure) {
+    if (!aborted_)
+      CallWhileUnlocked(closure);
+  }
+
+ private:
+  friend class base::RefCountedThreadSafe<Core>;
+  ~Core() {
+  }
+
+  bool aborted_;
+};
+
+ThreadAwareCallbackBase::ThreadAwareCallbackBase()
+    : target_loop_(PpapiGlobals::Get()->GetCurrentMessageLoop()),
+      core_(new Core()) {
+  DCHECK(target_loop_.get());
+}
+
+ThreadAwareCallbackBase::~ThreadAwareCallbackBase() {
+  core_->MarkAsAborted();
+}
+
+// static
+bool ThreadAwareCallbackBase::HasTargetLoop() {
+  return !!PpapiGlobals::Get()->GetCurrentMessageLoop();
+}
+
+void ThreadAwareCallbackBase::InternalRunOnTargetThread(
+    const base::Closure& closure) {
+  if (target_loop_ != PpapiGlobals::Get()->GetCurrentMessageLoop()) {
+    target_loop_->PostClosure(
+        FROM_HERE,
+        RunWhileLocked(base::Bind(&Core::RunIfNotAborted, core_, closure)),
+        0);
+  } else {
+    CallWhileUnlocked(closure);
+  }
+}
+
+}  // namespace internal
+}  // namespace ppapi
diff --git a/ppapi/shared_impl/thread_aware_callback.h b/ppapi/shared_impl/thread_aware_callback.h
new file mode 100644
index 0000000..b954eec
--- /dev/null
+++ b/ppapi/shared_impl/thread_aware_callback.h
@@ -0,0 +1,115 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_SHARED_IMPL_THREAD_AWARE_CALLBACK_H_
+#define PPAPI_SHARED_IMPL_THREAD_AWARE_CALLBACK_H_
+
+#include "base/basictypes.h"
+#include "base/bind.h"
+#include "base/memory/ref_counted.h"
+#include "ppapi/shared_impl/ppapi_shared_export.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+
+namespace ppapi {
+
+class MessageLoopShared;
+
+namespace internal {
+
+class PPAPI_SHARED_EXPORT ThreadAwareCallbackBase {
+ protected:
+  ThreadAwareCallbackBase();
+  ~ThreadAwareCallbackBase();
+
+  static bool HasTargetLoop();
+
+  void InternalRunOnTargetThread(const base::Closure& closure);
+
+ private:
+  class Core;
+
+  scoped_refptr<MessageLoopShared> target_loop_;
+  scoped_refptr<Core> core_;
+
+  DISALLOW_COPY_AND_ASSIGN(ThreadAwareCallbackBase);
+};
+
+}  // namespace internal
+
+// Some PPB interfaces have methods that set a custom callback. Usually, the
+// callback has to be called on the same thread as the one it was set on.
+// ThreadAwareCallback keeps track of the target thread, and posts a task to run
+// on it if requested from a different thread.
+//
+// Please note that:
+// - Unlike TrackedCallback, there is no restriction on how many times the
+//   callback will be called.
+// - When a ThreadAwareCallback object is destroyed, all pending tasks to run
+//   the callback will be ignored. It is designed this way so that when the
+//   resource is destroyed or the callback is cancelled by the plugin, we can
+//   simply delete the ThreadAwareCallback object to prevent touching the
+//   callback later.
+// - When RunOnTargetThread() is called on the target thread, the callback runs
+//   immediately.
+template <class FuncType>
+class ThreadAwareCallback : public internal::ThreadAwareCallbackBase {
+ public:
+  // The caller takes ownership of the returned object.
+  // NULL is returned if the current thread doesn't have an associated Pepper
+  // message loop, or |func| is NULL.
+  static ThreadAwareCallback* Create(FuncType func) {
+    if (!func || !HasTargetLoop())
+      return NULL;
+    return new ThreadAwareCallback(func);
+  }
+
+  ~ThreadAwareCallback() {
+  }
+
+  void RunOnTargetThread() {
+    InternalRunOnTargetThread(base::Bind(func_));
+  }
+
+  template <class P1>
+  void RunOnTargetThread(const P1& p1) {
+    InternalRunOnTargetThread(base::Bind(func_, p1));
+  }
+
+  template <class P1, class P2>
+  void RunOnTargetThread(const P1& p1, const P2& p2) {
+    InternalRunOnTargetThread(base::Bind(func_, p1, p2));
+  }
+
+  template <class P1, class P2, class P3>
+  void RunOnTargetThread(const P1& p1, const P2& p2, const P3& p3) {
+    InternalRunOnTargetThread(base::Bind(func_, p1, p2, p3));
+  }
+
+  template <class P1, class P2, class P3, class P4>
+  void RunOnTargetThread(const P1& p1,
+                         const P2& p2,
+                         const P3& p3,
+                         const P4& p4) {
+    InternalRunOnTargetThread(base::Bind(func_, p1, p2, p3, p4));
+  }
+
+  template <class P1, class P2, class P3, class P4, class P5>
+  void RunOnTargetThread(const P1& p1,
+                         const P2& p2,
+                         const P3& p3,
+                         const P4& p4,
+                         const P5& p5) {
+    InternalRunOnTargetThread(base::Bind(func_, p1, p2, p3, p4, p5));
+  }
+
+ private:
+  explicit ThreadAwareCallback(FuncType func) : func_(func) {
+  }
+
+  FuncType func_;
+};
+
+}  // namespace ppapi
+
+#endif  // PPAPI_SHARED_IMPL_THREAD_AWARE_CALLBACK_H_
diff --git a/ppapi/shared_impl/thread_aware_callback_unittest.cc b/ppapi/shared_impl/thread_aware_callback_unittest.cc
new file mode 100644
index 0000000..f86048a
--- /dev/null
+++ b/ppapi/shared_impl/thread_aware_callback_unittest.cc
@@ -0,0 +1,218 @@
+// 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 "ppapi/shared_impl/thread_aware_callback.h"
+
+#include "base/bind_helpers.h"
+#include "base/compiler_specific.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/ppapi_proxy_test.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace ppapi {
+
+namespace {
+
+class TestParameter {
+ public:
+  TestParameter() : value_(0) {
+  }
+
+  int value_;
+};
+
+int called_num = 0;
+
+void TestCallback_0() {
+  ++called_num;
+}
+
+void TestCallback_1(int p1) {
+  ++called_num;
+}
+
+void TestCallback_2(int p1, const double* p2) {
+  ++called_num;
+}
+
+void TestCallback_3(int p1, const double* p2, bool* p3) {
+  ++called_num;
+}
+
+void TestCallback_4(int p1, const double* p2, bool* p3, TestParameter p4) {
+  ++called_num;
+}
+
+void TestCallback_5(int p1,
+                    const double* p2,
+                    bool* p3,
+                    TestParameter p4,
+                    const TestParameter& p5) {
+  ++called_num;
+}
+
+typedef proxy::PluginProxyTest ThreadAwareCallbackTest;
+
+// Test that a callback created on the main thread will run on the main thread,
+// even when requested from a different thread.
+class ThreadAwareCallbackMultiThreadTest
+    : public proxy::PluginProxyMultiThreadTest {
+ public:
+  ThreadAwareCallbackMultiThreadTest() : main_thread_callback_called_(false) {
+  }
+  virtual ~ThreadAwareCallbackMultiThreadTest() {
+    CHECK(main_thread_callback_called_);
+  }
+
+  // proxy::PluginProxyMultiThreadTest implementation.
+  virtual void SetUpTestOnMainThread() OVERRIDE {
+    ProxyAutoLock auto_lock;
+
+    main_thread_callback_.reset(
+        ThreadAwareCallback<CallbackFunc>::Create(&MainThreadCallbackBody));
+  }
+
+  virtual void SetUpTestOnSecondaryThread() OVERRIDE {
+    {
+      ProxyAutoLock auto_lock;
+      main_thread_callback_->RunOnTargetThread(this);
+    }
+
+    PostQuitForSecondaryThread();
+    PostQuitForMainThread();
+  }
+
+ private:
+  typedef void (*CallbackFunc)(ThreadAwareCallbackMultiThreadTest*);
+
+  static void MainThreadCallbackBody(ThreadAwareCallbackMultiThreadTest* thiz) {
+    thiz->CheckOnThread(MAIN_THREAD);
+    thiz->main_thread_callback_called_ = true;
+
+    {
+      ProxyAutoLock auto_lock;
+      // We have to destroy it prior to the PluginGlobals instance held by the
+      // base class. Otherwise it has a ref to Pepper message loop for the main
+      // thread and the PluginGlobals destructor will complain.
+      thiz->main_thread_callback_.reset(NULL);
+    }
+  }
+
+  scoped_ptr<ThreadAwareCallback<CallbackFunc> > main_thread_callback_;
+  bool main_thread_callback_called_;
+};
+
+// Test that when a ThreadAwareCallback instance is destroyed, pending tasks to
+// run the callback will be ignored.
+class ThreadAwareCallbackAbortTest : public proxy::PluginProxyMultiThreadTest {
+ public:
+  ThreadAwareCallbackAbortTest() {
+  }
+  virtual ~ThreadAwareCallbackAbortTest() {
+  }
+
+  // proxy::PluginProxyMultiThreadTest implementation.
+  virtual void SetUpTestOnMainThread() OVERRIDE {
+    ProxyAutoLock auto_lock;
+
+    main_thread_callback_.reset(
+        ThreadAwareCallback<CallbackFunc>::Create(&MainThreadCallbackBody));
+  }
+
+  virtual void SetUpTestOnSecondaryThread() OVERRIDE {
+    {
+      ProxyAutoLock auto_lock;
+      main_thread_message_loop_proxy_->PostTask(
+          FROM_HERE,
+          base::Bind(&ThreadAwareCallbackAbortTest::DeleteCallback,
+                     base::Unretained(this)));
+      // |main_thread_callback_| is still valid, even if DeleteCallback() can be
+      // called before this following statement. That is because |auto_lock| is
+      // still held by this method, which prevents DeleteCallback() from
+      // deleting the callback.
+      main_thread_callback_->RunOnTargetThread(this);
+    }
+
+    PostQuitForSecondaryThread();
+    PostQuitForMainThread();
+  }
+
+ private:
+  typedef void (*CallbackFunc)(ThreadAwareCallbackAbortTest*);
+
+  static void MainThreadCallbackBody(ThreadAwareCallbackAbortTest* thiz) {
+    // The callback should not be called.
+    ASSERT_TRUE(false);
+  }
+
+  void DeleteCallback() {
+    ProxyAutoLock auto_lock;
+    main_thread_callback_.reset(NULL);
+  }
+
+  scoped_ptr<ThreadAwareCallback<CallbackFunc> > main_thread_callback_;
+};
+
+}  // namespace
+
+TEST_F(ThreadAwareCallbackTest, Basics) {
+  // ThreadAwareCallback should only be used when the proxy lock has been
+  // acquired.
+  ProxyAutoLock auto_lock;
+
+  double double_arg = 0.0;
+  bool bool_arg = false;
+  TestParameter object_arg;
+
+  // Exercise all the template code.
+  called_num = 0;
+  typedef void (*FuncType_0)();
+  scoped_ptr<ThreadAwareCallback<FuncType_0> > callback_0(
+      ThreadAwareCallback<FuncType_0>::Create(TestCallback_0));
+  callback_0->RunOnTargetThread();
+
+  typedef void (*FuncType_1)(int);
+  scoped_ptr<ThreadAwareCallback<FuncType_1> > callback_1(
+      ThreadAwareCallback<FuncType_1>::Create(TestCallback_1));
+  callback_1->RunOnTargetThread(1);
+
+  typedef void (*FuncType_2)(int, const double*);
+  scoped_ptr<ThreadAwareCallback<FuncType_2> > callback_2(
+      ThreadAwareCallback<FuncType_2>::Create(TestCallback_2));
+  callback_2->RunOnTargetThread(1, &double_arg);
+
+  typedef void (*FuncType_3)(int, const double*, bool*);
+  scoped_ptr<ThreadAwareCallback<FuncType_3> > callback_3(
+      ThreadAwareCallback<FuncType_3>::Create(TestCallback_3));
+  callback_3->RunOnTargetThread(1, &double_arg, &bool_arg);
+
+  typedef void (*FuncType_4)(int, const double*, bool*, TestParameter);
+  scoped_ptr<ThreadAwareCallback<FuncType_4> > callback_4(
+      ThreadAwareCallback<FuncType_4>::Create(TestCallback_4));
+  callback_4->RunOnTargetThread(1, &double_arg, &bool_arg, object_arg);
+
+  typedef void (*FuncType_5)(int,
+                             const double*,
+                             bool*,
+                             TestParameter,
+                             const TestParameter&);
+  scoped_ptr<ThreadAwareCallback<FuncType_5> > callback_5(
+      ThreadAwareCallback<FuncType_5>::Create(TestCallback_5));
+  callback_5->RunOnTargetThread(1, &double_arg, &bool_arg, object_arg,
+                               object_arg);
+
+  EXPECT_EQ(6, called_num);
+}
+
+TEST_F(ThreadAwareCallbackMultiThreadTest, RunOnTargetThread) {
+  RunTest();
+}
+
+TEST_F(ThreadAwareCallbackAbortTest, NotRunIfAborted) {
+  RunTest();
+}
+
+}  // namespace ppapi
diff --git a/ppapi/shared_impl/time_conversion.cc b/ppapi/shared_impl/time_conversion.cc
index 53d7b99..27ea494 100644
--- a/ppapi/shared_impl/time_conversion.cc
+++ b/ppapi/shared_impl/time_conversion.cc
@@ -30,6 +30,12 @@
 }
 
 base::Time PPTimeToTime(PP_Time t) {
+  // The time code handles exact "0" values as special, and produces
+  // a "null" Time object. But calling code would expect t==0 to represent the
+  // epoch (according to the description of PP_Time). Hence we just return the
+  // epoch in this case.
+  if (t == 0.0)
+    return base::Time::UnixEpoch();
   return base::Time::FromDoubleT(t);
 }
 
@@ -46,4 +52,20 @@
   return t - GetTimeToTimeTicksDeltaInSeconds();
 }
 
+double PPGetLocalTimeZoneOffset(const base::Time& time) {
+  // Explode it to local time and then unexplode it as if it were UTC. Also
+  // explode it to UTC and unexplode it (this avoids mismatching rounding or
+  // lack thereof). The time zone offset is their difference.
+  base::Time::Exploded exploded = { 0 };
+  base::Time::Exploded utc_exploded = { 0 };
+  time.LocalExplode(&exploded);
+  time.UTCExplode(&utc_exploded);
+  if (exploded.HasValidValues() && utc_exploded.HasValidValues()) {
+    base::Time adj_time = base::Time::FromUTCExploded(exploded);
+    base::Time cur = base::Time::FromUTCExploded(utc_exploded);
+    return (adj_time - cur).InSecondsF();
+  }
+  return 0.0;
+}
+
 }  // namespace ppapi
diff --git a/ppapi/shared_impl/time_conversion.h b/ppapi/shared_impl/time_conversion.h
index 0acd39e..e20d809 100644
--- a/ppapi/shared_impl/time_conversion.h
+++ b/ppapi/shared_impl/time_conversion.h
@@ -23,6 +23,11 @@
 PPAPI_SHARED_EXPORT PP_TimeTicks EventTimeToPPTimeTicks(double event_time);
 PPAPI_SHARED_EXPORT double PPTimeTicksToEventTime(PP_TimeTicks t);
 
+// Gets the local time zone offset for a given time. This works in the plugin
+// process only on Windows (the sandbox prevents this from working properly on
+// other platforms).
+PPAPI_SHARED_EXPORT double PPGetLocalTimeZoneOffset(const base::Time& time);
+
 }  // namespace ppapi
 
 #endif  // PPAPI_SHARED_IMPL_TIME_CONVERSION_H_
diff --git a/ppapi/shared_impl/time_conversion_unittest.cc b/ppapi/shared_impl/time_conversion_unittest.cc
new file mode 100644
index 0000000..1ec70bf
--- /dev/null
+++ b/ppapi/shared_impl/time_conversion_unittest.cc
@@ -0,0 +1,73 @@
+// 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 <math.h>
+#include <stdlib.h>
+
+#include "ppapi/shared_impl/time_conversion.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace ppapi {
+
+// Slop we'll allow in two Time "internal values" to consider them equal.
+// Double conversion can introduce rounding errors. The internal values are in
+// microseconds, so an error here is very small.
+static const int kTimeInternalValueSlop = 2;
+
+// Same as above in double-precision seconds units.
+static const double kTimeSecondsSlop =
+    static_cast<double>(kTimeInternalValueSlop) /
+    base::Time::kMicrosecondsPerSecond;
+
+TEST(TimeConversion, Time) {
+  // Should be able to round-trip.
+  base::Time now = base::Time::Now();
+  base::Time converted = ppapi::PPTimeToTime(TimeToPPTime(now));
+  EXPECT_GE(kTimeInternalValueSlop,
+            abs(static_cast<int>((converted - now).ToInternalValue())));
+
+  // Units should be in seconds.
+  base::Time one_second_from_now = now + base::TimeDelta::FromSeconds(1);
+  double converted_one_second_from_now =
+      ppapi::TimeToPPTime(one_second_from_now) - ppapi::TimeToPPTime(now);
+  EXPECT_GE(kTimeSecondsSlop, fabs(converted_one_second_from_now - 1));
+}
+
+TEST(TimeConversion, EventTime) {
+  // Should be able to round-trip.
+  base::Time now = base::Time::Now();
+  double event_now = now.ToDoubleT();
+  double converted =
+      ppapi::EventTimeToPPTimeTicks(ppapi::PPTimeTicksToEventTime(event_now));
+  EXPECT_GE(kTimeSecondsSlop, fabs(converted - event_now));
+
+  // Units should be in seconds.
+  base::Time one_second_from_now = now + base::TimeDelta::FromSeconds(1);
+  double event_one_second_from_now = one_second_from_now.ToDoubleT();
+  EXPECT_GE(kTimeSecondsSlop,
+            1.0 - ppapi::EventTimeToPPTimeTicks(event_one_second_from_now) -
+                ppapi::EventTimeToPPTimeTicks(event_now));
+}
+
+TEST(TimeConversion, EpochTime) {
+  // Should be able to round-trip from epoch time.
+  base::Time epoch = base::Time::UnixEpoch();
+  base::Time converted = ppapi::PPTimeToTime(TimeToPPTime(epoch));
+  EXPECT_GE(kTimeInternalValueSlop,
+            abs(static_cast<int>((converted - epoch).ToInternalValue())));
+
+  // Units should be in seconds.
+  base::Time one_second_from_epoch = epoch + base::TimeDelta::FromSeconds(1);
+  double converted_one_second_from_epoch =
+      ppapi::TimeToPPTime(one_second_from_epoch) - ppapi::TimeToPPTime(epoch);
+  EXPECT_GE(kTimeSecondsSlop, fabs(converted_one_second_from_epoch - 1));
+
+  // Epoch time should be equal to a PP_Time of 0.0.
+  EXPECT_GE(kTimeSecondsSlop, fabs(ppapi::TimeToPPTime(epoch) - 0.0));
+  EXPECT_GE(kTimeInternalValueSlop,
+            abs(static_cast<int>(
+                (ppapi::PPTimeToTime(0.0) - epoch).ToInternalValue())));
+}
+
+}  // namespace ppapi
diff --git a/ppapi/shared_impl/tracked_callback.cc b/ppapi/shared_impl/tracked_callback.cc
index bd011df..ae4656e 100644
--- a/ppapi/shared_impl/tracked_callback.cc
+++ b/ppapi/shared_impl/tracked_callback.cc
@@ -9,9 +9,9 @@
 #include "base/logging.h"
 #include "base/message_loop.h"
 #include "base/synchronization/lock.h"
-#include "ppapi/c/dev/ppb_message_loop_dev.h"
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_message_loop.h"
 #include "ppapi/shared_impl/callback_tracker.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
 #include "ppapi/shared_impl/ppb_message_loop_shared.h"
diff --git a/ppapi/shared_impl/tracked_callback_unittest.cc b/ppapi/shared_impl/tracked_callback_unittest.cc
index ca4d3b1..bc1c7f3 100644
--- a/ppapi/shared_impl/tracked_callback_unittest.cc
+++ b/ppapi/shared_impl/tracked_callback_unittest.cc
@@ -220,18 +220,18 @@
   // Kill resource #1, spin the message loop to run posted calls, and check that
   // things are in the expected states.
   resource_tracker->ReleaseResource(resource_1_id);
-  MessageLoop::current()->RunAllPending();
+  MessageLoop::current()->RunUntilIdle();
   resource_1->CheckFinalState();
   resource_2->CheckIntermediateState();
 
   // Kill resource #2.
   resource_tracker->ReleaseResource(resource_2_id);
-  MessageLoop::current()->RunAllPending();
+  MessageLoop::current()->RunUntilIdle();
   resource_1->CheckFinalState();
   resource_2->CheckFinalState();
 
   // This shouldn't be needed, but make sure there are no stranded tasks.
-  MessageLoop::current()->RunAllPending();
+  MessageLoop::current()->RunUntilIdle();
 }
 
 // Test that "resurrecting" a resource (getting a new ID for a |Resource|)
@@ -247,21 +247,21 @@
   // Unref it, spin the message loop to run posted calls, and check that things
   // are in the expected states.
   resource_tracker->ReleaseResource(resource_id);
-  MessageLoop::current()->RunAllPending();
+  MessageLoop::current()->RunUntilIdle();
   resource->CheckFinalState();
 
   // "Resurrect" it and check that the callbacks are still dead.
   PP_Resource new_resource_id = resource->GetReference();
-  MessageLoop::current()->RunAllPending();
+  MessageLoop::current()->RunUntilIdle();
   resource->CheckFinalState();
 
   // Unref it again and do the same.
   resource_tracker->ReleaseResource(new_resource_id);
-  MessageLoop::current()->RunAllPending();
+  MessageLoop::current()->RunUntilIdle();
   resource->CheckFinalState();
 
   // This shouldn't be needed, but make sure there are no stranded tasks.
-  MessageLoop::current()->RunAllPending();
+  MessageLoop::current()->RunUntilIdle();
 }
 
 }  // namespace ppapi
diff --git a/ppapi/shared_impl/url_response_info_data.cc b/ppapi/shared_impl/url_response_info_data.cc
new file mode 100644
index 0000000..0b4b078
--- /dev/null
+++ b/ppapi/shared_impl/url_response_info_data.cc
@@ -0,0 +1,15 @@
+// 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 "ppapi/shared_impl/url_response_info_data.h"
+
+namespace ppapi {
+
+URLResponseInfoData::URLResponseInfoData() : status_code(-1) {
+}
+
+URLResponseInfoData::~URLResponseInfoData() {
+}
+
+}  // namespace ppapi
diff --git a/ppapi/shared_impl/url_response_info_data.h b/ppapi/shared_impl/url_response_info_data.h
new file mode 100644
index 0000000..a40ca50
--- /dev/null
+++ b/ppapi/shared_impl/url_response_info_data.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_SHARED_IMPL_URL_RESPONSE_INFO_DATA_H_
+#define PPAPI_SHARED_IMPL_URL_RESPONSE_INFO_DATA_H_
+
+#include <string>
+
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/shared_impl/ppb_file_ref_shared.h"
+#include "ppapi/shared_impl/ppapi_shared_export.h"
+
+namespace ppapi {
+
+struct PPAPI_SHARED_EXPORT URLResponseInfoData {
+  URLResponseInfoData();
+  ~URLResponseInfoData();
+
+  std::string url;
+  std::string headers;
+  int32_t status_code;
+  std::string status_text;
+  std::string redirect_url;
+
+  // Nonzero when streaming to a file.
+  PPB_FileRef_CreateInfo body_as_file_ref;
+};
+
+}  // namespace ppapi
+
+#endif  // PPAPI_SHARED_IMPL_URL_RESPONSE_INFO_DATA_H_
diff --git a/ppapi/shared_impl/var.cc b/ppapi/shared_impl/var.cc
index 2e63dbe..0aff583 100644
--- a/ppapi/shared_impl/var.cc
+++ b/ppapi/shared_impl/var.cc
@@ -56,6 +56,12 @@
     }
     case PP_VARTYPE_OBJECT:
       return "[Object]";
+    case PP_VARTYPE_ARRAY:
+      return "[Array]";
+    case PP_VARTYPE_DICTIONARY:
+      return "[Dictionary]";
+    case PP_VARTYPE_ARRAY_BUFFER:
+      return "[Array buffer]";
     default:
       return "[Invalid var]";
   }
@@ -77,6 +83,14 @@
   return NULL;
 }
 
+ArrayVar* Var::AsArrayVar() {
+  return NULL;
+}
+
+DictionaryVar* Var::AsDictionaryVar() {
+  return NULL;
+}
+
 PP_Var Var::GetPPVar() {
   int32 id = GetOrCreateVarID();
   if (!id)
diff --git a/ppapi/shared_impl/var.h b/ppapi/shared_impl/var.h
index 77f707c..50c13b9 100644
--- a/ppapi/shared_impl/var.h
+++ b/ppapi/shared_impl/var.h
@@ -9,12 +9,17 @@
 
 #include "base/compiler_specific.h"
 #include "base/memory/ref_counted.h"
+#include "base/platform_file.h"
+#include "base/shared_memory.h"
 #include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/host_resource.h"
 #include "ppapi/shared_impl/ppapi_shared_export.h"
 
 namespace ppapi {
 
 class ArrayBufferVar;
+class ArrayVar;
+class DictionaryVar;
 class NPObjectVar;
 class ProxyObjectVar;
 class StringVar;
@@ -34,6 +39,8 @@
   virtual ArrayBufferVar* AsArrayBufferVar();
   virtual NPObjectVar* AsNPObjectVar();
   virtual ProxyObjectVar* AsProxyObjectVar();
+  virtual ArrayVar* AsArrayVar();
+  virtual DictionaryVar* AsDictionaryVar();
 
   // Creates a PP_Var corresponding to this object. The return value will have
   // one reference addrefed on behalf of the caller.
@@ -156,6 +163,18 @@
   virtual void Unmap() = 0;
   virtual uint32 ByteLength() = 0;
 
+  // Creates a new shared memory region, and copies the data in the
+  // ArrayBufferVar into it. On the plugin side, host_shm_handle_id will be set
+  // to some value that is not -1. On the host side, plugin_shm_handle will be
+  // set to a valid SharedMemoryHandle.
+  //
+  // Returns true if creating the shared memory (and copying) is successful,
+  // false otherwise.
+  virtual bool CopyToNewShmem(
+      PP_Instance instance,
+      int *host_shm_handle_id,
+      base::SharedMemoryHandle *plugin_shm_handle) = 0;
+
   // Var override.
   virtual ArrayBufferVar* AsArrayBufferVar() OVERRIDE;
   virtual PP_VarType GetType() const OVERRIDE;
diff --git a/ppapi/shared_impl/var_tracker.cc b/ppapi/shared_impl/var_tracker.cc
index 8214a30..434121e 100644
--- a/ppapi/shared_impl/var_tracker.cc
+++ b/ppapi/shared_impl/var_tracker.cc
@@ -9,7 +9,10 @@
 #include <limits>
 
 #include "base/logging.h"
+#include "base/shared_memory.h"
+#include "ppapi/shared_impl/host_resource.h"
 #include "ppapi/shared_impl/id_assignment.h"
+#include "ppapi/shared_impl/proxy_lock.h"
 #include "ppapi/shared_impl/var.h"
 
 namespace ppapi {
@@ -34,12 +37,14 @@
 
 int32 VarTracker::AddVar(Var* var) {
   DCHECK(CalledOnValidThread());
+  ProxyLock::AssertAcquired();
 
   return AddVarInternal(var, ADD_VAR_TAKE_ONE_REFERENCE);
 }
 
 Var* VarTracker::GetVar(int32 var_id) const {
   DCHECK(CalledOnValidThread());
+  ProxyLock::AssertAcquired();
 
   VarMap::const_iterator result = live_vars_.find(var_id);
   if (result == live_vars_.end())
@@ -49,6 +54,7 @@
 
 Var* VarTracker::GetVar(const PP_Var& var) const {
   DCHECK(CalledOnValidThread());
+  ProxyLock::AssertAcquired();
 
   if (!IsVarTypeRefcounted(var.type))
     return NULL;
@@ -57,6 +63,7 @@
 
 bool VarTracker::AddRefVar(int32 var_id) {
   DCHECK(CalledOnValidThread());
+  ProxyLock::AssertAcquired();
 
   DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR))
       << var_id << " is not a PP_Var ID.";
@@ -82,14 +89,16 @@
 
 bool VarTracker::AddRefVar(const PP_Var& var) {
   DCHECK(CalledOnValidThread());
+  ProxyLock::AssertAcquired();
 
   if (!IsVarTypeRefcounted(var.type))
-    return false;
+    return true;
   return AddRefVar(static_cast<int32>(var.value.as_id));
 }
 
 bool VarTracker::ReleaseVar(int32 var_id) {
   DCHECK(CalledOnValidThread());
+  ProxyLock::AssertAcquired();
 
   DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR))
       << var_id << " is not a PP_Var ID.";
@@ -121,6 +130,7 @@
 
 bool VarTracker::ReleaseVar(const PP_Var& var) {
   DCHECK(CalledOnValidThread());
+  ProxyLock::AssertAcquired();
 
   if (!IsVarTypeRefcounted(var.type))
     return false;
@@ -145,6 +155,7 @@
 
 int VarTracker::GetRefCountForObject(const PP_Var& plugin_object) {
   DCHECK(CalledOnValidThread());
+  ProxyLock::AssertAcquired();
 
   VarMap::iterator found = GetLiveVar(plugin_object);
   if (found == live_vars_.end())
@@ -155,6 +166,7 @@
 int VarTracker::GetTrackedWithNoReferenceCountForObject(
     const PP_Var& plugin_object) {
   DCHECK(CalledOnValidThread());
+  ProxyLock::AssertAcquired();
 
   VarMap::iterator found = GetLiveVar(plugin_object);
   if (found == live_vars_.end())
@@ -177,6 +189,7 @@
 
 PP_Var VarTracker::MakeArrayBufferPPVar(uint32 size_in_bytes) {
   DCHECK(CalledOnValidThread());
+  ProxyLock::AssertAcquired();
 
   scoped_refptr<ArrayBufferVar> array_buffer(CreateArrayBuffer(size_in_bytes));
   if (!array_buffer)
@@ -187,16 +200,38 @@
 PP_Var VarTracker::MakeArrayBufferPPVar(uint32 size_in_bytes,
                                         const void* data) {
   DCHECK(CalledOnValidThread());
+  ProxyLock::AssertAcquired();
 
-  scoped_refptr<ArrayBufferVar> array_buffer(CreateArrayBuffer(size_in_bytes));
+  ArrayBufferVar* array_buffer = MakeArrayBufferVar(size_in_bytes, data);
+  return array_buffer ? array_buffer->GetPPVar() : PP_MakeNull();
+}
+
+ArrayBufferVar* VarTracker::MakeArrayBufferVar(uint32 size_in_bytes,
+                                               const void* data) {
+  DCHECK(CalledOnValidThread());
+  ProxyLock::AssertAcquired();
+
+  ArrayBufferVar* array_buffer(CreateArrayBuffer(size_in_bytes));
+  if (!array_buffer)
+    return NULL;
+  memcpy(array_buffer->Map(), data, size_in_bytes);
+  return array_buffer;
+}
+
+PP_Var VarTracker::MakeArrayBufferPPVar(uint32 size_in_bytes,
+                                        base::SharedMemoryHandle handle) {
+  DCHECK(CalledOnValidThread());
+
+  scoped_refptr<ArrayBufferVar> array_buffer(
+      CreateShmArrayBuffer(size_in_bytes, handle));
   if (!array_buffer)
     return PP_MakeNull();
-  memcpy(array_buffer->Map(), data, size_in_bytes);
   return array_buffer->GetPPVar();
 }
 
 std::vector<PP_Var> VarTracker::GetLiveVars() {
   DCHECK(CalledOnValidThread());
+  ProxyLock::AssertAcquired();
 
   std::vector<PP_Var> var_vector;
   var_vector.reserve(live_vars_.size());
diff --git a/ppapi/shared_impl/var_tracker.h b/ppapi/shared_impl/var_tracker.h
index b873250..32acdeb 100644
--- a/ppapi/shared_impl/var_tracker.h
+++ b/ppapi/shared_impl/var_tracker.h
@@ -10,10 +10,13 @@
 #include "base/basictypes.h"
 #include "base/hash_tables.h"
 #include "base/memory/ref_counted.h"
+#include "base/shared_memory.h"
 #include "base/threading/non_thread_safe.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_module.h"
+#include "ppapi/c/pp_resource.h"
 #include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/host_resource.h"
 #include "ppapi/shared_impl/ppapi_shared_export.h"
 
 namespace ppapi {
@@ -72,6 +75,16 @@
   PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes);
   // Same as above, but copy the contents of |data| in to the new array buffer.
   PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes, const void* data);
+  // Same as above, but copy the contents of the shared memory in |h|
+  // into the new array buffer.
+  PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes,
+                              base::SharedMemoryHandle h);
+
+  // Create an ArrayBuffer and copy the contents of |data| in to it. The
+  // returned object has 0 reference count in the tracker, and like all
+  // RefCounted objects, has a 0 initial internal reference count. (You should
+  // usually immediately put this in a scoped_refptr).
+  ArrayBufferVar* MakeArrayBufferVar(uint32 size_in_bytes, const void* data);
 
   // Return a vector containing all PP_Vars that are in the tracker. This is
   // to help implement PPB_Testing_Dev.GetLiveVars and should generally not be
@@ -88,6 +101,22 @@
   // Called after an instance is deleted to do var cleanup.
   virtual void DidDeleteInstance(PP_Instance instance) = 0;
 
+  // Returns an "id" for a shared memory handle that can be safely sent between
+  // the host and plugin, and resolved back into the original handle on the
+  // host. Not implemented on the plugin side.
+  virtual int TrackSharedMemoryHandle(PP_Instance instance,
+                                      base::SharedMemoryHandle handle,
+                                      uint32 size_in_bytes) = 0;
+
+  // Resolves an "id" generated by TrackSharedMemoryHandle back into
+  // a SharedMemory handle and its size on the host.
+  // Not implemented on the plugin side.
+  virtual bool StopTrackingSharedMemoryHandle(
+      int id,
+      PP_Instance instance,
+      base::SharedMemoryHandle *handle,
+      uint32* size_in_bytes) = 0;
+
  protected:
   struct VarInfo {
     VarInfo();
@@ -165,6 +194,9 @@
   // implemented by the Host and Plugin tracker separately, so that it can be
   // a real WebKit ArrayBuffer on the host side.
   virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) = 0;
+  virtual ArrayBufferVar* CreateShmArrayBuffer(
+      uint32 size_in_bytes,
+      base::SharedMemoryHandle handle) = 0;
 
   DISALLOW_COPY_AND_ASSIGN(VarTracker);
 };
diff --git a/ppapi/shared_impl/var_value_conversions.cc b/ppapi/shared_impl/var_value_conversions.cc
new file mode 100644
index 0000000..614002a
--- /dev/null
+++ b/ppapi/shared_impl/var_value_conversions.cc
@@ -0,0 +1,344 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/shared_impl/var_value_conversions.h"
+
+#include <limits>
+#include <set>
+#include <stack>
+
+#include "base/logging.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/stl_util.h"
+#include "base/values.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/shared_impl/array_var.h"
+#include "ppapi/shared_impl/dictionary_var.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/scoped_pp_var.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/shared_impl/var_tracker.h"
+
+namespace ppapi {
+
+namespace {
+
+// In CreateValueFromVar(), a stack is used to keep track of conversion progress
+// of array and dictionary vars. VarNode represents elements of that stack.
+struct VarNode {
+  VarNode(const PP_Var& in_var, base::Value* in_value)
+      : var(in_var),
+        value(in_value),
+        sentinel(false) {
+  }
+
+  // This object doesn't hold a reference to it.
+  PP_Var var;
+  // It is not owned by this object.
+  base::Value* value;
+  // When this is set to true for a node in the stack, it means that we have
+  // finished processing the node itself. However, we keep it in the stack as
+  // a sentinel. When it becomes the top element of the stack again, we know
+  // that we have processed all the descendants of this node.
+  bool sentinel;
+};
+
+// In CreateVarFromValue(), a stack is used to keep track of conversion progress
+// of list and dictionary values. ValueNode represents elements of that stack.
+struct ValueNode {
+  ValueNode(const PP_Var& in_var, const base::Value* in_value)
+      : var(in_var),
+        value(in_value) {
+  }
+
+  // This object doesn't hold a reference to it.
+  PP_Var var;
+  // It is not owned by this object.
+  const base::Value* value;
+};
+
+// Helper function for CreateValueFromVar(). It only looks at |var| but not its
+// descendants. The conversion result is stored in |value|. If |var| is array or
+// dictionary, a new node is pushed onto |state|.
+//
+// Returns false on failure.
+bool CreateValueFromVarHelper(const std::set<int64_t>& parent_ids,
+                              const PP_Var& var,
+                              scoped_ptr<base::Value>* value,
+                              std::stack<VarNode>* state) {
+  switch (var.type) {
+    case PP_VARTYPE_UNDEFINED:
+    case PP_VARTYPE_NULL: {
+      value->reset(base::Value::CreateNullValue());
+      return true;
+    }
+    case PP_VARTYPE_BOOL: {
+      value->reset(new base::FundamentalValue(PP_ToBool(var.value.as_bool)));
+      return true;
+    }
+    case PP_VARTYPE_INT32: {
+      value->reset(new base::FundamentalValue(var.value.as_int));
+      return true;
+    }
+    case PP_VARTYPE_DOUBLE: {
+      value->reset(new base::FundamentalValue(var.value.as_double));
+      return true;
+    }
+    case PP_VARTYPE_STRING: {
+      StringVar* string_var = StringVar::FromPPVar(var);
+      if (!string_var)
+        return false;
+
+      value->reset(new base::StringValue(string_var->value()));
+      return true;
+    }
+    case PP_VARTYPE_OBJECT: {
+      return false;
+    }
+    case PP_VARTYPE_ARRAY: {
+      if (ContainsKey(parent_ids, var.value.as_id)) {
+        // A circular reference is found.
+        return false;
+      }
+
+      value->reset(new base::ListValue());
+      state->push(VarNode(var, value->get()));
+      return true;
+    }
+    case PP_VARTYPE_DICTIONARY: {
+      if (ContainsKey(parent_ids, var.value.as_id)) {
+        // A circular reference is found.
+        return false;
+      }
+
+      value->reset(new base::DictionaryValue());
+      state->push(VarNode(var, value->get()));
+      return true;
+    }
+    case PP_VARTYPE_ARRAY_BUFFER: {
+      ArrayBufferVar* array_buffer = ArrayBufferVar::FromPPVar(var);
+      if (!array_buffer)
+        return false;
+
+      base::BinaryValue* binary_value =
+          base::BinaryValue::CreateWithCopiedBuffer(
+              static_cast<const char*>(array_buffer->Map()),
+              array_buffer->ByteLength());
+      array_buffer->Unmap();
+      value->reset(binary_value);
+      return true;
+    }
+  }
+  NOTREACHED();
+  return false;
+}
+
+// Helper function for CreateVarFromValue(). It only looks at |value| but not
+// its descendants. The conversion result is stored in |var|. If |value| is list
+// or dictionary, a new node is pushed onto |state|.
+//
+// Returns false on failure.
+bool CreateVarFromValueHelper(const base::Value& value,
+                              ScopedPPVar* var,
+                              std::stack<ValueNode>* state) {
+  switch (value.GetType()) {
+    case base::Value::TYPE_NULL: {
+      *var = PP_MakeNull();
+      return true;
+    }
+    case base::Value::TYPE_BOOLEAN: {
+      bool result = false;
+      if (value.GetAsBoolean(&result)) {
+        *var = PP_MakeBool(PP_FromBool(result));
+        return true;
+      }
+      return false;
+    }
+    case base::Value::TYPE_INTEGER: {
+      int result = 0;
+      if (value.GetAsInteger(&result)) {
+        *var = PP_MakeInt32(result);
+        return true;
+      }
+      return false;
+    }
+    case base::Value::TYPE_DOUBLE: {
+      double result = 0;
+      if (value.GetAsDouble(&result)) {
+        *var = PP_MakeDouble(result);
+        return true;
+      }
+      return false;
+    }
+    case base::Value::TYPE_STRING: {
+      std::string result;
+      if (value.GetAsString(&result)) {
+        *var = ScopedPPVar(ScopedPPVar::PassRef(),
+                           StringVar::StringToPPVar(result));
+        return true;
+      }
+      return false;
+    }
+    case base::Value::TYPE_BINARY: {
+      const base::BinaryValue& binary_value =
+          static_cast<const base::BinaryValue&>(value);
+
+      size_t size = binary_value.GetSize();
+      if (size > std::numeric_limits<uint32>::max())
+        return false;
+
+      ScopedPPVar temp(
+          ScopedPPVar::PassRef(),
+          PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
+              static_cast<uint32>(size), binary_value.GetBuffer()));
+      if (temp.get().type == PP_VARTYPE_ARRAY_BUFFER) {
+        *var = temp;
+        return true;
+      }
+      return false;
+    }
+    case base::Value::TYPE_DICTIONARY: {
+      scoped_refptr<DictionaryVar> dict_var(new DictionaryVar());
+      *var = ScopedPPVar(ScopedPPVar::PassRef(), dict_var->GetPPVar());
+      state->push(ValueNode(var->get(), &value));
+      return true;
+    }
+    case base::Value::TYPE_LIST: {
+      scoped_refptr<ArrayVar> array_var(new ArrayVar());
+      *var = ScopedPPVar(ScopedPPVar::PassRef(), array_var->GetPPVar());
+      state->push(ValueNode(var->get(), &value));
+      return true;
+    }
+  }
+  NOTREACHED();
+  return false;
+}
+
+}  // namespace
+
+base::Value* CreateValueFromVar(const PP_Var& var) {
+  // Used to detect circular references.
+  std::set<int64_t> parent_ids;
+  std::stack<VarNode> state;
+  scoped_ptr<base::Value> root_value;
+
+  if (!CreateValueFromVarHelper(parent_ids, var, &root_value, &state))
+    return NULL;
+
+  while (!state.empty()) {
+    VarNode& top = state.top();
+    if (top.sentinel) {
+      parent_ids.erase(top.var.value.as_id);
+      state.pop();
+    } else if (top.var.type == PP_VARTYPE_DICTIONARY) {
+      parent_ids.insert(top.var.value.as_id);
+      top.sentinel = true;
+
+      DictionaryVar* dict_var = DictionaryVar::FromPPVar(top.var);
+      if (!dict_var)
+        return NULL;
+
+      DCHECK(top.value->GetType() == base::Value::TYPE_DICTIONARY);
+      base::DictionaryValue* dict_value =
+          static_cast<base::DictionaryValue*>(top.value);
+
+      for (DictionaryVar::KeyValueMap::const_iterator iter =
+               dict_var->key_value_map().begin();
+           iter != dict_var->key_value_map().end();
+           ++iter) {
+        // Skip the key-value pair if the value is undefined.
+        if (iter->second.get().type == PP_VARTYPE_UNDEFINED)
+          continue;
+
+        scoped_ptr<base::Value> child_value;
+        if (!CreateValueFromVarHelper(parent_ids, iter->second.get(),
+                                      &child_value, &state)) {
+          return NULL;
+        }
+
+        dict_value->SetWithoutPathExpansion(iter->first, child_value.release());
+      }
+    } else if (top.var.type == PP_VARTYPE_ARRAY) {
+      parent_ids.insert(top.var.value.as_id);
+      top.sentinel = true;
+
+      ArrayVar* array_var = ArrayVar::FromPPVar(top.var);
+      if (!array_var)
+        return NULL;
+
+      DCHECK(top.value->GetType() == base::Value::TYPE_LIST);
+      base::ListValue* list_value = static_cast<base::ListValue*>(top.value);
+
+      for (ArrayVar::ElementVector::const_iterator iter =
+               array_var->elements().begin();
+           iter != array_var->elements().end();
+           ++iter) {
+        scoped_ptr<base::Value> child_value;
+        if (!CreateValueFromVarHelper(parent_ids, iter->get(), &child_value,
+                                      &state)) {
+          return NULL;
+        }
+
+        list_value->Append(child_value.release());
+      }
+    } else {
+      NOTREACHED();
+      return NULL;
+    }
+  }
+  DCHECK(parent_ids.empty());
+  return root_value.release();
+}
+
+PP_Var CreateVarFromValue(const base::Value& value) {
+  std::stack<ValueNode> state;
+  ScopedPPVar root_var;
+
+  if (!CreateVarFromValueHelper(value, &root_var, &state))
+    return PP_MakeUndefined();
+
+  while (!state.empty()) {
+    ValueNode top = state.top();
+    state.pop();
+
+    if (top.value->GetType() == base::Value::TYPE_DICTIONARY) {
+      const base::DictionaryValue* dict_value =
+          static_cast<const base::DictionaryValue*>(top.value);
+      DictionaryVar* dict_var = DictionaryVar::FromPPVar(top.var);
+      DCHECK(dict_var);
+      for (base::DictionaryValue::Iterator iter(*dict_value);
+           !iter.IsAtEnd();
+           iter.Advance()) {
+        ScopedPPVar child_var;
+        if (!CreateVarFromValueHelper(iter.value(), &child_var, &state) ||
+            !dict_var->SetWithStringKey(iter.key(), child_var.get())) {
+          return PP_MakeUndefined();
+        }
+      }
+    } else if (top.value->GetType() == base::Value::TYPE_LIST) {
+      const base::ListValue* list_value =
+          static_cast<const base::ListValue*>(top.value);
+      ArrayVar* array_var = ArrayVar::FromPPVar(top.var);
+      DCHECK(array_var);
+      for (base::ListValue::const_iterator iter = list_value->begin();
+           iter != list_value->end();
+           ++iter) {
+        ScopedPPVar child_var;
+        if (!CreateVarFromValueHelper(**iter, &child_var, &state))
+          return PP_MakeUndefined();
+
+        array_var->elements().push_back(child_var);
+      }
+    } else {
+      NOTREACHED();
+      return PP_MakeUndefined();
+    }
+  }
+
+  return root_var.Release();
+}
+}  // namespace ppapi
+
diff --git a/ppapi/shared_impl/var_value_conversions.h b/ppapi/shared_impl/var_value_conversions.h
new file mode 100644
index 0000000..09145ce
--- /dev/null
+++ b/ppapi/shared_impl/var_value_conversions.h
@@ -0,0 +1,41 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_
+#define PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_
+
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/ppapi_shared_export.h"
+
+namespace base {
+class Value;
+}
+
+namespace ppapi {
+
+// Converts a PP_Var to a base::Value object. The caller takes ownership of the
+// returned object.
+//
+// Both PP_VARTYPE_UNDEFINED and PP_VARTYPE_NULL are converted to
+// base::Value::TYPE_NULL. In dictionary vars, key-value pairs whose value is
+// undefined (PP_VARTYPE_UNDEFINED) are ignored. If a node in |var| appears more
+// than once, it is duplicated in the result. For example, if |var| is an array
+// and it has two elements pointing to the same dictionary, the resulting list
+// value will have two copies of the dictionary.
+//
+// The conversion fails and returns NULL if
+// - |var| is object (PP_VARTYPE_OBJECT); or
+// - |var| is an array or dictionary, and calling CreateValueFromVar() on any of
+//   the array elements or dictionary values fails; or
+// - there exist circular references, i.e., an array or dictionary is its own
+//   ancestor/descendant.
+PPAPI_SHARED_EXPORT base::Value* CreateValueFromVar(const PP_Var& var);
+
+// The returned var has been added ref on behalf of the caller.
+// Returns an undefined var if the conversion fails.
+PPAPI_SHARED_EXPORT PP_Var CreateVarFromValue(const base::Value& value);
+
+}  // namespace ppapi
+
+#endif  // PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_
diff --git a/ppapi/shared_impl/var_value_conversions_unittest.cc b/ppapi/shared_impl/var_value_conversions_unittest.cc
new file mode 100644
index 0000000..8dd2c42
--- /dev/null
+++ b/ppapi/shared_impl/var_value_conversions_unittest.cc
@@ -0,0 +1,316 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/shared_impl/var_value_conversions.h"
+
+#include <cmath>
+#include <cstring>
+
+#include "base/logging.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/values.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/array_var.h"
+#include "ppapi/shared_impl/dictionary_var.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/shared_impl/scoped_pp_var.h"
+#include "ppapi/shared_impl/test_globals.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/shared_impl/var_tracker.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace ppapi {
+namespace {
+
+bool Equals(const base::Value& value, const PP_Var& var) {
+  switch (value.GetType()) {
+    case base::Value::TYPE_NULL: {
+      return var.type == PP_VARTYPE_NULL || var.type == PP_VARTYPE_UNDEFINED;
+    }
+    case base::Value::TYPE_BOOLEAN: {
+      bool result = false;
+      return var.type == PP_VARTYPE_BOOL &&
+             value.GetAsBoolean(&result) &&
+             result == PP_ToBool(var.value.as_bool);
+    }
+    case base::Value::TYPE_INTEGER: {
+      int result = 0;
+      return var.type == PP_VARTYPE_INT32 &&
+             value.GetAsInteger(&result) &&
+             result == var.value.as_int;
+    }
+    case base::Value::TYPE_DOUBLE: {
+      double result = 0;
+      return var.type == PP_VARTYPE_DOUBLE &&
+             value.GetAsDouble(&result) &&
+             fabs(result - var.value.as_double) < 1.0e-4;
+    }
+    case base::Value::TYPE_STRING: {
+      std::string result;
+      StringVar* string_var = StringVar::FromPPVar(var);
+      return string_var &&
+             value.GetAsString(&result) &&
+             result == string_var->value();
+    }
+    case base::Value::TYPE_BINARY: {
+      const base::BinaryValue& binary_value =
+          static_cast<const base::BinaryValue&>(value);
+      ArrayBufferVar* array_buffer_var = ArrayBufferVar::FromPPVar(var);
+      if (!array_buffer_var ||
+          binary_value.GetSize() != array_buffer_var->ByteLength()) {
+        return false;
+      }
+
+      bool result = !memcmp(binary_value.GetBuffer(), array_buffer_var->Map(),
+                            binary_value.GetSize());
+      array_buffer_var->Unmap();
+      return result;
+    }
+    case base::Value::TYPE_DICTIONARY: {
+      const base::DictionaryValue& dict_value =
+          static_cast<const base::DictionaryValue&>(value);
+      DictionaryVar* dict_var = DictionaryVar::FromPPVar(var);
+      if (!dict_var)
+        return false;
+
+      size_t non_undefined_count = 0;
+      for (DictionaryVar::KeyValueMap::const_iterator iter =
+               dict_var->key_value_map().begin();
+           iter != dict_var->key_value_map().end();
+           ++iter) {
+        if (iter->second.get().type == PP_VARTYPE_UNDEFINED)
+          continue;
+
+        ++non_undefined_count;
+        const base::Value* sub_value = NULL;
+        if (!dict_value.GetWithoutPathExpansion(iter->first, &sub_value) ||
+            !Equals(*sub_value, iter->second.get())) {
+          return false;
+        }
+      }
+      return non_undefined_count == dict_value.size();
+    }
+    case base::Value::TYPE_LIST: {
+      const base::ListValue& list_value =
+          static_cast<const base::ListValue&>(value);
+      ArrayVar* array_var = ArrayVar::FromPPVar(var);
+      if (!array_var || list_value.GetSize() != array_var->elements().size())
+        return false;
+
+      base::ListValue::const_iterator value_iter = list_value.begin();
+      ArrayVar::ElementVector::const_iterator var_iter =
+          array_var->elements().begin();
+      for (; value_iter != list_value.end() &&
+                 var_iter != array_var->elements().end();
+           ++value_iter, ++var_iter) {
+        if (!Equals(**value_iter, var_iter->get()))
+          return false;
+      }
+      return true;
+    }
+  }
+  NOTREACHED();
+  return false;
+}
+
+class VarValueConversionsTest : public testing::Test {
+ public:
+  VarValueConversionsTest() {
+  }
+  virtual ~VarValueConversionsTest() {
+  }
+
+  // testing::Test implementation.
+  virtual void SetUp() {
+    ProxyLock::Acquire();
+  }
+  virtual void TearDown() {
+    ASSERT_TRUE(PpapiGlobals::Get()->GetVarTracker()->GetLiveVars().empty());
+    ProxyLock::Release();
+  }
+
+ private:
+  TestGlobals globals_;
+};
+
+}  // namespace
+
+TEST_F(VarValueConversionsTest, CreateValueFromVar) {
+  {
+    // Var holding a ref to itself is not a valid input.
+    scoped_refptr<DictionaryVar> dict_var(new DictionaryVar());
+    ScopedPPVar var_1(ScopedPPVar::PassRef(), dict_var->GetPPVar());
+    scoped_refptr<ArrayVar> array_var(new ArrayVar());
+    ScopedPPVar var_2(ScopedPPVar::PassRef(), array_var->GetPPVar());
+
+    ASSERT_TRUE(dict_var->SetWithStringKey("key_1", var_2.get()));
+    scoped_ptr<base::Value> value(CreateValueFromVar(var_1.get()));
+    ASSERT_TRUE(value.get());
+
+    ASSERT_TRUE(array_var->Set(0, var_1.get()));
+    value.reset(CreateValueFromVar(var_1.get()));
+    ASSERT_EQ(NULL, value.get());
+
+    // Make sure |var_1| doesn't indirectly hold a ref to itself, otherwise it
+    // is leaked.
+    dict_var->DeleteWithStringKey("key_1");
+  }
+
+  // Vars of null or undefined type are converted to null values.
+  {
+    scoped_ptr<base::Value> value(CreateValueFromVar(PP_MakeNull()));
+    ASSERT_TRUE(value.get());
+    ASSERT_TRUE(Equals(*value, PP_MakeNull()));
+
+    value.reset(CreateValueFromVar(PP_MakeUndefined()));
+    ASSERT_TRUE(value.get());
+    ASSERT_TRUE(Equals(*value, PP_MakeUndefined()));
+  }
+
+  {
+    // Test empty dictionary.
+    scoped_refptr<DictionaryVar> dict_var(new DictionaryVar());
+    ScopedPPVar var(ScopedPPVar::PassRef(), dict_var->GetPPVar());
+
+    scoped_ptr<base::Value> value(CreateValueFromVar(var.get()));
+    ASSERT_TRUE(value.get());
+    ASSERT_TRUE(Equals(*value, var.get()));
+  }
+
+  {
+    // Key-value pairs whose value is undefined are ignored.
+    scoped_refptr<DictionaryVar> dict_var(new DictionaryVar());
+    ASSERT_TRUE(dict_var->SetWithStringKey("key_1", PP_MakeUndefined()));
+    ASSERT_TRUE(dict_var->SetWithStringKey("key_2", PP_MakeInt32(1)));
+    ScopedPPVar var(ScopedPPVar::PassRef(), dict_var->GetPPVar());
+
+    scoped_ptr<base::Value> value(CreateValueFromVar(var.get()));
+    ASSERT_TRUE(value.get());
+    ASSERT_TRUE(Equals(*value, var.get()));
+  }
+
+  {
+    // The same PP_Var is allowed to appear multiple times.
+    scoped_refptr<DictionaryVar> dict_var_1(new DictionaryVar());
+    ScopedPPVar dict_pp_var_1(ScopedPPVar::PassRef(), dict_var_1->GetPPVar());
+    scoped_refptr<DictionaryVar> dict_var_2(new DictionaryVar());
+    ScopedPPVar dict_pp_var_2(ScopedPPVar::PassRef(), dict_var_2->GetPPVar());
+    scoped_refptr<StringVar> string_var(new StringVar("string_value"));
+    ScopedPPVar string_pp_var(ScopedPPVar::PassRef(), string_var->GetPPVar());
+
+    ASSERT_TRUE(dict_var_1->SetWithStringKey("key_1", dict_pp_var_2.get()));
+    ASSERT_TRUE(dict_var_1->SetWithStringKey("key_2", dict_pp_var_2.get()));
+    ASSERT_TRUE(dict_var_1->SetWithStringKey("key_3", string_pp_var.get()));
+    ASSERT_TRUE(dict_var_2->SetWithStringKey("key_4", string_pp_var.get()));
+
+    scoped_ptr<base::Value> value(CreateValueFromVar(dict_pp_var_1.get()));
+    ASSERT_TRUE(value.get());
+    ASSERT_TRUE(Equals(*value, dict_pp_var_1.get()));
+  }
+
+  {
+    // Test basic cases for array.
+    scoped_refptr<ArrayVar> array_var(new ArrayVar());
+    ScopedPPVar var(ScopedPPVar::PassRef(), array_var->GetPPVar());
+
+    scoped_ptr<base::Value> value(CreateValueFromVar(var.get()));
+    ASSERT_TRUE(value.get());
+    ASSERT_TRUE(Equals(*value, var.get()));
+
+    ASSERT_TRUE(array_var->Set(0, PP_MakeDouble(1)));
+    value.reset(CreateValueFromVar(var.get()));
+    ASSERT_TRUE(value.get());
+    ASSERT_TRUE(Equals(*value, var.get()));
+  }
+
+  {
+    // Test more complex inputs.
+    scoped_refptr<DictionaryVar> dict_var_1(new DictionaryVar());
+    ScopedPPVar dict_pp_var_1(ScopedPPVar::PassRef(), dict_var_1->GetPPVar());
+    scoped_refptr<DictionaryVar> dict_var_2(new DictionaryVar());
+    ScopedPPVar dict_pp_var_2(ScopedPPVar::PassRef(), dict_var_2->GetPPVar());
+    scoped_refptr<ArrayVar> array_var(new ArrayVar());
+    ScopedPPVar array_pp_var(ScopedPPVar::PassRef(), array_var->GetPPVar());
+    scoped_refptr<StringVar> string_var(new StringVar("string_value"));
+    ScopedPPVar string_pp_var(ScopedPPVar::PassRef(), string_var->GetPPVar());
+
+    ASSERT_TRUE(dict_var_1->SetWithStringKey("null_key", PP_MakeNull()));
+    ASSERT_TRUE(dict_var_1->SetWithStringKey("string_key",
+                                             string_pp_var.get()));
+    ASSERT_TRUE(dict_var_1->SetWithStringKey("dict_key", dict_pp_var_2.get()));
+
+    ASSERT_TRUE(dict_var_2->SetWithStringKey("undefined_key",
+                                             PP_MakeUndefined()));
+    ASSERT_TRUE(dict_var_2->SetWithStringKey("double_key", PP_MakeDouble(1)));
+    ASSERT_TRUE(dict_var_2->SetWithStringKey("array_key", array_pp_var.get()));
+
+    ASSERT_TRUE(array_var->Set(0, PP_MakeInt32(2)));
+    ASSERT_TRUE(array_var->Set(1, PP_MakeBool(PP_TRUE)));
+    ASSERT_TRUE(array_var->SetLength(4));
+
+    scoped_ptr<base::Value> value(CreateValueFromVar(dict_pp_var_1.get()));
+    ASSERT_TRUE(value.get());
+    ASSERT_TRUE(Equals(*value, dict_pp_var_1.get()));
+  }
+
+  {
+    // Test that dictionary keys containing '.' are handled correctly.
+    scoped_refptr<DictionaryVar> dict_var(new DictionaryVar());
+    ScopedPPVar dict_pp_var(ScopedPPVar::PassRef(), dict_var->GetPPVar());
+
+    ASSERT_TRUE(dict_var->SetWithStringKey("double.key", PP_MakeDouble(1)));
+    ASSERT_TRUE(dict_var->SetWithStringKey("int.key..name", PP_MakeInt32(2)));
+
+    scoped_ptr<base::Value> value(CreateValueFromVar(dict_pp_var.get()));
+    ASSERT_TRUE(value.get());
+    ASSERT_TRUE(Equals(*value, dict_pp_var.get()));
+  }
+}
+
+TEST_F(VarValueConversionsTest, CreateVarFromValue) {
+  {
+    // Test basic cases for dictionary.
+    base::DictionaryValue dict_value;
+    ScopedPPVar var(ScopedPPVar::PassRef(), CreateVarFromValue(dict_value));
+    ASSERT_TRUE(Equals(dict_value, var.get()));
+
+    dict_value.SetInteger("int_key", 1);
+    var = ScopedPPVar(ScopedPPVar::PassRef(), CreateVarFromValue(dict_value));
+    ASSERT_TRUE(Equals(dict_value, var.get()));
+  }
+
+  {
+    // Test basic cases for array.
+    base::ListValue list_value;
+    ScopedPPVar var(ScopedPPVar::PassRef(), CreateVarFromValue(list_value));
+    ASSERT_TRUE(Equals(list_value, var.get()));
+
+    list_value.AppendInteger(1);
+    var = ScopedPPVar(ScopedPPVar::PassRef(), CreateVarFromValue(list_value));
+    ASSERT_TRUE(Equals(list_value, var.get()));
+  }
+
+  {
+    // Test more complex inputs.
+    base::DictionaryValue dict_value;
+    dict_value.Set("null_key", base::Value::CreateNullValue());
+    dict_value.SetString("string_key", "string_value");
+    dict_value.SetDouble("dict_key.double_key", 1);
+
+    scoped_ptr<base::ListValue> list_value(new base::ListValue());
+    list_value->AppendInteger(2);
+    list_value->AppendBoolean(true);
+    list_value->Append(base::Value::CreateNullValue());
+
+    dict_value.Set("dict_key.array_key", list_value.release());
+
+    ScopedPPVar var(ScopedPPVar::PassRef(), CreateVarFromValue(dict_value));
+    ASSERT_TRUE(Equals(dict_value, var.get()));
+  }
+}
+
+}  // namespace ppapi
diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h
index 6cc42a0..7dc99ae 100644
--- a/ppapi/tests/all_c_includes.h
+++ b/ppapi/tests/all_c_includes.h
@@ -13,7 +13,6 @@
 #include "ppapi/c/dev/pp_video_dev.h"
 #include "ppapi/c/dev/ppb_buffer_dev.h"
 #include "ppapi/c/dev/ppb_char_set_dev.h"
-#include "ppapi/c/dev/ppb_console_dev.h"
 #include "ppapi/c/dev/ppb_crypto_dev.h"
 #include "ppapi/c/dev/ppb_cursor_control_dev.h"
 #include "ppapi/c/dev/ppb_device_ref_dev.h"
@@ -29,9 +28,14 @@
 #include "ppapi/c/dev/ppb_scrollbar_dev.h"
 #include "ppapi/c/dev/ppb_testing_dev.h"
 #include "ppapi/c/dev/ppb_text_input_dev.h"
+#include "ppapi/c/dev/ppb_trace_event_dev.h"
+#include "ppapi/c/dev/ppb_truetype_font_dev.h"
 #include "ppapi/c/dev/ppb_url_util_dev.h"
+#include "ppapi/c/dev/ppb_var_array_dev.h"
 #include "ppapi/c/dev/ppb_var_deprecated.h"
+#include "ppapi/c/dev/ppb_var_dictionary_dev.h"
 #include "ppapi/c/dev/ppb_video_decoder_dev.h"
+#include "ppapi/c/dev/ppb_view_dev.h"
 #include "ppapi/c/dev/ppb_widget_dev.h"
 #include "ppapi/c/dev/ppb_zoom_dev.h"
 #include "ppapi/c/dev/ppp_class_deprecated.h"
@@ -41,9 +45,10 @@
 #include "ppapi/c/dev/ppp_selection_dev.h"
 #include "ppapi/c/dev/ppp_text_input_dev.h"
 #include "ppapi/c/dev/ppp_video_decoder_dev.h"
-#include "ppapi/c/dev/ppb_view_dev.h"
 #include "ppapi/c/dev/ppp_widget_dev.h"
 #include "ppapi/c/dev/ppp_zoom_dev.h"
+#include "ppapi/c/extensions/dev/ppb_alarms_dev.h"
+#include "ppapi/c/extensions/dev/ppb_events_dev.h"
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/pp_errors.h"
@@ -64,6 +69,7 @@
 #include "ppapi/c/ppb.h"
 #include "ppapi/c/ppb_audio.h"
 #include "ppapi/c/ppb_audio_config.h"
+#include "ppapi/c/ppb_console.h"
 #include "ppapi/c/ppb_core.h"
 #include "ppapi/c/ppb_file_io.h"
 #include "ppapi/c/ppb_file_ref.h"
@@ -97,6 +103,7 @@
 #include "ppapi/c/private/ppb_flash_menu.h"
 #include "ppapi/c/private/ppb_flash_message_loop.h"
 #include "ppapi/c/private/ppb_gpu_blacklist_private.h"
+#include "ppapi/c/private/ppb_host_resolver_private.h"
 #include "ppapi/c/private/ppb_instance_private.h"
 #include "ppapi/c/private/ppb_nacl_private.h"
 #include "ppapi/c/private/ppb_net_address_private.h"
@@ -108,8 +115,8 @@
 #include "ppapi/c/private/ppb_udp_socket_private.h"
 #include "ppapi/c/private/ppb_uma_private.h"
 #include "ppapi/c/private/ppb_x509_certificate_private.h"
-#include "ppapi/c/private/ppp_instance_private.h"
 #include "ppapi/c/private/ppp_content_decryptor_private.h"
+#include "ppapi/c/private/ppp_instance_private.h"
 #include "ppapi/c/trusted/ppb_audio_trusted.h"
 #include "ppapi/c/trusted/ppb_file_io_trusted.h"
 #include "ppapi/c/trusted/ppb_graphics_3d_trusted.h"
diff --git a/ppapi/tests/all_cpp_includes.h b/ppapi/tests/all_cpp_includes.h
index 69fa0d9..deabeaa 100644
--- a/ppapi/tests/all_cpp_includes.h
+++ b/ppapi/tests/all_cpp_includes.h
@@ -29,11 +29,14 @@
 #include "ppapi/cpp/dev/selection_dev.h"
 #include "ppapi/cpp/dev/text_input_dev.h"
 #include "ppapi/cpp/dev/url_util_dev.h"
+#include "ppapi/cpp/dev/var_array_dev.h"
+#include "ppapi/cpp/dev/var_dictionary_dev.h"
 #include "ppapi/cpp/dev/video_decoder_dev.h"
 #include "ppapi/cpp/dev/view_dev.h"
 #include "ppapi/cpp/dev/widget_client_dev.h"
 #include "ppapi/cpp/dev/widget_dev.h"
 #include "ppapi/cpp/dev/zoom_dev.h"
+#include "ppapi/cpp/extensions/dev/alarms_dev.h"
 #include "ppapi/cpp/file_io.h"
 #include "ppapi/cpp/file_ref.h"
 #include "ppapi/cpp/file_system.h"
diff --git a/ppapi/tests/arch_dependent_sizes_64.h b/ppapi/tests/arch_dependent_sizes_64.h
index bd30300..2ac1740 100644
--- a/ppapi/tests/arch_dependent_sizes_64.h
+++ b/ppapi/tests/arch_dependent_sizes_64.h
@@ -11,8 +11,11 @@
 
 #include "ppapi/tests/test_struct_sizes.c"
 
+// TODO(jschuh): Resolve ILP64 to LLP64 issue. crbug.com/177779
+#if !defined(_WIN64)
 PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLintptr, 8);
 PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLsizeiptr, 8);
+#endif
 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Func, 8);
 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLLoaderTrusted_StatusCallback, 8);
 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_CompletionCallback, 24);
diff --git a/ppapi/tests/test_audio.cc b/ppapi/tests/test_audio.cc
index 0f70156..a85e955 100644
--- a/ppapi/tests/test_audio.cc
+++ b/ppapi/tests/test_audio.cc
@@ -215,8 +215,7 @@
   // |AudioCallbackTest()| calls |test_callback_|, sleeps a bit, then sets
   // |test_done_|.
   TestCompletionCallback test_callback(instance_->pp_instance());
-  test_callback_ = static_cast<pp::CompletionCallback>(
-      test_callback).pp_completion_callback();
+  test_callback_ = test_callback.GetCallback().pp_completion_callback();
   test_done_ = false;
   callback_fired_ = false;
 
@@ -262,8 +261,7 @@
   // |AudioCallbackTest()| calls |test_callback_|, sleeps a bit, then sets
   // |test_done_|.
   TestCompletionCallback test_callback(instance_->pp_instance());
-  test_callback_ = static_cast<pp::CompletionCallback>(
-      test_callback).pp_completion_callback();
+  test_callback_ = test_callback.GetCallback().pp_completion_callback();
   test_done_ = false;
   callback_fired_ = false;
 
@@ -308,8 +306,7 @@
   // |AudioCallbackTest()| calls |test_callback_|, sleeps a bit, then sets
   // |test_done_|.
   TestCompletionCallback test_callback_1(instance_->pp_instance());
-  test_callback_ = static_cast<pp::CompletionCallback>(
-      test_callback_1).pp_completion_callback();
+  test_callback_ = test_callback_1.GetCallback().pp_completion_callback();
   test_done_ = false;
   callback_fired_ = false;
 
@@ -326,8 +323,7 @@
   ASSERT_TRUE(callback_fired_);
 
   TestCompletionCallback test_callback_2(instance_->pp_instance());
-  test_callback_ = static_cast<pp::CompletionCallback>(
-      test_callback_2).pp_completion_callback();
+  test_callback_ = test_callback_2.GetCallback().pp_completion_callback();
 
   // Repeat one more |StartPlayback| & |StopPlayback| cycle, and verify again
   // that the callback function was invoked.
diff --git a/ppapi/tests/test_broker.cc b/ppapi/tests/test_broker.cc
index 63bbd1c..0537b95 100644
--- a/ppapi/tests/test_broker.cc
+++ b/ppapi/tests/test_broker.cc
@@ -217,15 +217,18 @@
 
   // The following tests require special setup, so only run them if they're
   // explicitly specified by the filter.
-  if (filter.empty())
-    return;
-
-  RUN_TEST(ConnectPermissionDenied, filter);
-  RUN_TEST(ConnectPermissionGranted, filter);
+  if (!ShouldRunAllTests(filter)) {
+    RUN_TEST(ConnectPermissionDenied, filter);
+    RUN_TEST(ConnectPermissionGranted, filter);
+    RUN_TEST(IsAllowedPermissionDenied, filter);
+    RUN_TEST(IsAllowedPermissionGranted, filter);
+  }
 }
 
 std::string TestBroker::TestCreate() {
   // Very simplistic test to make sure we can create a broker interface.
+  // TODO(raymes): All of the resources created in this file are leaked. Write
+  // a C++ wrapper for PPB_Broker_Trusted to avoid these leaks.
   PP_Resource broker = broker_interface_->CreateTrusted(
       instance_->pp_instance());
   ASSERT_TRUE(broker);
@@ -317,3 +320,20 @@
   PASS();
 }
 
+std::string TestBroker::TestIsAllowedPermissionDenied() {
+  PP_Resource broker = broker_interface_->CreateTrusted(
+      instance_->pp_instance());
+  ASSERT_TRUE(broker);
+  ASSERT_EQ(PP_FALSE, broker_interface_->IsAllowed(broker));
+
+  PASS();
+}
+
+std::string TestBroker::TestIsAllowedPermissionGranted() {
+  PP_Resource broker = broker_interface_->CreateTrusted(
+      instance_->pp_instance());
+  ASSERT_TRUE(broker);
+  ASSERT_EQ(PP_TRUE, broker_interface_->IsAllowed(broker));
+
+  PASS();
+}
diff --git a/ppapi/tests/test_broker.h b/ppapi/tests/test_broker.h
index a45900e..ee869f6 100644
--- a/ppapi/tests/test_broker.h
+++ b/ppapi/tests/test_broker.h
@@ -26,6 +26,8 @@
   std::string TestConnectAndPipe();
   std::string TestConnectPermissionDenied();
   std::string TestConnectPermissionGranted();
+  std::string TestIsAllowedPermissionDenied();
+  std::string TestIsAllowedPermissionGranted();
 
   const PPB_BrokerTrusted* broker_interface_;
 };
diff --git a/ppapi/tests/test_buffer.cc b/ppapi/tests/test_buffer.cc
index e6d7063..d143043 100644
--- a/ppapi/tests/test_buffer.cc
+++ b/ppapi/tests/test_buffer.cc
@@ -20,10 +20,10 @@
 }
 
 void TestBuffer::RunTests(const std::string& filter) {
-  instance_->LogTest("InvalidSize", TestInvalidSize());
-  instance_->LogTest("InitToZero", TestInitToZero());
-  instance_->LogTest("IsBuffer", TestIsBuffer());
-  instance_->LogTest("BasicLifecyle", TestBasicLifeCycle());
+  RUN_TEST(InvalidSize, filter);
+  RUN_TEST(InitToZero, filter);
+  RUN_TEST(IsBuffer, filter);
+  RUN_TEST(BasicLifeCycle, filter);
 }
 
 std::string TestBuffer::TestInvalidSize() {
diff --git a/ppapi/tests/test_case.cc b/ppapi/tests/test_case.cc
index f6fb485..7ae564e 100644
--- a/ppapi/tests/test_case.cc
+++ b/ppapi/tests/test_case.cc
@@ -4,16 +4,84 @@
 
 #include "ppapi/tests/test_case.h"
 
+#include <string.h>
+
 #include <sstream>
 
+#include "ppapi/cpp/core.h"
+#include "ppapi/cpp/module.h"
 #include "ppapi/tests/pp_thread.h"
 #include "ppapi/tests/test_utils.h"
 #include "ppapi/tests/testing_instance.h"
 
+namespace {
+
+std::string StripPrefix(const std::string& test_name) {
+  const char* const prefixes[] = {
+      "FAILS_", "FLAKY_", "DISABLED_" };
+  for (size_t i = 0; i < sizeof(prefixes)/sizeof(prefixes[0]); ++i)
+    if (test_name.find(prefixes[i]) == 0)
+      return test_name.substr(strlen(prefixes[i]));
+  return test_name;
+}
+
+// Strip the TestCase name off and return the remainder (i.e., everything after
+// '_'). If there is no '_', assume only the TestCase was provided, and return
+// an empty string.
+// For example:
+//   StripTestCase("TestCase_TestName");
+// returns
+//   "TestName"
+// while
+//   StripTestCase("TestCase);
+// returns
+//   ""
+std::string StripTestCase(const std::string& full_test_name) {
+  size_t delim = full_test_name.find_first_of('_');
+  if (delim != std::string::npos)
+    return full_test_name.substr(delim+1);
+  // In this case, our "filter" is the empty string; the full test name is the
+  // same as the TestCase name with which we were constructed.
+  // TODO(dmichael): It might be nice to be able to PP_DCHECK against the
+  // TestCase class name, but we'd have to plumb that name to TestCase somehow.
+  return std::string();
+}
+
+// Parse |test_filter|, which is a comma-delimited list of (possibly prefixed)
+// test names and insert the un-prefixed names into |remaining_tests|, with
+// the bool indicating whether the test should be run.
+void ParseTestFilter(const std::string& test_filter,
+                     std::map<std::string, bool>* remaining_tests) {
+  // We can't use base/string_util.h::Tokenize in ppapi, so we have to do it
+  // ourselves.
+  std::istringstream filter_stream(test_filter);
+  std::string current_test;
+  while (std::getline(filter_stream, current_test, ',')) {
+    // |current_test| might include a prefix, like DISABLED_Foo_TestBar, so we
+    // we strip it off if there is one.
+    std::string stripped_test_name(StripPrefix(current_test));
+    // Strip off the test case and use the test name as a key, because the test
+    // name ShouldRunTest wants to use to look up the test doesn't have the
+    // TestCase name.
+    std::string test_name_without_case(StripTestCase(stripped_test_name));
+
+    // If the test wasn't prefixed, it should be run.
+    bool should_run_test = (current_test == stripped_test_name);
+    PP_DCHECK(remaining_tests->count(test_name_without_case) == 0);
+    remaining_tests->insert(
+        std::make_pair(test_name_without_case, should_run_test));
+  }
+  // There may be a trailing comma; ignore empty strings.
+  remaining_tests->erase(std::string());
+}
+
+}  // namespace
+
 TestCase::TestCase(TestingInstance* instance)
     : instance_(instance),
       testing_interface_(NULL),
-      callback_type_(PP_REQUIRED) {
+      callback_type_(PP_REQUIRED),
+      have_populated_remaining_tests_(false) {
   // Get the testing_interface_ if it is available, so that we can do Resource
   // and Var checks on shutdown (see CheckResourcesAndVars). If it is not
   // available, testing_interface_ will be NULL. Some tests do not require it.
@@ -103,9 +171,35 @@
   return true;
 }
 
-bool TestCase::MatchesFilter(const std::string& test_name,
+bool TestCase::ShouldRunAllTests(const std::string& filter) {
+  // If only the TestCase is listed, we're running all the tests in RunTests.
+  return (StripTestCase(filter) == std::string());
+}
+
+bool TestCase::ShouldRunTest(const std::string& test_name,
                              const std::string& filter) {
-  return filter.empty() || (test_name == filter);
+  if (ShouldRunAllTests(filter))
+    return true;
+
+  // Lazily initialize our "remaining_tests_" map.
+  if (!have_populated_remaining_tests_) {
+    ParseTestFilter(filter, &remaining_tests_);
+    have_populated_remaining_tests_ = true;
+  }
+  std::map<std::string, bool>::iterator iter = remaining_tests_.find(test_name);
+  if (iter == remaining_tests_.end()) {
+    // The test name wasn't listed in the filter. Don't run it, but store it
+    // so TestingInstance::ExecuteTests can report an error later.
+    skipped_tests_.insert(test_name);
+    return false;
+  }
+  bool should_run_test = iter->second;
+  remaining_tests_.erase(iter);
+  return should_run_test;
+}
+
+PP_TimeTicks TestCase::NowInTimeTicks() {
+  return pp::Module::Get()->core()->GetTimeTicks();
 }
 
 std::string TestCase::CheckResourcesAndVars(std::string errors) {
diff --git a/ppapi/tests/test_case.h b/ppapi/tests/test_case.h
index aa35046..c2379d1 100644
--- a/ppapi/tests/test_case.h
+++ b/ppapi/tests/test_case.h
@@ -7,13 +7,15 @@
 
 #include <cmath>
 #include <limits>
+#include <map>
 #include <set>
 #include <string>
 
-#include "ppapi/c/pp_resource.h"
 #include "ppapi/c/dev/ppb_testing_dev.h"
-#include "ppapi/cpp/dev/message_loop_dev.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_time.h"
 #include "ppapi/cpp/dev/scrollbar_dev.h"
+#include "ppapi/cpp/message_loop.h"
 #include "ppapi/cpp/view.h"
 #include "ppapi/tests/test_utils.h"
 #include "ppapi/tests/testing_instance.h"
@@ -43,10 +45,14 @@
   virtual bool Init();
 
   // Override to implement the test case. It will be called after the plugin is
-  // first displayed, passing a string. If the string is empty, the
-  // should run all tests for this test case. Otherwise, it should run the test
-  // whose name matches test_filter exactly (if there is one). This should
-  // generally be implemented using the RUN_TEST* macros.
+  // first displayed, passing a string. If the string is empty, RunTests should
+  // run all tests for this test case. Otherwise, it must be a comma-delimited
+  // list of test names, possibly prefixed. E.g.:
+  //   "Foo_GoodTest,DISABLED_Foo_BadTest,Foo_OtherGoodTest"
+  // All listed tests which are not prefixed will be run.
+  //
+  // This should generally be implemented in a TestCase subclass using the
+  // RUN_TEST* macros.
   virtual void RunTests(const std::string& test_filter) = 0;
 
   static std::string MakeFailureMessage(const char* file, int line,
@@ -82,6 +88,13 @@
 
   static void QuitMainMessageLoop(PP_Instance instance);
 
+  const std::map<std::string, bool>& remaining_tests() {
+    return remaining_tests_;
+  }
+  const std::set<std::string>& skipped_tests() {
+    return skipped_tests_;
+  }
+
  protected:
 #if !(defined __native_client__)
   // Overridden by each test to supply a ScriptableObject corresponding to the
@@ -101,9 +114,15 @@
   // Makes sure the test is run over HTTP.
   bool EnsureRunningOverHTTP();
 
+  // Returns true if |filter| only contains a TestCase name, which normally
+  // means "run all tests". Some TestCases require special setup for individual
+  // tests, and can use this function to decide whether to ignore those tests.
+  bool ShouldRunAllTests(const std::string& filter);
+
   // Return true if the given test name matches the filter. This is true if
-  // (a) filter is empty or (b) test_name and filter match exactly.
-  bool MatchesFilter(const std::string& test_name, const std::string& filter);
+  // (a) filter is empty or (b) test_name matches a test name listed in filter
+  // exactly.
+  bool ShouldRunTest(const std::string& test_name, const std::string& filter);
 
   // Check for leaked resources and vars at the end of the test. If any exist,
   // return a string with some information about the error. Otherwise, return
@@ -113,6 +132,8 @@
   // CheckResourcesAndVars will do nothing and return the same string.
   std::string CheckResourcesAndVars(std::string errors);
 
+  PP_TimeTicks NowInTimeTicks();
+
   // Run the given test method on a background thread and return the result.
   template <class T>
   std::string RunOnThread(std::string(T::*test_to_run)()) {
@@ -125,7 +146,7 @@
     // supported in-process). For in-process, just consider it a pass.
     if (!testing_interface_->IsOutOfProcess())
       return std::string();
-    pp::MessageLoop_Dev background_loop(instance_);
+    pp::MessageLoop background_loop(instance_);
     ThreadedTestRunner<T> runner(instance_->pp_instance(),
         static_cast<T*>(this), test_to_run, background_loop);
     RunOnThreadInternal(&ThreadedTestRunner<T>::ThreadFunction, &runner,
@@ -164,7 +185,7 @@
     ThreadedTestRunner(PP_Instance instance,
                        T* test_case,
                        TestMethodType test_to_run,
-                       pp::MessageLoop_Dev loop)
+                       pp::MessageLoop loop)
         : instance_(instance),
           test_case_(test_case),
           test_to_run_(test_to_run),
@@ -191,7 +212,7 @@
     PP_Instance instance_;
     T* test_case_;
     TestMethodType test_to_run_;
-    pp::MessageLoop_Dev loop_;
+    pp::MessageLoop loop_;
   };
 
   // The internals for RunOnThread. This allows us to avoid including
@@ -212,6 +233,24 @@
   // Var ids that should be ignored when checking for leaks on shutdown.
   std::set<int64_t> ignored_leaked_vars_;
 
+  // The tests that were found in test_filter but have not yet been run. The
+  // bool indicates whether the test should be run (i.e., it will be false if
+  // the test name was prefixed in the test_filter string).
+  //
+  // This is initialized lazily the first time that ShouldRunTest is called by
+  // RunTests. When RunTests is finished, this should be empty. Any remaining
+  // tests are tests that were listed in the test_filter but didn't match
+  // any calls to ShouldRunTest, meaning it was probably a typo. TestingInstance
+  // should log this and consider it a failure.
+  std::map<std::string, bool> remaining_tests_;
+  // Flag indicating whether we have populated remaining_tests_ yet.
+  bool have_populated_remaining_tests_;
+
+  // If ShouldRunTest is called but the given test name doesn't match anything
+  // in the test_filter, the test name will be added here. This allows
+  // TestingInstance to detect when not all tests were listed.
+  std::set<std::string> skipped_tests_;
+
 #if !(defined __native_client__)
   // Holds the test object, if any was retrieved from CreateTestObject.
   pp::VarPrivate test_object_;
@@ -260,31 +299,42 @@
 // RunTest function. This assumes the function name is TestFoo where Foo is the
 // test |name|.
 #define RUN_TEST(name, test_filter) \
-  if (MatchesFilter(#name, test_filter)) { \
+  if (ShouldRunTest(#name, test_filter)) { \
     set_callback_type(PP_OPTIONAL); \
-    instance_->LogTest(#name, CheckResourcesAndVars(Test##name())); \
+    PP_TimeTicks start_time(NowInTimeTicks()); \
+    instance_->LogTest(#name, \
+                       CheckResourcesAndVars(Test##name()), \
+                       start_time); \
   }
 
 // Like RUN_TEST above but forces functions taking callbacks to complete
 // asynchronously on success or error.
 #define RUN_TEST_FORCEASYNC(name, test_filter) \
-  if (MatchesFilter(#name, test_filter)) { \
+  if (ShouldRunTest(#name, test_filter)) { \
     set_callback_type(PP_REQUIRED); \
+    PP_TimeTicks start_time(NowInTimeTicks()); \
     instance_->LogTest(#name"ForceAsync", \
-                       CheckResourcesAndVars(Test##name())); \
+                       CheckResourcesAndVars(Test##name()), \
+                       start_time); \
   }
 
 #define RUN_TEST_BLOCKING(test_case, name, test_filter) \
-  if (MatchesFilter(#name, test_filter)) { \
+  if (ShouldRunTest(#name, test_filter)) { \
     set_callback_type(PP_BLOCKING); \
-    instance_->LogTest(#name"Blocking", \
-        CheckResourcesAndVars(RunOnThread(&test_case::Test##name))); \
+    PP_TimeTicks start_time(NowInTimeTicks()); \
+    instance_->LogTest( \
+        #name"Blocking", \
+        CheckResourcesAndVars(RunOnThread(&test_case::Test##name)), \
+        start_time); \
   }
 
 #define RUN_TEST_BACKGROUND(test_case, name, test_filter) \
-  if (MatchesFilter(#name, test_filter)) { \
-    instance_->LogTest(#name"Background", \
-        CheckResourcesAndVars(RunOnThread(&test_case::Test##name))); \
+  if (ShouldRunTest(#name, test_filter)) { \
+    PP_TimeTicks start_time(NowInTimeTicks()); \
+    instance_->LogTest( \
+        #name"Background", \
+        CheckResourcesAndVars(RunOnThread(&test_case::Test##name)), \
+        start_time); \
   }
 
 #define RUN_TEST_FORCEASYNC_AND_NOT(name, test_filter) \
@@ -303,7 +353,7 @@
   } while (false)
 
 #define RUN_TEST_WITH_REFERENCE_CHECK(name, test_filter) \
-  if (MatchesFilter(#name, test_filter)) { \
+  if (ShouldRunTest(#name, test_filter)) { \
     set_callback_type(PP_OPTIONAL); \
     uint32_t objects = testing_interface_->GetLiveObjectsForInstance( \
         instance_->pp_instance()); \
@@ -313,8 +363,13 @@
             instance_->pp_instance()) != objects) \
       error_message = MakeFailureMessage(__FILE__, __LINE__, \
           "reference leak check"); \
-    instance_->LogTest(#name, error_message); \
+    PP_TimeTicks start_time(NowInTimeTicks()); \
+    instance_->LogTest(#name, \
+                       CheckResourcesAndVars(error_message), \
+                       start_time); \
   }
+// TODO(dmichael): Add CheckResourcesAndVars above when Windows tests pass
+//                 cleanly. crbug.com/173503
 
 // Helper macros for checking values in tests, and returning a location
 // description of the test fails.
diff --git a/ppapi/tests/test_case.html b/ppapi/tests/test_case.html
index a9d0879..4b67a0f 100644
--- a/ppapi/tests/test_case.html
+++ b/ppapi/tests/test_case.html
@@ -33,11 +33,14 @@
 
   var frame = document.createElement("IFRAME");
   var mode = ExtractSearchParameter("mode");
+  var websocket_host = ExtractSearchParameter("websocket_host");
   var websocket_port = ExtractSearchParameter("websocket_port");
   var ssl_server_port = ExtractSearchParameter("ssl_server_port");
   var src = "?testcase=" + testcase;
   if (mode == "nacl")
     src += "&mode=nacl";
+  if (websocket_host != "")
+    src += "&websocket_host=" + websocket_host;
   if (websocket_port != "")
     src += "&websocket_port=" + websocket_port;
   if (ssl_server_port != "")
@@ -117,6 +120,22 @@
   window.document.getElementById("console").innerHTML += html;
 }
 
+function sendAutomationMessage(msg) {
+  if (window.domAutomationController) {
+    window.domAutomationController.setAutomationId(0);
+    window.domAutomationController.send(msg);
+  }
+}
+
+// If something goes really wrong, the test running inside the plugin may not
+// terminate.  For example, if the plugin does not load, the test will never
+// send "PASS" to the browser.  In this case we should explicitly use the
+// automation controller to terminate the test.
+function InternalError(msg) {
+  LogHTML("<p>" + msg);
+  sendAutomationMessage(msg);
+}
+
 function SetCookie(key_value_string) {
   window.document.cookie = key_value_string + "; path=/";
 }
@@ -192,6 +211,12 @@
   }
 }
 
+function sendProgress() {
+  // We send "..." to signal that we're still working. See
+  // ppapi/tests/testing_instance.h for how this works.
+  sendAutomationMessage("...");
+}
+
 onload = function() {
   var testcase = ExtractSearchParameter("testcase");
   var mode = ExtractSearchParameter("mode");
@@ -207,6 +232,11 @@
     obj.setAttribute("src", "ppapi_nacl_tests_glibc.nmf");
     obj.setAttribute("type", "application/x-nacl");
     obj.setAttribute("mode", mode);
+  } else if (mode == "nacl_pnacl") {
+    obj = document.createElement("EMBED");
+    obj.setAttribute("src", "ppapi_nacl_tests_pnacl.nmf");
+    obj.setAttribute("type", "application/x-nacl");
+    obj.setAttribute("mode", mode);
   } else {
     var mimeType = "application/x-ppapi-tests";
     if (mimeType in navigator.mimeTypes) {
@@ -227,6 +257,9 @@
     obj.setAttribute("id", "plugin");
     obj.setAttribute("testcase", testcase);
     obj.setAttribute("protocol", window.location.protocol);
+    var websocket_host = ExtractSearchParameter("websocket_host");
+    if (websocket_host != "")
+      obj.setAttribute("websocket_host", websocket_host);
     var websocket_port = ExtractSearchParameter("websocket_port");
     if (websocket_port != "")
       obj.setAttribute("websocket_port", websocket_port);
@@ -236,11 +269,35 @@
 
     var container = document.getElementById("container");
     container.addEventListener("message", handleTestingMessage, true);
+
+    // "error" and "crash" events will only fire for NaCl, but adding these
+    // listeners doesn't hurt in the non-NaCl cases.
+    obj.addEventListener("error", function() {
+      InternalError("Plugin did not load. '" + obj.lastError + "'");
+    }, true);
+    obj.addEventListener("crash", function() {
+      InternalError("Plugin crashed. '" + obj.lastError + "'");
+    }, true);
+
+    // NaCl sends progress events while loading. When we get one, notify the
+    // domAutomationController so that it knows we're still working.
+    obj.addEventListener("loadstart", sendProgress, true);
+    obj.addEventListener("progress", sendProgress, true);
+    obj.addEventListener("load", sendProgress, true);
+    obj.addEventListener("loadend", sendProgress, true);
+
     // Register a bad dispatchEvent to make sure it isn't used. See 'EVIL' note
     // below.
+    var original = obj.dispatchEvent;
     obj.dispatchEvent = function() {
-      LogHTML("<p>Bad dispatchEvent called! " +
-              "see <a href='http://crbug.com/109775'>crbug.com/109775</a>)");
+      // TODO(dmichael): NaCl triggers this; take out the special case for NaCl
+      //                 when crbug.com/109775 is fixed.
+      if (mode.indexOf("nacl") !== 0)
+        InternalError("Bad dispatchEvent called!");
+
+      // Pass it on anyways, we need the event to detect load progress and
+      // errors.
+      return original.apply(obj, arguments);
     }
     container.appendChild(obj);
   }
@@ -252,27 +309,22 @@
 // particular, we replace document.createEvent, MessageEvent.initMessageEvent,
 // and the MessageEvent constructor. Previous versions of the PostMessage
 // implementation made use of these and would fail (http://crbug.com/82604).
-// The NaCl plugin uses some of these still for progress events, hence you will
-// see:
-//   Bad dispatchEvent called!
-// in the output. See crbug.com/109775 for more information.
-// TODO(dmichael): Once the NaCl plugin progress events are fixed, we should
-//                 clear the PASS cookie so that browser_tests sees these as a
-//                 failure (see ConditionFailed for how to do this).
+// The NaCl plugin uses dispatchEvent for progress events, hence we are careful
+// to make that still pass for NaCl (see above, and see crbug.com/109775).
 document.createEvent = function() {
-  LogHTML("<p>Bad document.createEvent called!");
+  InternalError("Bad document.createEvent called!");
 }
 function MessageEvent() {
-  LogHTML("<p>Bad MessageEvent constructor called!");
+  InternalError("Bad MessageEvent constructor called!");
 }
 MessageEvent.prototype.initMessageEvent = function() {
-  LogHTML("<p>Bad MessageEvent.initMessageEvent called!");
+  InternalError("Bad MessageEvent.initMessageEvent called!");
 }
 
 </script>
 </head><body>
 <div>
   <div id="container"></div>
-  <div id="console" /><span class="load_msg">loading...</span></div>
+  <div id="console"><span class="load_msg">loading...</span></div>
 </div>
 </body></html>
diff --git a/ppapi/tests/test_console.cc b/ppapi/tests/test_console.cc
new file mode 100644
index 0000000..f39defe
--- /dev/null
+++ b/ppapi/tests/test_console.cc
@@ -0,0 +1,38 @@
+// 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 "ppapi/tests/test_console.h"
+
+#include "ppapi/cpp/module.h"
+#include "ppapi/tests/testing_instance.h"
+
+REGISTER_TEST_CASE(Console);
+
+TestConsole::TestConsole(TestingInstance* instance)
+    : TestCase(instance),
+      console_interface_(NULL) {
+}
+
+bool TestConsole::Init() {
+  console_interface_ = static_cast<const PPB_Console*>(
+      pp::Module::Get()->GetBrowserInterface(PPB_CONSOLE_INTERFACE));
+  return !!console_interface_;
+}
+
+void TestConsole::RunTests(const std::string& filter) {
+  RUN_TEST(Smoke, filter);
+}
+
+std::string TestConsole::TestSmoke() {
+  // This test does not verify the log message actually reaches the console, but
+  // it does test that the interface exists and that it can be called without
+  // crashing.
+  pp::Var source(std::string("somewhere"));
+  pp::Var message(std::string("hello, world."));
+  console_interface_->Log(instance()->pp_instance(), PP_LOGLEVEL_ERROR,
+                          message.pp_var());
+  console_interface_->LogWithSource(instance()->pp_instance(), PP_LOGLEVEL_LOG,
+                                    source.pp_var(), message.pp_var());
+  PASS();
+}
diff --git a/ppapi/tests/test_console.h b/ppapi/tests/test_console.h
new file mode 100644
index 0000000..1b2f55d9
--- /dev/null
+++ b/ppapi/tests/test_console.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 PPAPI_TESTS_TEST_CONSOLE_H_
+#define PPAPI_TESTS_TEST_CONSOLE_H_
+
+#include <string>
+
+#include "ppapi/c/ppb_console.h"
+#include "ppapi/tests/test_case.h"
+
+class TestConsole : public TestCase {
+ public:
+  explicit TestConsole(TestingInstance* instance);
+
+  // TestCase implementation.
+  virtual bool Init();
+  virtual void RunTests(const std::string& filter);
+
+ private:
+  std::string TestSmoke();
+
+  const PPB_Console* console_interface_;
+};
+
+#endif  // PPAPI_TESTS_TEST_CONSOLE_H_
diff --git a/ppapi/tests/test_directory_reader.cc b/ppapi/tests/test_directory_reader.cc
index 254a355..f577b12 100644
--- a/ppapi/tests/test_directory_reader.cc
+++ b/ppapi/tests/test_directory_reader.cc
@@ -23,52 +23,14 @@
 
 namespace {
 
+typedef std::vector<pp::DirectoryEntry_Dev> Entries;
+
 std::string IntegerToString(int value) {
   char result[12];
   sprintf(result, "%d", value);
   return result;
 }
 
-int32_t DeleteDirectoryRecursively(pp::FileRef* dir,
-                                   TestCompletionCallback* callback) {
-  if (!dir || !callback)
-    return PP_ERROR_BADARGUMENT;
-
-  int32_t rv = PP_OK;
-  pp::DirectoryReader_Dev directory_reader(*dir);
-  std::vector<pp::DirectoryEntry_Dev> entries;
-  pp::DirectoryEntry_Dev entry;
-  do {
-    rv = directory_reader.GetNextEntry(&entry, *callback);
-    if (rv == PP_OK_COMPLETIONPENDING)
-      rv = callback->WaitForResult();
-    if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
-      return rv;
-    if (!entry.is_null())
-      entries.push_back(entry);
-  } while (!entry.is_null());
-
-  for (std::vector<pp::DirectoryEntry_Dev>::const_iterator it = entries.begin();
-       it != entries.end(); ++it) {
-    pp::FileRef file_ref = it->file_ref();
-    if (it->file_type() == PP_FILETYPE_DIRECTORY) {
-      rv = DeleteDirectoryRecursively(&file_ref, callback);
-      if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
-        return rv;
-    } else {
-      rv = file_ref.Delete(*callback);
-      if (rv == PP_OK_COMPLETIONPENDING)
-        rv = callback->WaitForResult();
-      if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
-        return rv;
-    }
-  }
-  rv = dir->Delete(*callback);
-  if (rv == PP_OK_COMPLETIONPENDING)
-    rv = callback->WaitForResult();
-  return rv;
-}
-
 }  // namespace
 
 bool TestDirectoryReader::Init() {
@@ -76,14 +38,52 @@
 }
 
 void TestDirectoryReader::RunTests(const std::string& filter) {
-  RUN_TEST(GetNextFile, filter);
+  RUN_TEST(ReadEntries, filter);
 }
 
-std::string TestDirectoryReader::TestGetNextFile() {
+int32_t TestDirectoryReader::DeleteDirectoryRecursively(pp::FileRef* dir) {
+  if (!dir)
+    return PP_ERROR_BADARGUMENT;
+
+  TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+  TestCompletionCallbackWithOutput<Entries> output_callback(
+      instance_->pp_instance(), force_async_);
+
+  int32_t rv = PP_OK;
+  pp::DirectoryReader_Dev directory_reader(*dir);
+  rv = directory_reader.ReadEntries(output_callback);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = output_callback.WaitForResult();
+  if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
+    return rv;
+
+  Entries entries = output_callback.output();
+  for (Entries::const_iterator it = entries.begin();
+       it != entries.end(); ++it) {
+    pp::FileRef file_ref = it->file_ref();
+    if (it->file_type() == PP_FILETYPE_DIRECTORY) {
+      rv = DeleteDirectoryRecursively(&file_ref);
+      if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
+        return rv;
+    } else {
+      rv = file_ref.Delete(callback.GetCallback());
+      if (rv == PP_OK_COMPLETIONPENDING)
+        rv = callback.WaitForResult();
+      if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
+        return rv;
+    }
+  }
+  rv = dir->Delete(callback.GetCallback());
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = callback.WaitForResult();
+  return rv;
+}
+
+std::string TestDirectoryReader::TestReadEntries() {
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
   pp::FileSystem file_system(
       instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
-  int32_t rv = file_system.Open(1024, callback);
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -97,11 +97,11 @@
   const char* dir_prefix = "dir_";
 
   pp::FileRef test_dir(file_system, test_dir_name);
-  rv = DeleteDirectoryRecursively(&test_dir, &callback);
+  rv = DeleteDirectoryRecursively(&test_dir);
   if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
     return ReportError("DeleteDirectoryRecursively", rv);
 
-  rv = test_dir.MakeDirectory(callback);
+  rv = test_dir.MakeDirectory(callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileRef::MakeDirectory force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -116,7 +116,7 @@
     pp::FileRef file_ref(file_system, buffer);
 
     pp::FileIO file_io(instance_);
-    rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback);
+    rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return ReportError("FileIO::Open force_async", rv);
     if (rv == PP_OK_COMPLETIONPENDING)
@@ -133,7 +133,7 @@
     sprintf(buffer, "%s/%s%d", test_dir_name, dir_prefix, i);
     pp::FileRef file_ref(file_system, buffer);
 
-    rv = file_ref.MakeDirectory(callback);
+    rv = file_ref.MakeDirectory(callback.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return ReportError("FileRef::MakeDirectory force_async", rv);
     if (rv == PP_OK_COMPLETIONPENDING)
@@ -144,31 +144,29 @@
     expected_dir_names.insert(buffer);
   }
 
-  // Test that |GetNextEntry()| is able to enumerate all directories and files
-  // that we created.
+  // Test that |ReadEntries()| is able to fetch all directories and files that
+  // we created.
   {
-    pp::DirectoryReader_Dev directory_reader(test_dir);
-    std::vector<pp::DirectoryEntry_Dev> entries;
-    pp::DirectoryEntry_Dev entry;
-    do {
-      rv = directory_reader.GetNextEntry(&entry, callback);
-      if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
-        return ReportError("DirectoryReader::GetNextEntry force_async", rv);
-      if (rv == PP_OK_COMPLETIONPENDING)
-        rv = callback.WaitForResult();
-      if (rv != PP_OK)
-        return ReportError("DirectoryReader::GetNextEntry", rv);
-      if (!entry.is_null())
-        entries.push_back(entry);
-    } while (!entry.is_null());
+    TestCompletionCallbackWithOutput<Entries> output_callback(
+        instance_->pp_instance(), force_async_);
 
+    pp::DirectoryReader_Dev directory_reader(test_dir);
+    rv = directory_reader.ReadEntries(output_callback);
+    if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+      return ReportError("DirectoryReader::ReadEntries force_async", rv);
+    if (rv == PP_OK_COMPLETIONPENDING)
+      rv = output_callback.WaitForResult();
+    if (rv != PP_OK)
+      return ReportError("DirectoryReader::ReadEntries", rv);
+
+    Entries entries = output_callback.output();
     size_t sum = expected_file_names.size() + expected_dir_names.size();
     if (entries.size() != sum)
       return "Expected " + IntegerToString(sum) + " entries, got " +
-             IntegerToString(entries.size());
+          IntegerToString(entries.size());
 
-    for (std::vector<pp::DirectoryEntry_Dev>::const_iterator it =
-             entries.begin(); it != entries.end(); ++it) {
+    for (Entries::const_iterator it = entries.begin();
+         it != entries.end(); ++it) {
       pp::FileRef file_ref = it->file_ref();
       std::string file_path = file_ref.GetPath().AsString();
       std::set<std::string>::iterator found =
@@ -190,34 +188,27 @@
       return "Expected more file paths.";
   }
 
-  // Test cancellation of asynchronous |GetNextEntry()|.
+  // Test cancellation of asynchronous |ReadEntries()|.
   {
-    // Declaring |entry| here prevents memory corruption for some failure modes
-    // and lets us to detect some other failures.
-    pp::DirectoryEntry_Dev entry;
-    callback.reset_run_count();
-    // Note that the directory reader will be deleted immediately.
-    rv = pp::DirectoryReader_Dev(test_dir).GetNextEntry(&entry, callback);
-    if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
-      return ReportError("DirectoryReader::GetNextEntry force_async", rv);
-    if (callback.run_count() > 0)
-      return "DirectoryReader::GetNextEntry ran callback synchronously.";
+    TestCompletionCallbackWithOutput<Entries> output_callback(
+        instance_->pp_instance(), force_async_);
 
-    // If |GetNextEntry()| is completing asynchronously, the callback should be
+    // Note that the directory reader will be deleted immediately.
+    rv = pp::DirectoryReader_Dev(test_dir).ReadEntries(output_callback);
+    if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+      return ReportError("DirectoryReader::ReadEntries force_async", rv);
+    if (output_callback.run_count() > 0)
+      return "DirectoryReader::ReadEntries ran callback synchronously.";
+
+    // If |ReadEntries()| is completing asynchronously, the callback should be
     // aborted (i.e., called with |PP_ERROR_ABORTED| from the message loop)
     // since the resource was destroyed.
     if (rv == PP_OK_COMPLETIONPENDING) {
-      // |GetNextEntry()| *may* have written to |entry| (e.g., synchronously,
-      // before the resource was destroyed), but it must not write to it after
-      // destruction.
-      bool entry_is_null = entry.is_null();
-      rv = callback.WaitForResult();
+      rv = output_callback.WaitForResult();
       if (rv != PP_ERROR_ABORTED)
-        return "DirectoryReader::GetNextEntry not aborted.";
-      if (entry.is_null() != entry_is_null)
-        return "DirectoryReader::GetNextEntry wrote result after destruction.";
+        return "DirectoryReader::ReadEntries not aborted.";
     } else if (rv != PP_OK) {
-      return ReportError("DirectoryReader::GetNextEntry", rv);
+      return ReportError("DirectoryReader::ReadEntries", rv);
     }
   }
 
diff --git a/ppapi/tests/test_directory_reader.h b/ppapi/tests/test_directory_reader.h
index 8f68530..ee446c5 100644
--- a/ppapi/tests/test_directory_reader.h
+++ b/ppapi/tests/test_directory_reader.h
@@ -9,6 +9,10 @@
 
 #include "ppapi/tests/test_case.h"
 
+namespace pp {
+class FileRef;
+}
+
 class TestDirectoryReader : public TestCase {
  public:
   explicit TestDirectoryReader(TestingInstance* instance)
@@ -19,7 +23,9 @@
   virtual void RunTests(const std::string& filter);
 
  private:
-  std::string TestGetNextFile();
+  int32_t DeleteDirectoryRecursively(pp::FileRef*);
+
+  std::string TestReadEntries();
 };
 
 #endif  // PAPPI_TESTS_TEST_DIRECTORY_READER_H_
diff --git a/ppapi/tests/test_file_io.cc b/ppapi/tests/test_file_io.cc
index c61b31d..ea9224f 100644
--- a/ppapi/tests/test_file_io.cc
+++ b/ppapi/tests/test_file_io.cc
@@ -68,7 +68,8 @@
   int32_t read_offset = offset;
 
   for (;;) {
-    int32_t rv = file_io->Read(read_offset, buf, sizeof(buf), callback);
+    int32_t rv = file_io->Read(read_offset, buf, sizeof(buf),
+                               callback.GetCallback());
     if (rv == PP_OK_COMPLETIONPENDING)
       rv = callback.WaitForResult();
     if (rv < 0)
@@ -82,6 +83,29 @@
   return PP_OK;
 }
 
+int32_t ReadToArrayEntireFile(PP_Instance instance,
+                              pp::FileIO* file_io,
+                              int32_t offset,
+                              std::string* data,
+                              bool force_async) {
+  TestCompletionCallbackWithOutput< std::vector<char> > callback(
+      instance, force_async);
+
+  for (;;) {
+    callback.WaitForResult(file_io->Read(offset, 256, callback));
+    int32_t rv = callback.result();
+    if (rv < 0)
+      return rv;
+    if (rv == 0)
+      break;
+    assert(rv == static_cast<int32_t>(callback.output().size()));
+    offset += rv;
+    data->append(callback.output().begin(), callback.output().end());
+  }
+
+  return PP_OK;
+}
+
 int32_t WriteEntireBuffer(PP_Instance instance,
                           pp::FileIO* file_io,
                           int32_t offset,
@@ -93,7 +117,8 @@
 
   while (write_offset < offset + size) {
     int32_t rv = file_io->Write(write_offset, &buf[write_offset - offset],
-                                size - write_offset + offset, callback);
+                                size - write_offset + offset,
+                                callback.GetCallback());
     if (rv == PP_OK_COMPLETIONPENDING)
       rv = callback.WaitForResult();
     if (rv < 0)
@@ -114,7 +139,9 @@
 
 void TestFileIO::RunTests(const std::string& filter) {
   RUN_TEST_FORCEASYNC_AND_NOT(Open, filter);
+  RUN_TEST_FORCEASYNC_AND_NOT(OpenDirectory, filter);
   RUN_TEST_FORCEASYNC_AND_NOT(ReadWriteSetLength, filter);
+  RUN_TEST_FORCEASYNC_AND_NOT(ReadToArrayWriteSetLength, filter);
   RUN_TEST_FORCEASYNC_AND_NOT(TouchQuery, filter);
   RUN_TEST_FORCEASYNC_AND_NOT(AbortCalls, filter);
   RUN_TEST_FORCEASYNC_AND_NOT(ParallelReads, filter);
@@ -132,7 +159,7 @@
 
   pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
   pp::FileRef file_ref(file_system, "/file_open");
-  int32_t rv = file_system.Open(1024, callback);
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -225,12 +252,49 @@
   PASS();
 }
 
+std::string TestFileIO::TestOpenDirectory() {
+  TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+
+  pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
+  if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+    return ReportError("FileSystem::Open force_async", rv);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = callback.WaitForResult();
+  if (rv != PP_OK)
+    return ReportError("FileSystem::Open", rv);
+
+  // Make a directory.
+  pp::FileRef dir_ref(file_system, "/test_dir_open_directory");
+  rv = dir_ref.MakeDirectory(callback.GetCallback());
+  if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+    return ReportError("FileSystem::MakeDirectory force_async", rv);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = callback.WaitForResult();
+  if (rv != PP_OK)
+    return ReportError("FileSystem::MakeDirectory", rv);
+
+  // Open the directory. This is expected to fail since directories cannot be
+  // opened.
+  pp::FileIO file_io(instance_);
+  rv = file_io.Open(dir_ref, PP_FILEOPENFLAG_READ, callback.GetCallback());
+  if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+    return ReportError("FileIO::Open force_async", rv);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = callback.WaitForResult();
+  // Check for failing open operation for the directory.
+  if (rv != PP_ERROR_NOTAFILE)
+    return ReportError("FileIO::Open", rv);
+
+  PASS();
+}
+
 std::string TestFileIO::TestReadWriteSetLength() {
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
 
   pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
   pp::FileRef file_ref(file_system, "/file_read_write_setlength");
-  int32_t rv = file_system.Open(1024, callback);
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -244,7 +308,7 @@
                     PP_FILEOPENFLAG_TRUNCATE |
                     PP_FILEOPENFLAG_READ |
                     PP_FILEOPENFLAG_WRITE,
-                    callback);
+                    callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -260,7 +324,7 @@
   // Check for failing read operation.
   char buf[256];
   rv = file_io.Read(0, buf, -1,  // negative number of bytes to read
-                    callback);
+                    callback.GetCallback());
   if (rv == PP_OK_COMPLETIONPENDING)
     rv = callback.WaitForResult();
   if (rv != PP_ERROR_FAILED)
@@ -275,7 +339,7 @@
     return ReportMismatch("FileIO::Read", read_buffer, "test_test");
 
   // Truncate the file.
-  rv = file_io.SetLength(4, callback);
+  rv = file_io.SetLength(4, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::SetLength force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -314,7 +378,7 @@
                           std::string("test\0\0\0\0test", 12));
 
   // Extend the file.
-  rv = file_io.SetLength(16, callback);
+  rv = file_io.SetLength(16, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::SetLength force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -357,11 +421,155 @@
   PASS();
 }
 
+// This is basically a copy of TestReadWriteSetLength, but with the new Read
+// API.  With this test case, we can make sure the two Read's have the same
+// behavior.
+std::string TestFileIO::TestReadToArrayWriteSetLength() {
+  TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+
+  pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
+  pp::FileRef file_ref(file_system, "/file_read_write_setlength");
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
+  if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+    return ReportError("FileSystem::Open force_async", rv);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = callback.WaitForResult();
+  if (rv != PP_OK)
+    return ReportError("FileSystem::Open", rv);
+
+  pp::FileIO file_io(instance_);
+  rv = file_io.Open(file_ref,
+                    PP_FILEOPENFLAG_CREATE |
+                    PP_FILEOPENFLAG_TRUNCATE |
+                    PP_FILEOPENFLAG_READ |
+                    PP_FILEOPENFLAG_WRITE,
+                    callback.GetCallback());
+  if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+    return ReportError("FileIO::Open force_async", rv);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = callback.WaitForResult();
+  if (rv != PP_OK)
+    return ReportError("FileIO::Open", rv);
+
+  // Write something to the file.
+  rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 0, "test_test");
+  if (rv != PP_OK)
+    return ReportError("FileIO::Write", rv);
+
+  TestCompletionCallbackWithOutput< std::vector<char> > callback2(
+      instance_->pp_instance(), force_async_);
+  // Check for failing read operation.
+  callback2.WaitForResult(
+      file_io.Read(0, -1,  // negative number of bytes to read
+                   callback2));
+  CHECK_CALLBACK_BEHAVIOR(callback2);
+  if (callback2.result() != PP_ERROR_FAILED)
+    return ReportError("FileIO::Read", callback2.result());
+
+  // Read the entire file.
+  std::string read_buffer;
+  read_buffer.reserve(10);
+  rv = ReadToArrayEntireFile(instance_->pp_instance(), &file_io, 0,
+                             &read_buffer, force_async_);
+  if (rv != PP_OK)
+    return ReportError("FileIO::Read", rv);
+  if (read_buffer != "test_test")
+    return ReportMismatch("FileIO::Read", read_buffer, "test_test");
+
+  // Truncate the file.
+  rv = file_io.SetLength(4, callback.GetCallback());
+  if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+    return ReportError("FileIO::SetLength force_async", rv);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = callback.WaitForResult();
+  if (rv != PP_OK)
+    return ReportError("FileIO::SetLength", rv);
+
+  // Check the file contents.
+  read_buffer.clear();
+  rv = ReadToArrayEntireFile(instance_->pp_instance(), &file_io, 0,
+                             &read_buffer, force_async_);
+  if (rv != PP_OK)
+    return ReportError("FileIO::Read", rv);
+  if (read_buffer != "test")
+    return ReportMismatch("FileIO::Read", read_buffer, "test");
+
+  // Try to read past the end of the file.
+  read_buffer.clear();
+  rv = ReadToArrayEntireFile(instance_->pp_instance(), &file_io, 100,
+                             &read_buffer, force_async_);
+  if (rv != PP_OK)
+    return ReportError("FileIO::Read", rv);
+  if (!read_buffer.empty())
+    return ReportMismatch("FileIO::Read", read_buffer, "<empty string>");
+
+  // Write past the end of the file. The file should be zero-padded.
+  rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 8, "test");
+  if (rv != PP_OK)
+    return ReportError("FileIO::Write", rv);
+
+  // Check the contents of the file.
+  read_buffer.clear();
+  rv = ReadToArrayEntireFile(instance_->pp_instance(), &file_io, 0,
+                             &read_buffer, force_async_);
+  if (rv != PP_OK)
+    return ReportError("FileIO::Read", rv);
+  if (read_buffer != std::string("test\0\0\0\0test", 12))
+    return ReportMismatch("FileIO::Read", read_buffer,
+                          std::string("test\0\0\0\0test", 12));
+
+  // Extend the file.
+  rv = file_io.SetLength(16, callback.GetCallback());
+  if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+    return ReportError("FileIO::SetLength force_async", rv);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = callback.WaitForResult();
+  if (rv != PP_OK)
+    return ReportError("FileIO::SetLength", rv);
+
+  // Check the contents of the file.
+  read_buffer.clear();
+  rv = ReadToArrayEntireFile(instance_->pp_instance(), &file_io, 0,
+                             &read_buffer, force_async_);
+  if (rv != PP_OK)
+    return ReportError("FileIO::Read", rv);
+  if (read_buffer != std::string("test\0\0\0\0test\0\0\0\0", 16))
+    return ReportMismatch("FileIO::Read", read_buffer,
+                          std::string("test\0\0\0\0test\0\0\0\0", 16));
+
+  // Write in the middle of the file.
+  rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 4, "test");
+  if (rv != PP_OK)
+    return ReportError("FileIO::Write", rv);
+
+  // Check the contents of the file.
+  read_buffer.clear();
+  rv = ReadToArrayEntireFile(instance_->pp_instance(), &file_io, 0,
+                             &read_buffer, force_async_);
+  if (rv != PP_OK)
+    return ReportError("FileIO::Read", rv);
+  if (read_buffer != std::string("testtesttest\0\0\0\0", 16))
+    return ReportMismatch("FileIO::Read", read_buffer,
+                          std::string("testtesttest\0\0\0\0", 16));
+
+  // Read from the middle of the file.
+  read_buffer.clear();
+  rv = ReadToArrayEntireFile(instance_->pp_instance(), &file_io, 4,
+                             &read_buffer, force_async_);
+  if (rv != PP_OK)
+    return ReportError("FileIO::Read", rv);
+  if (read_buffer != std::string("testtest\0\0\0\0", 12))
+    return ReportMismatch("FileIO::Read", read_buffer,
+                          std::string("testtest\0\0\0\0", 12));
+
+  PASS();
+}
+
 std::string TestFileIO::TestTouchQuery() {
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
 
   pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
-  int32_t rv = file_system.Open(1024, callback);
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -375,7 +583,7 @@
                     PP_FILEOPENFLAG_CREATE |
                     PP_FILEOPENFLAG_TRUNCATE |
                     PP_FILEOPENFLAG_WRITE,
-                    callback);
+                    callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -384,7 +592,7 @@
     return ReportError("FileIO::Open", rv);
 
   // Write some data to have a non-zero file size.
-  rv = file_io.Write(0, "test", 4, callback);
+  rv = file_io.Write(0, "test", 4, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Write force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -396,7 +604,8 @@
   // last_modified_time's granularity is 2 seconds
   const PP_Time last_access_time = 123 * 24 * 3600.0;
   const PP_Time last_modified_time = 246.0;
-  rv = file_io.Touch(last_access_time, last_modified_time, callback);
+  rv = file_io.Touch(last_access_time, last_modified_time,
+                     callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Touch force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -405,7 +614,7 @@
     return ReportError("FileIO::Touch", rv);
 
   PP_FileInfo info;
-  rv = file_io.Query(&info, callback);
+  rv = file_io.Query(&info, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Query force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -421,7 +630,7 @@
     return "FileIO::Query() has returned bad data.";
 
   // Call |Query()| again, to make sure it works a second time.
-  rv = file_io.Query(&info, callback);
+  rv = file_io.Query(&info, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Query force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -437,7 +646,7 @@
 
   pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
   pp::FileRef file_ref(file_system, "/file_abort_calls");
-  int32_t rv = file_system.Open(1024, callback);
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -450,7 +659,7 @@
     pp::FileIO file_io(instance_);
     rv = file_io.Open(file_ref,
                       PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_WRITE,
-                      callback);
+                      callback.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return ReportError("FileIO::Open force_async", rv);
     if (rv == PP_OK_COMPLETIONPENDING)
@@ -470,8 +679,8 @@
   // Abort |Open()|.
   {
     callback.reset_run_count();
-    rv = pp::FileIO(instance_)
-        .Open(file_ref, PP_FILEOPENFLAG_READ,callback);
+    rv = pp::FileIO(instance_).Open(file_ref, PP_FILEOPENFLAG_READ,
+                                    callback.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return ReportError("FileIO::Open force_async", rv);
     if (callback.run_count() > 0)
@@ -490,7 +699,7 @@
     PP_FileInfo info = { 0 };
     {
       pp::FileIO file_io(instance_);
-      rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback);
+      rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback.GetCallback());
       if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::Open force_async", rv);
       if (rv == PP_OK_COMPLETIONPENDING)
@@ -499,7 +708,7 @@
         return ReportError("FileIO::Open", rv);
 
       callback.reset_run_count();
-      rv = file_io.Query(&info, callback);
+      rv = file_io.Query(&info, callback.GetCallback());
       if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::Query force_async", rv);
     }  // Destroy |file_io|.
@@ -521,7 +730,8 @@
   {
     {
       pp::FileIO file_io(instance_);
-      rv = file_io.Open(file_ref, PP_FILEOPENFLAG_WRITE, callback);
+      rv = file_io.Open(file_ref, PP_FILEOPENFLAG_WRITE,
+                        callback.GetCallback());
       if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::Open force_async", rv);
       if (rv == PP_OK_COMPLETIONPENDING)
@@ -530,7 +740,7 @@
         return ReportError("FileIO::Open", rv);
 
       callback.reset_run_count();
-      rv = file_io.Touch(0, 0, callback);
+      rv = file_io.Touch(0, 0, callback.GetCallback());
       if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::Touch force_async", rv);
     }  // Destroy |file_io|.
@@ -548,7 +758,7 @@
     char buf[3] = { 0 };
     {
       pp::FileIO file_io(instance_);
-      rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback);
+      rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback.GetCallback());
       if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::Open force_async", rv);
       if (rv == PP_OK_COMPLETIONPENDING)
@@ -557,7 +767,7 @@
         return ReportError("FileIO::Open", rv);
 
       callback.reset_run_count();
-      rv = file_io.Read(0, buf, sizeof(buf), callback);
+      rv = file_io.Read(0, buf, sizeof(buf), callback.GetCallback());
       if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::Read force_async", rv);
     }  // Destroy |file_io|.
@@ -580,7 +790,7 @@
     char buf[3] = { 0 };
     {
       pp::FileIO file_io(instance_);
-      rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback);
+      rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback.GetCallback());
       if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::Open force_async", rv);
       if (rv == PP_OK_COMPLETIONPENDING)
@@ -589,7 +799,7 @@
         return ReportError("FileIO::Open", rv);
 
       callback.reset_run_count();
-      rv = file_io.Write(0, buf, sizeof(buf), callback);
+      rv = file_io.Write(0, buf, sizeof(buf), callback.GetCallback());
       if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::Write force_async", rv);
     }  // Destroy |file_io|.
@@ -606,7 +816,7 @@
   {
     {
       pp::FileIO file_io(instance_);
-      rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback);
+      rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback.GetCallback());
       if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::Open force_async", rv);
       if (rv == PP_OK_COMPLETIONPENDING)
@@ -615,7 +825,7 @@
         return ReportError("FileIO::Open", rv);
 
       callback.reset_run_count();
-      rv = file_io.SetLength(3, callback);
+      rv = file_io.SetLength(3, callback.GetCallback());
       if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::SetLength force_async", rv);
     }  // Destroy |file_io|.
@@ -632,7 +842,7 @@
   {
     {
       pp::FileIO file_io(instance_);
-      rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback);
+      rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback.GetCallback());
       if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::Open force_async", rv);
       if (rv == PP_OK_COMPLETIONPENDING)
@@ -641,7 +851,7 @@
         return ReportError("FileIO::Open", rv);
 
       callback.reset_run_count();
-      rv = file_io.Flush(callback);
+      rv = file_io.Flush(callback.GetCallback());
       if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::Flush force_async", rv);
     }  // Destroy |file_io|.
@@ -664,7 +874,7 @@
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
   pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
   pp::FileRef file_ref(file_system, "/file_parallel_reads");
-  int32_t rv = file_system.Open(1024, callback);
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -678,7 +888,7 @@
                     PP_FILEOPENFLAG_TRUNCATE |
                     PP_FILEOPENFLAG_READ |
                     PP_FILEOPENFLAG_WRITE,
-                    callback);
+                    callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -715,13 +925,15 @@
   int32_t rv_2 = PP_OK;
   while (size_1 >= 0 && size_2 >= 0 && size_1 + size_2 > 0) {
     if (size_1 > 0) {
-      rv_1 = file_io.Read(read_offset_1, buf_1, size_1, callback_1);
+      rv_1 = file_io.Read(read_offset_1, buf_1, size_1,
+                          callback_1.GetCallback());
       if (rv_1 != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::Read", rv_1);
     }
 
     if (size_2 > 0) {
-      rv_2 = file_io.Read(read_offset_2, buf_2, size_2, callback_2);
+      rv_2 = file_io.Read(read_offset_2, buf_2, size_2,
+                          callback_2.GetCallback());
       if (rv_2 != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::Read", rv_2);
     }
@@ -770,7 +982,7 @@
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
   pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
   pp::FileRef file_ref(file_system, "/file_parallel_writes");
-  int32_t rv = file_system.Open(1024, callback);
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -784,7 +996,7 @@
                     PP_FILEOPENFLAG_TRUNCATE |
                     PP_FILEOPENFLAG_READ |
                     PP_FILEOPENFLAG_WRITE,
-                    callback);
+                    callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -807,13 +1019,15 @@
   int32_t rv_2 = PP_OK;
   while (size_1 >= 0 && size_2 >= 0 && size_1 + size_2 > 0) {
     if (size_1 > 0) {
-      rv_1 = file_io.Write(write_offset_1, buf_1, size_1, callback_1);
+      rv_1 = file_io.Write(write_offset_1, buf_1, size_1,
+                           callback_1.GetCallback());
       if (rv_1 != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::Write", rv_1);
     }
 
     if (size_2 > 0) {
-      rv_2 = file_io.Write(write_offset_2, buf_2, size_2, callback_2);
+      rv_2 = file_io.Write(write_offset_2, buf_2, size_2,
+                           callback_2.GetCallback());
       if (rv_2 != PP_OK_COMPLETIONPENDING)
         return ReportError("FileIO::Write", rv_2);
     }
@@ -860,7 +1074,7 @@
 
   pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
   pp::FileRef file_ref(file_system, "/file_not_allow_mixed_read_write");
-  int32_t rv = file_system.Open(1024, callback);
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -874,7 +1088,7 @@
                     PP_FILEOPENFLAG_TRUNCATE |
                     PP_FILEOPENFLAG_READ |
                     PP_FILEOPENFLAG_WRITE,
-                    callback);
+                    callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -887,7 +1101,7 @@
   int32_t write_offset_1 = 0;
   const char* buf_1 = "mnopqrstuvw";
   int32_t rv_1 = file_io.Write(write_offset_1, buf_1, strlen(buf_1),
-                               callback_1);
+                               callback_1.GetCallback());
   if (rv_1 != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Write", rv_1);
 
@@ -895,7 +1109,7 @@
   int32_t read_offset_2 = 4;
   char buf_2[3];
   int32_t rv_2 = file_io.Read(read_offset_2, buf_2, sizeof(buf_2),
-                              callback_2);
+                              callback_2.GetCallback());
   if (force_async_ && rv_2 != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Read force_async", rv_2);
   if (rv_2 == PP_OK_COMPLETIONPENDING)
@@ -905,11 +1119,12 @@
   callback_1.WaitForResult();
 
   // Cannot query while a write is pending.
-  rv_1 = file_io.Write(write_offset_1, buf_1, strlen(buf_1), callback_1);
+  rv_1 = file_io.Write(write_offset_1, buf_1, strlen(buf_1),
+                       callback_1.GetCallback());
   ASSERT_EQ(PP_OK_COMPLETIONPENDING, rv_1);
   TestCompletionCallback callback_3(instance_->pp_instance(), force_async_);
   PP_FileInfo info;
-  int32_t rv_3 = file_io.Query(&info, callback_3);
+  int32_t rv_3 = file_io.Query(&info, callback_3.GetCallback());
   if (rv_3 == PP_OK_COMPLETIONPENDING)
     rv_3 = callback_3.WaitForResult();
   if (rv_3 != PP_ERROR_INPROGRESS)
@@ -917,10 +1132,11 @@
   callback_1.WaitForResult();
 
   // Cannot touch while a write is pending.
-  rv_1 = file_io.Write(write_offset_1, buf_1, strlen(buf_1), callback_1);
+  rv_1 = file_io.Write(write_offset_1, buf_1, strlen(buf_1),
+                       callback_1.GetCallback());
   ASSERT_EQ(PP_OK_COMPLETIONPENDING, rv_1);
   TestCompletionCallback callback_4(instance_->pp_instance(), force_async_);
-  int32_t rv_4 = file_io.Touch(1234.0, 5678.0, callback_4);
+  int32_t rv_4 = file_io.Touch(1234.0, 5678.0, callback_4.GetCallback());
   if (rv_4 == PP_OK_COMPLETIONPENDING)
     rv_4 = callback_4.WaitForResult();
   if (rv_4 != PP_ERROR_INPROGRESS)
@@ -928,10 +1144,11 @@
   callback_1.WaitForResult();
 
   // Cannot set length while a write is pending.
-  rv_1 = file_io.Write(write_offset_1, buf_1, strlen(buf_1), callback_1);
+  rv_1 = file_io.Write(write_offset_1, buf_1, strlen(buf_1),
+                       callback_1.GetCallback());
   ASSERT_EQ(PP_OK_COMPLETIONPENDING, rv_1);
   TestCompletionCallback callback_5(instance_->pp_instance(), force_async_);
-  int32_t rv_5 = file_io.SetLength(123, callback_5);
+  int32_t rv_5 = file_io.SetLength(123, callback_5.GetCallback());
   if (rv_5 == PP_OK_COMPLETIONPENDING)
     rv_5 = callback_5.WaitForResult();
   if (rv_5 != PP_ERROR_INPROGRESS)
@@ -946,7 +1163,7 @@
 
   pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
   pp::FileRef file_ref(file_system, "/file_will_write");
-  int32_t rv = file_system.Open(1024, callback);
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -960,7 +1177,7 @@
                     PP_FILEOPENFLAG_TRUNCATE |
                     PP_FILEOPENFLAG_READ |
                     PP_FILEOPENFLAG_WRITE,
-                    callback);
+                    callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -985,7 +1202,7 @@
   // Calling WillWrite.
   rv = trusted->WillWrite(
       file_io.pp_resource(), 0, 9,
-      static_cast<pp::CompletionCallback>(callback).pp_completion_callback());
+      callback.GetCallback().pp_completion_callback());
   if (rv == PP_OK_COMPLETIONPENDING)
     rv = callback.WaitForResult();
   if (rv != 9)
@@ -1006,14 +1223,14 @@
   // Calling WillSetLength.
   rv = trusted->WillSetLength(
       file_io.pp_resource(), 4,
-      static_cast<pp::CompletionCallback>(callback).pp_completion_callback());
+      callback.GetCallback().pp_completion_callback());
   if (rv == PP_OK_COMPLETIONPENDING)
     rv = callback.WaitForResult();
   if (rv != PP_OK)
     return ReportError("WillSetLength", rv);
 
   // Calling actual SetLength.
-  rv = file_io.SetLength(4, callback);
+  rv = file_io.SetLength(4, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::SetLength force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -1061,7 +1278,7 @@
 
   // Setup files for test.
   {
-    int32_t rv = existent_file_ref.Delete(callback);
+    int32_t rv = existent_file_ref.Delete(callback.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return ReportError("FileRef::Delete force_async", rv);
     if (rv == PP_OK_COMPLETIONPENDING)
@@ -1069,7 +1286,7 @@
     if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
       return ReportError("FileRef::Delete", rv);
 
-    rv = nonexistent_file_ref.Delete(callback);
+    rv = nonexistent_file_ref.Delete(callback.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return ReportError("FileRef::Delete force_async", rv);
     if (rv == PP_OK_COMPLETIONPENDING)
@@ -1080,7 +1297,7 @@
     pp::FileIO existent_file_io(instance_);
     rv = existent_file_io.Open(existent_file_ref,
                                PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_WRITE,
-                               callback);
+                               callback.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return ReportError("FileIO::Open force_async", rv);
     if (rv == PP_OK_COMPLETIONPENDING)
@@ -1095,7 +1312,8 @@
   }
 
   pp::FileIO existent_file_io(instance_);
-  int32_t rv = existent_file_io.Open(existent_file_ref, open_flags, callback);
+  int32_t rv = existent_file_io.Open(existent_file_ref, open_flags,
+                                     callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -1107,7 +1325,7 @@
 
   if (!invalid_combination && open_if_exists) {
     PP_FileInfo info;
-    rv = existent_file_io.Query(&info, callback);
+    rv = existent_file_io.Query(&info, callback.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return ReportError("FileIO::Query force_async", rv);
     if (rv == PP_OK_COMPLETIONPENDING)
@@ -1120,7 +1338,8 @@
   }
 
   pp::FileIO nonexistent_file_io(instance_);
-  rv = nonexistent_file_io.Open(nonexistent_file_ref, open_flags, callback);
+  rv = nonexistent_file_io.Open(nonexistent_file_ref, open_flags,
+                                callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
diff --git a/ppapi/tests/test_file_io.h b/ppapi/tests/test_file_io.h
index b971105..8db0ba1 100644
--- a/ppapi/tests/test_file_io.h
+++ b/ppapi/tests/test_file_io.h
@@ -10,6 +10,7 @@
 #include "ppapi/tests/test_case.h"
 
 namespace pp {
+class FileIO;
 class FileSystem;
 }  // namespace pp
 
@@ -37,7 +38,9 @@
   };
 
   std::string TestOpen();
+  std::string TestOpenDirectory();
   std::string TestReadWriteSetLength();
+  std::string TestReadToArrayWriteSetLength();
   std::string TestTouchQuery();
   std::string TestAbortCalls();
   std::string TestParallelReads();
diff --git a/ppapi/tests/test_file_ref.cc b/ppapi/tests/test_file_ref.cc
index 0e42d1c..3c91f18 100644
--- a/ppapi/tests/test_file_ref.cc
+++ b/ppapi/tests/test_file_ref.cc
@@ -10,6 +10,8 @@
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/c/ppb_file_io.h"
 #include "ppapi/c/dev/ppb_testing_dev.h"
+#include "ppapi/cpp/dev/directory_entry_dev.h"
+#include "ppapi/cpp/dev/directory_reader_dev.h"
 #include "ppapi/cpp/file_io.h"
 #include "ppapi/cpp/file_ref.h"
 #include "ppapi/cpp/file_system.h"
@@ -30,6 +32,9 @@
 const char* kParentPath = "/foo/bar";
 const char* kPersFilePath = "/foo/bar/persistent";
 const char* kTempFilePath = "/foo/bar/temporary";
+#ifndef PPAPI_OS_NACL  // Only used for a test that NaCl can't run yet.
+const char* kTerribleName = "!@#$%^&*()-_=+{}[] ;:'\"|`~\t\n\r\b?";
+#endif
 
 std::string ReportMismatch(const std::string& method_name,
                            const std::string& returned_result,
@@ -54,6 +59,9 @@
   RUN_TEST_FORCEASYNC_AND_NOT(QueryAndTouchFile, filter);
   RUN_TEST_FORCEASYNC_AND_NOT(DeleteFileAndDirectory, filter);
   RUN_TEST_FORCEASYNC_AND_NOT(RenameFileAndDirectory, filter);
+#ifndef PPAPI_OS_NACL  // NaCl can't run this test yet.
+  RUN_TEST_FORCEASYNC_AND_NOT(FileNameEscaping, filter);
+#endif
 }
 
 std::string TestFileRef::TestCreate() {
@@ -107,7 +115,7 @@
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
 
   pp::URLLoader loader(instance_);
-  int32_t rv = loader.Open(request, callback);
+  int32_t rv = loader.Open(request, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("URLLoader::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -158,7 +166,7 @@
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
 
   pp::URLLoader loader(instance_);
-  int32_t rv = loader.Open(request, callback);
+  int32_t rv = loader.Open(request, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("URLLoader::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -204,7 +212,7 @@
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
 
   pp::URLLoader loader(instance_);
-  int32_t rv = loader.Open(request, callback);
+  int32_t rv = loader.Open(request, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("URLLoader::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -261,7 +269,7 @@
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
 
   pp::URLLoader loader(instance_);
-  int32_t rv = loader.Open(request, callback);
+  int32_t rv = loader.Open(request, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("URLLoader::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -288,7 +296,7 @@
 
   // Open.
   pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
-  int32_t rv = file_system.Open(1024, callback);
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -298,7 +306,7 @@
 
   // MakeDirectory.
   pp::FileRef dir_ref(file_system, "/test_dir_make_directory");
-  rv = dir_ref.MakeDirectory(callback);
+  rv = dir_ref.MakeDirectory(callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::MakeDirectory force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -309,7 +317,7 @@
   // MakeDirectory aborted.
   callback.reset_run_count();
   rv = pp::FileRef(file_system, "/test_dir_make_abort")
-      .MakeDirectory(callback);
+      .MakeDirectory(callback.GetCallback());
   if (callback.run_count() > 0)
     return "FileSystem::MakeDirectory ran callback synchronously.";
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
@@ -324,7 +332,7 @@
 
   // MakeDirectoryIncludingAncestors.
   dir_ref = pp::FileRef(file_system, "/dir_make_dir_1/dir_make_dir_2");
-  rv = dir_ref.MakeDirectoryIncludingAncestors(callback);
+  rv = dir_ref.MakeDirectoryIncludingAncestors(callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::MakeDirectory force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -335,7 +343,7 @@
   // MakeDirectoryIncludingAncestors aborted.
   callback.reset_run_count();
   rv = pp::FileRef(file_system, "/dir_make_abort_1/dir_make_abort_2")
-      .MakeDirectoryIncludingAncestors(callback);
+      .MakeDirectoryIncludingAncestors(callback.GetCallback());
   if (callback.run_count() > 0) {
     return "FileSystem::MakeDirectoryIncludingAncestors "
            "ran callback synchronously.";
@@ -353,7 +361,7 @@
 
   // MakeDirectory with nested path.
   dir_ref = pp::FileRef(file_system, "/dir_make_dir_3/dir_make_dir_4");
-  rv = dir_ref.MakeDirectory(callback);
+  rv = dir_ref.MakeDirectory(callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::MakeDirectory force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -369,7 +377,7 @@
 std::string TestFileRef::TestQueryAndTouchFile() {
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
   pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
-  int32_t rv = file_system.Open(1024, callback);
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -383,7 +391,7 @@
                     PP_FILEOPENFLAG_CREATE |
                     PP_FILEOPENFLAG_TRUNCATE |
                     PP_FILEOPENFLAG_WRITE,
-                    callback);
+                    callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -392,7 +400,7 @@
     return ReportError("FileIO::Open", rv);
 
   // Write some data to have a non-zero file size.
-  rv = file_io.Write(0, "test", 4, callback);
+  rv = file_io.Write(0, "test", 4, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Write force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -405,7 +413,8 @@
   // last_modified_time's granularity is 2 seconds
   const PP_Time last_access_time = 123 * 24 * 3600.0;
   const PP_Time last_modified_time = 246.0;
-  rv = file_ref.Touch(last_access_time, last_modified_time, callback);
+  rv = file_ref.Touch(last_access_time, last_modified_time,
+                      callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::Touch force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -416,7 +425,7 @@
   // Touch aborted.
   callback.reset_run_count();
   rv = pp::FileRef(file_system, "/file_touch_abort")
-      .Touch(last_access_time, last_modified_time, callback);
+      .Touch(last_access_time, last_modified_time, callback.GetCallback());
   if (callback.run_count() > 0)
     return "FileSystem::Touch ran callback synchronously.";
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
@@ -431,7 +440,7 @@
 
   // Query.
   PP_FileInfo info;
-  rv = file_io.Query(&info, callback);
+  rv = file_io.Query(&info, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::Query force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -451,7 +460,7 @@
   callback.reset_run_count();
   // TODO(viettrungluu): check |info| for late writes.
   rv = pp::FileRef(file_system, "/file_touch").Touch(
-      last_access_time, last_modified_time, callback);
+      last_access_time, last_modified_time, callback.GetCallback());
   if (callback.run_count() > 0)
     return "FileSystem::Touch ran callback synchronously.";
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
@@ -470,7 +479,7 @@
 std::string TestFileRef::TestDeleteFileAndDirectory() {
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
   pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
-  int32_t rv = file_system.Open(1024, callback);
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -480,7 +489,7 @@
 
   pp::FileRef file_ref(file_system, "/file_delete");
   pp::FileIO file_io(instance_);
-  rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback);
+  rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -488,7 +497,7 @@
   if (rv != PP_OK)
     return ReportError("FileIO::Open", rv);
 
-  rv = file_ref.Delete(callback);
+  rv = file_ref.Delete(callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileRef::Delete force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -497,7 +506,7 @@
     return ReportError("FileRef::Delete", rv);
 
   pp::FileRef dir_ref(file_system, "/dir_delete");
-  rv = dir_ref.MakeDirectory(callback);
+  rv = dir_ref.MakeDirectory(callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileRef::MakeDirectory force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -505,7 +514,7 @@
   if (rv != PP_OK)
     return ReportError("FileRef::MakeDirectory", rv);
 
-  rv = dir_ref.Delete(callback);
+  rv = dir_ref.Delete(callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileRef::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -514,7 +523,7 @@
     return ReportError("FileRef::Delete", rv);
 
   pp::FileRef nested_dir_ref(file_system, "/dir_delete_1/dir_delete_2");
-  rv = nested_dir_ref.MakeDirectoryIncludingAncestors(callback);
+  rv = nested_dir_ref.MakeDirectoryIncludingAncestors(callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileRef::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -524,7 +533,7 @@
 
   // Hang on to a ref to the parent; otherwise the callback will be aborted.
   pp::FileRef parent_dir_ref = nested_dir_ref.GetParent();
-  rv = parent_dir_ref.Delete(callback);
+  rv = parent_dir_ref.Delete(callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileRef::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -533,7 +542,7 @@
     return ReportError("FileRef::Delete", rv);
 
   pp::FileRef nonexistent_file_ref(file_system, "/nonexistent_file_delete");
-  rv = nonexistent_file_ref.Delete(callback);
+  rv = nonexistent_file_ref.Delete(callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileRef::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -545,7 +554,8 @@
   {
     pp::FileRef file_ref_abort(file_system, "/file_delete_abort");
     pp::FileIO file_io_abort(instance_);
-    rv = file_io_abort.Open(file_ref_abort, PP_FILEOPENFLAG_CREATE, callback);
+    rv = file_io_abort.Open(file_ref_abort, PP_FILEOPENFLAG_CREATE,
+                            callback.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return ReportError("FileIO::Open force_async", rv);
     if (rv == PP_OK_COMPLETIONPENDING)
@@ -554,7 +564,7 @@
       return ReportError("FileIO::Open", rv);
 
     callback.reset_run_count();
-    rv = file_ref_abort.Delete(callback);
+    rv = file_ref_abort.Delete(callback.GetCallback());
   }
   if (callback.run_count() > 0)
     return "FileRef::Delete ran callback synchronously.";
@@ -574,7 +584,7 @@
 std::string TestFileRef::TestRenameFileAndDirectory() {
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
   pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
-  int32_t rv = file_system.Open(1024, callback);
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileSystem::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -584,7 +594,7 @@
 
   pp::FileRef file_ref(file_system, "/file_rename");
   pp::FileIO file_io(instance_);
-  rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback);
+  rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileIO::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -593,7 +603,7 @@
     return ReportError("FileIO::Open", rv);
 
   pp::FileRef target_file_ref(file_system, "/target_file_rename");
-  rv = file_ref.Rename(target_file_ref, callback);
+  rv = file_ref.Rename(target_file_ref, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileRef::Rename force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -602,7 +612,7 @@
     return ReportError("FileRef::Rename", rv);
 
   pp::FileRef dir_ref(file_system, "/dir_rename");
-  rv = dir_ref.MakeDirectory(callback);
+  rv = dir_ref.MakeDirectory(callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileRef::MakeDirectory force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -611,7 +621,7 @@
     return ReportError("FileRef::MakeDirectory", rv);
 
   pp::FileRef target_dir_ref(file_system, "/target_dir_rename");
-  rv = dir_ref.Rename(target_dir_ref, callback);
+  rv = dir_ref.Rename(target_dir_ref, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileRef::Rename force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -620,7 +630,7 @@
     return ReportError("FileRef::Rename", rv);
 
   pp::FileRef nested_dir_ref(file_system, "/dir_rename_1/dir_rename_2");
-  rv = nested_dir_ref.MakeDirectoryIncludingAncestors(callback);
+  rv = nested_dir_ref.MakeDirectoryIncludingAncestors(callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileRef::MakeDirectory force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -629,7 +639,7 @@
     return ReportError("FileRef::MakeDirectoryIncludingAncestors", rv);
 
   pp::FileRef target_nested_dir_ref(file_system, "/dir_rename_1");
-  rv = nested_dir_ref.Rename(target_nested_dir_ref, callback);
+  rv = nested_dir_ref.Rename(target_nested_dir_ref, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("FileRef::Open force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -645,7 +655,8 @@
   {
     pp::FileRef file_ref_abort(file_system, "/file_rename_abort");
     pp::FileIO file_io_abort(instance_);
-    rv = file_io_abort.Open(file_ref_abort, PP_FILEOPENFLAG_CREATE, callback);
+    rv = file_io_abort.Open(file_ref_abort, PP_FILEOPENFLAG_CREATE,
+                            callback.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return ReportError("FileIO::Open force_async", rv);
     if (rv == PP_OK_COMPLETIONPENDING)
@@ -654,7 +665,7 @@
       return ReportError("FileIO::Open", rv);
 
     callback.reset_run_count();
-    rv = file_ref_abort.Rename(target_file_ref_abort, callback);
+    rv = file_ref_abort.Rename(target_file_ref_abort, callback.GetCallback());
   }
   if (callback.run_count() > 0)
     return "FileSystem::Rename ran callback synchronously.";
@@ -670,3 +681,63 @@
 
   PASS();
 }
+
+#ifndef PPAPI_OS_NACL
+std::string TestFileRef::TestFileNameEscaping() {
+  TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+  pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
+  int32_t rv = file_system.Open(1024, callback.GetCallback());
+  if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+    return ReportError("FileSystem::Open force_async", rv);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = callback.WaitForResult();
+  if (rv != PP_OK)
+    return ReportError("FileSystem::Open", rv);
+
+  std::string test_dir_path = "/dir_for_escaping_test";
+  // Create a directory in which to test.
+  pp::FileRef test_dir_ref(file_system, test_dir_path.c_str());
+  rv = test_dir_ref.MakeDirectory(callback.GetCallback());
+  if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+    return ReportError("FileRef::MakeDirectory force_async", rv);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = callback.WaitForResult();
+  if (rv != PP_OK)
+    return ReportError("FileRef::MakeDirectory", rv);
+
+  // Create the file with the terrible name.
+  std::string full_file_path = test_dir_path + "/" + kTerribleName;
+  pp::FileRef file_ref(file_system, full_file_path.c_str());
+  pp::FileIO file_io(instance_);
+  rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback.GetCallback());
+  if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+    return ReportError("FileIO::Open force_async", rv);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = callback.WaitForResult();
+  if (rv != PP_OK)
+    return ReportError("FileIO::Open", rv);
+
+  // DirectoryReader only works out-of-process.
+  if (testing_interface_->IsOutOfProcess()) {
+    TestCompletionCallbackWithOutput< std::vector<pp::DirectoryEntry_Dev> >
+        output_callback(instance_->pp_instance(), force_async_);
+    pp::DirectoryReader_Dev directory_reader(test_dir_ref);
+
+    rv = directory_reader.ReadEntries(output_callback);
+    if (rv == PP_OK_COMPLETIONPENDING)
+      rv = output_callback.WaitForResult();
+    if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
+      return ReportError("DirectoryEntry_Dev::ReadEntries", rv);
+
+    std::vector<pp::DirectoryEntry_Dev> entries = output_callback.output();
+    if (entries.empty())
+      return "Entry was not found.";
+    if (entries.size() != 1)
+      return "Directory had too many entries.";
+    if (entries.front().file_ref().GetName().AsString() != kTerribleName)
+      return "Entry name did not match.";
+  }
+
+  PASS();
+}
+#endif
diff --git a/ppapi/tests/test_file_ref.h b/ppapi/tests/test_file_ref.h
index e162815..916ea35 100644
--- a/ppapi/tests/test_file_ref.h
+++ b/ppapi/tests/test_file_ref.h
@@ -27,6 +27,7 @@
   std::string TestQueryAndTouchFile();
   std::string TestDeleteFileAndDirectory();
   std::string TestRenameFileAndDirectory();
+  std::string TestFileNameEscaping();
 };
 
 #endif  // PAPPI_TESTS_TEST_FILE_REF_H_
diff --git a/ppapi/tests/test_file_system.cc b/ppapi/tests/test_file_system.cc
index 3874295..9601f54 100644
--- a/ppapi/tests/test_file_system.cc
+++ b/ppapi/tests/test_file_system.cc
@@ -27,15 +27,15 @@
 
   // Open.
   pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
-  callback.WaitForResult(file_system.Open(1024, callback));
+  callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
   CHECK_CALLBACK_BEHAVIOR(callback);
   ASSERT_EQ(PP_OK, callback.result());
 
   // Open aborted (see the DirectoryReader test for comments).
   int32_t rv = 0;
   {
-    rv = pp::FileSystem(instance_,
-                        PP_FILESYSTEMTYPE_LOCALTEMPORARY).Open(1024, callback);
+    pp::FileSystem fs(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
+    rv = fs.Open(1024, callback.GetCallback());
   }
   callback.WaitForAbortResult(rv);
   CHECK_CALLBACK_BEHAVIOR(callback);
@@ -48,10 +48,10 @@
   // open has completed.
   TestCompletionCallback callback_1(instance_->pp_instance(), force_async_);
   pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
-  int32_t rv_1 = file_system.Open(1024, callback_1);
+  int32_t rv_1 = file_system.Open(1024, callback_1.GetCallback());
 
   TestCompletionCallback callback_2(instance_->pp_instance(), force_async_);
-  callback_2.WaitForResult(file_system.Open(1024, callback_2));
+  callback_2.WaitForResult(file_system.Open(1024, callback_2.GetCallback()));
   CHECK_CALLBACK_BEHAVIOR(callback_2);
   // FileSystem should not allow multiple opens.
   ASSERT_NE(PP_OK, callback_2.result());
@@ -61,7 +61,7 @@
   ASSERT_EQ(PP_OK, callback_1.result());
 
   TestCompletionCallback callback_3(instance_->pp_instance(), force_async_);
-  callback_3.WaitForResult(file_system.Open(1024, callback_3));
+  callback_3.WaitForResult(file_system.Open(1024, callback_3.GetCallback()));
   CHECK_CALLBACK_BEHAVIOR(callback_3);
   ASSERT_NE(PP_OK, callback_3.result());
 
diff --git a/ppapi/tests/test_flash.cc b/ppapi/tests/test_flash.cc
index 458de78..bb999fd 100644
--- a/ppapi/tests/test_flash.cc
+++ b/ppapi/tests/test_flash.cc
@@ -8,11 +8,13 @@
 #include "ppapi/c/private/ppb_flash.h"
 #include "ppapi/cpp/instance.h"
 #include "ppapi/cpp/module.h"
+#include "ppapi/cpp/private/flash.h"
 #include "ppapi/cpp/var.h"
 #include "ppapi/tests/testing_instance.h"
 
 REGISTER_TEST_CASE(Flash);
 
+using pp::flash::Flash;
 using pp::Var;
 
 TestFlash::TestFlash(TestingInstance* instance)
@@ -20,72 +22,45 @@
       PP_ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) {
 }
 
-bool TestFlash::Init() {
-  flash_interface_ = static_cast<const PPB_Flash*>(
-      pp::Module::Get()->GetBrowserInterface(PPB_FLASH_INTERFACE));
-  return !!flash_interface_;
-}
-
 void TestFlash::RunTests(const std::string& filter) {
   RUN_TEST(SetInstanceAlwaysOnTop, filter);
   RUN_TEST(GetProxyForURL, filter);
-  RUN_TEST(MessageLoop, filter);
   RUN_TEST(GetLocalTimeZoneOffset, filter);
   RUN_TEST(GetCommandLineArgs, filter);
-  RUN_TEST(GetDeviceID, filter);
-  RUN_TEST(GetSettingInt, filter);
   RUN_TEST(GetSetting, filter);
   RUN_TEST(SetCrashData, filter);
 }
 
 std::string TestFlash::TestSetInstanceAlwaysOnTop() {
-  flash_interface_->SetInstanceAlwaysOnTop(instance_->pp_instance(), PP_TRUE);
-  flash_interface_->SetInstanceAlwaysOnTop(instance_->pp_instance(), PP_FALSE);
+  Flash::SetInstanceAlwaysOnTop(instance_, PP_TRUE);
+  Flash::SetInstanceAlwaysOnTop(instance_, PP_FALSE);
   PASS();
 }
 
 std::string TestFlash::TestGetProxyForURL() {
-  Var result(pp::PASS_REF,
-             flash_interface_->GetProxyForURL(instance_->pp_instance(),
-                                              "http://127.0.0.1/foobar/"));
+  Var result = Flash::GetProxyForURL(instance_, "http://127.0.0.1/foobar/");
   ASSERT_TRUE(result.is_string());
   // Assume no one configures a proxy for localhost.
   ASSERT_EQ("DIRECT", result.AsString());
 
-  result = Var(pp::PASS_REF,
-               flash_interface_->GetProxyForURL(instance_->pp_instance(),
-                                                "http://www.google.com"));
+  result = Flash::GetProxyForURL(instance_, "http://www.google.com");
   // Don't know what the proxy might be, but it should be a valid result.
   ASSERT_TRUE(result.is_string());
 
-  result = Var(pp::PASS_REF,
-               flash_interface_->GetProxyForURL(instance_->pp_instance(),
-                                                "file:///tmp"));
+  result = Flash::GetProxyForURL(instance_, "file:///tmp");
   ASSERT_TRUE(result.is_string());
   // Should get "DIRECT" for file:// URLs.
   ASSERT_EQ("DIRECT", result.AsString());
 
-  result = Var(pp::PASS_REF,
-               flash_interface_->GetProxyForURL(instance_->pp_instance(),
-                                                "this_isnt_an_url"));
+  result = Flash::GetProxyForURL(instance_, "this_isnt_an_url");
   // Should be an error.
   ASSERT_TRUE(result.is_undefined());
 
   PASS();
 }
 
-std::string TestFlash::TestMessageLoop() {
-  pp::CompletionCallback callback =
-      callback_factory_.NewCallback(&TestFlash::QuitMessageLoopTask);
-  pp::Module::Get()->core()->CallOnMainThread(0, callback);
-  flash_interface_->RunMessageLoop(instance_->pp_instance());
-
-  PASS();
-}
-
 std::string TestFlash::TestGetLocalTimeZoneOffset() {
-  double result = flash_interface_->GetLocalTimeZoneOffset(
-      instance_->pp_instance(), 1321491298.0);
+  double result = Flash::GetLocalTimeZoneOffset(instance_, 1321491298.0);
   // The result depends on the local time zone, but +/- 14h from UTC should
   // cover the possibilities.
   ASSERT_TRUE(result >= -14 * 60 * 60);
@@ -95,83 +70,46 @@
 }
 
 std::string TestFlash::TestGetCommandLineArgs() {
-  Var result(pp::PASS_REF,
-             flash_interface_->GetCommandLineArgs(
-                 pp::Module::Get()->pp_module()));
+  Var result = Flash::GetCommandLineArgs(pp::Module::Get());
   ASSERT_TRUE(result.is_string());
 
   PASS();
 }
 
-std::string TestFlash::TestGetDeviceID() {
-  Var result(pp::PASS_REF,
-             flash_interface_->GetDeviceID(instance_->pp_instance()));
-  // TODO(wad) figure out how to mock the input and test the full flow.
-  ASSERT_TRUE(result.is_string());
-  PASS();
-}
-
-std::string TestFlash::TestGetSettingInt() {
-  // This only works out of process.
-  if (testing_interface_->IsOutOfProcess()) {
-    int32_t is_3denabled = flash_interface_->GetSettingInt(
-        instance_->pp_instance(), PP_FLASHSETTING_3DENABLED);
-    ASSERT_TRUE(is_3denabled == 0 || is_3denabled == 1);
-
-    int32_t is_incognito = flash_interface_->GetSettingInt(
-        instance_->pp_instance(), PP_FLASHSETTING_INCOGNITO);
-    ASSERT_TRUE(is_incognito == 0 || is_incognito == 1);
-
-    int32_t is_stage3denabled = flash_interface_->GetSettingInt(
-        instance_->pp_instance(), PP_FLASHSETTING_STAGE3DENABLED);
-    // This may "fail" if 3d isn't enabled.
-    ASSERT_TRUE((is_stage3denabled == 0 || is_stage3denabled == 1) ||
-                (is_stage3denabled == -1 && is_3denabled == 0));
-  }
-
-  // Invalid instance cases.
-  int32_t result = flash_interface_->GetSettingInt(
-      0, PP_FLASHSETTING_3DENABLED);
-  ASSERT_EQ(-1, result);
-  result = flash_interface_->GetSettingInt(0, PP_FLASHSETTING_INCOGNITO);
-  ASSERT_EQ(-1, result);
-  result = flash_interface_->GetSettingInt(0, PP_FLASHSETTING_STAGE3DENABLED);
-  ASSERT_EQ(-1, result);
-
-  PASS();
-}
-
 std::string TestFlash::TestGetSetting() {
-  // This only works out of process.
-  if (testing_interface_->IsOutOfProcess()) {
-    Var is_3denabled(pp::PASS_REF, flash_interface_->GetSetting(
-        instance_->pp_instance(), PP_FLASHSETTING_3DENABLED));
-    ASSERT_TRUE(is_3denabled.is_bool());
+  Var is_3denabled = Flash::GetSetting(instance_, PP_FLASHSETTING_3DENABLED);
+  ASSERT_TRUE(is_3denabled.is_bool());
 
-    Var is_incognito(pp::PASS_REF, flash_interface_->GetSetting(
-        instance_->pp_instance(), PP_FLASHSETTING_INCOGNITO));
-    ASSERT_TRUE(is_incognito.is_bool());
+  Var is_incognito = Flash::GetSetting(instance_, PP_FLASHSETTING_INCOGNITO);
+  ASSERT_TRUE(is_incognito.is_bool());
 
-    Var is_stage3denabled(pp::PASS_REF, flash_interface_->GetSetting(
-        instance_->pp_instance(), PP_FLASHSETTING_STAGE3DENABLED));
-    // This may "fail" if 3d isn't enabled.
-    ASSERT_TRUE(is_stage3denabled.is_bool() ||
-                (is_stage3denabled.is_undefined() && !is_3denabled.AsBool()));
+  Var is_stage3denabled = Flash::GetSetting(instance_,
+                                            PP_FLASHSETTING_STAGE3DENABLED);
+  // This may "fail" if 3d isn't enabled.
+  ASSERT_TRUE(is_stage3denabled.is_bool() ||
+              (is_stage3denabled.is_undefined() && !is_3denabled.AsBool()));
 
-    Var num_cores(pp::PASS_REF, flash_interface_->GetSetting(
-        instance_->pp_instance(), PP_FLASHSETTING_NUMCORES));
-    ASSERT_TRUE(num_cores.is_int() && num_cores.AsInt() > 0);
-  }
+  Var num_cores = Flash::GetSetting(instance_, PP_FLASHSETTING_NUMCORES);
+  ASSERT_TRUE(num_cores.is_int() && num_cores.AsInt() > 0);
+
+  Var lso_restrictions = Flash::GetSetting(instance_,
+                                           PP_FLASHSETTING_LSORESTRICTIONS);
+  ASSERT_TRUE(lso_restrictions.is_int());
+  int32_t lso_restrictions_int = lso_restrictions.AsInt();
+  ASSERT_TRUE(lso_restrictions_int == PP_FLASHLSORESTRICTIONS_NONE ||
+              lso_restrictions_int == PP_FLASHLSORESTRICTIONS_BLOCK ||
+              lso_restrictions_int == PP_FLASHLSORESTRICTIONS_IN_MEMORY);
 
   // Invalid instance cases.
-  Var result(pp::PASS_REF,
-             flash_interface_->GetSetting(0, PP_FLASHSETTING_3DENABLED));
+  Var result = Flash::GetSetting(
+      pp::InstanceHandle(static_cast<PP_Instance>(0)),
+      PP_FLASHSETTING_3DENABLED);
   ASSERT_TRUE(result.is_undefined());
-  result = Var(pp::PASS_REF,
-               flash_interface_->GetSetting(0, PP_FLASHSETTING_INCOGNITO));
+  result = Flash::GetSetting(pp::InstanceHandle(static_cast<PP_Instance>(0)),
+                             PP_FLASHSETTING_INCOGNITO);
   ASSERT_TRUE(result.is_undefined());
-  result = Var(pp::PASS_REF,
-               flash_interface_->GetSetting(0, PP_FLASHSETTING_STAGE3DENABLED));
+  result = Flash::GetSetting(pp::InstanceHandle(static_cast<PP_Instance>(0)),
+                             PP_FLASHSETTING_STAGE3DENABLED);
   ASSERT_TRUE(result.is_undefined());
 
   PASS();
@@ -179,13 +117,7 @@
 
 std::string TestFlash::TestSetCrashData() {
   pp::Var url("http://...");
-  ASSERT_TRUE(flash_interface_->SetCrashData(instance_->pp_instance(),
-                                             PP_FLASHCRASHKEY_URL,
-                                             url.pp_var()));
+  ASSERT_TRUE(Flash::SetCrashData(instance_, PP_FLASHCRASHKEY_URL, url));
 
   PASS();
 }
-
-void TestFlash::QuitMessageLoopTask(int32_t) {
-  flash_interface_->QuitMessageLoop(instance_->pp_instance());
-}
diff --git a/ppapi/tests/test_flash.h b/ppapi/tests/test_flash.h
index 0643db2..f3f6276 100644
--- a/ppapi/tests/test_flash.h
+++ b/ppapi/tests/test_flash.h
@@ -17,7 +17,6 @@
   explicit TestFlash(TestingInstance* instance);
 
   // TestCase implementation.
-  virtual bool Init();
   virtual void RunTests(const std::string& filter);
 
  private:
@@ -26,17 +25,11 @@
   // std::string TestDrawGlyphs();
   std::string TestGetProxyForURL();
   // std::string TestNavigate();
-  std::string TestMessageLoop();
   std::string TestGetLocalTimeZoneOffset();
   std::string TestGetCommandLineArgs();
-  std::string TestGetDeviceID();
-  std::string TestGetSettingInt();
   std::string TestGetSetting();
   std::string TestSetCrashData();
 
-  void QuitMessageLoopTask(int32_t);
-
-  const PPB_Flash* flash_interface_;
   pp::CompletionCallbackFactory<TestFlash> callback_factory_;
 };
 
diff --git a/ppapi/tests/test_flash_clipboard.cc b/ppapi/tests/test_flash_clipboard.cc
index 432e5d5..e38c145 100644
--- a/ppapi/tests/test_flash_clipboard.cc
+++ b/ppapi/tests/test_flash_clipboard.cc
@@ -15,7 +15,10 @@
 #include "ppapi/cpp/var_array_buffer.h"
 #include "ppapi/tests/testing_instance.h"
 
+// http://crbug.com/176822
+#if !defined(OS_WIN)
 REGISTER_TEST_CASE(FlashClipboard);
+#endif
 
 // WriteData() sends an async request to the browser process. As a result, the
 // string written may not be reflected by IsFormatAvailable() or ReadPlainText()
diff --git a/ppapi/tests/test_flash_file.cc b/ppapi/tests/test_flash_file.cc
index ac88b34..86100d9 100644
--- a/ppapi/tests/test_flash_file.cc
+++ b/ppapi/tests/test_flash_file.cc
@@ -4,6 +4,11 @@
 
 #include "ppapi/tests/test_flash_file.h"
 
+#include <algorithm>
+#include <vector>
+
+#include "ppapi/c/pp_file_info.h"
+#include "ppapi/c/ppb_file_io.h"
 #include "ppapi/cpp/module.h"
 #include "ppapi/cpp/private/flash_file.h"
 #include "ppapi/tests/testing_instance.h"
@@ -74,6 +79,18 @@
   return result;
 }
 
+bool DirEntryEqual(FileModuleLocal::DirEntry i,
+                   FileModuleLocal::DirEntry j) {
+  return i.name == j.name && i.is_dir == j.is_dir;
+}
+
+bool DirEntryLessThan(FileModuleLocal::DirEntry i,
+                      FileModuleLocal::DirEntry j) {
+  if (i.name == j.name)
+    return i.is_dir < j.is_dir;
+  return i.name < j.name;
+}
+
 }  // namespace
 
 REGISTER_TEST_CASE(FlashFile);
@@ -90,15 +107,204 @@
 }
 
 void TestFlashFile::RunTests(const std::string& filter) {
+  RUN_TEST(OpenFile, filter);
+  RUN_TEST(RenameFile, filter);
+  RUN_TEST(DeleteFileOrDir, filter);
+  RUN_TEST(CreateDir, filter);
+  RUN_TEST(QueryFile, filter);
+  RUN_TEST(GetDirContents, filter);
   RUN_TEST(CreateTemporaryFile, filter);
 }
 
-std::string TestFlashFile::TestCreateTemporaryFile() {
-  ASSERT_TRUE(FileModuleLocal::IsCreateTemporaryFileAvailable());
-
+void TestFlashFile::SetUp() {
+  // Clear out existing test data.
+  FileModuleLocal::DeleteFileOrDir(instance_, std::string(), true);
   // Make sure that the root directory exists.
   FileModuleLocal::CreateDir(instance_, std::string());
+}
 
+std::string TestFlashFile::TestOpenFile() {
+  SetUp();
+  std::string filename = "abc.txt";
+  PP_FileHandle file_handle = FileModuleLocal::OpenFile(instance_,
+                                                        filename,
+                                                        PP_FILEOPENFLAG_WRITE |
+                                                        PP_FILEOPENFLAG_CREATE);
+  ASSERT_NE(PP_kInvalidFileHandle, file_handle);
+
+  std::string contents = "This is file.";
+  std::string read_contents;
+  ASSERT_TRUE(WriteFile(file_handle, contents));
+  ASSERT_FALSE(ReadFile(file_handle, &read_contents));
+  CloseFileHandle(file_handle);
+
+  file_handle = FileModuleLocal::OpenFile(instance_,
+                                          filename,
+                                          PP_FILEOPENFLAG_READ);
+  ASSERT_NE(PP_kInvalidFileHandle, file_handle);
+
+  ASSERT_FALSE(WriteFile(file_handle, contents));
+  ASSERT_TRUE(ReadFile(file_handle, &read_contents));
+  ASSERT_EQ(contents, read_contents);
+  CloseFileHandle(file_handle);
+
+  PASS();
+}
+
+std::string TestFlashFile::TestRenameFile() {
+  SetUp();
+  std::string filename = "abc.txt";
+  std::string new_filename = "abc_new.txt";
+  std::string contents = "This is file.";
+  std::string read_contents;
+
+  PP_FileHandle file_handle = FileModuleLocal::OpenFile(instance_,
+                                                        filename,
+                                                        PP_FILEOPENFLAG_WRITE |
+                                                        PP_FILEOPENFLAG_CREATE);
+  ASSERT_NE(PP_kInvalidFileHandle, file_handle);
+  ASSERT_TRUE(WriteFile(file_handle, contents));
+  CloseFileHandle(file_handle);
+
+  ASSERT_TRUE(FileModuleLocal::RenameFile(instance_, filename, new_filename));
+
+  file_handle = FileModuleLocal::OpenFile(instance_,
+                                          new_filename,
+                                          PP_FILEOPENFLAG_READ);
+  ASSERT_NE(PP_kInvalidFileHandle, file_handle);
+  ASSERT_TRUE(ReadFile(file_handle, &read_contents));
+  ASSERT_EQ(contents, read_contents);
+  CloseFileHandle(file_handle);
+
+  // Check that the old file no longer exists.
+  PP_FileInfo unused;
+  ASSERT_FALSE(FileModuleLocal::QueryFile(instance_, filename, &unused));
+
+  PASS();
+}
+
+std::string TestFlashFile::TestDeleteFileOrDir() {
+  SetUp();
+  std::string filename = "abc.txt";
+  std::string dirname = "def";
+  std::string contents = "This is file.";
+
+  // Test file deletion.
+  PP_FileHandle file_handle = FileModuleLocal::OpenFile(instance_,
+                                                        filename,
+                                                        PP_FILEOPENFLAG_WRITE |
+                                                        PP_FILEOPENFLAG_CREATE);
+  ASSERT_NE(PP_kInvalidFileHandle, file_handle);
+  ASSERT_TRUE(WriteFile(file_handle, contents));
+  CloseFileHandle(file_handle);
+  ASSERT_TRUE(FileModuleLocal::DeleteFileOrDir(instance_, filename, false));
+  PP_FileInfo unused;
+  ASSERT_FALSE(FileModuleLocal::QueryFile(instance_, filename, &unused));
+
+  // Test directory deletion.
+  ASSERT_TRUE(FileModuleLocal::CreateDir(instance_, dirname));
+  ASSERT_TRUE(FileModuleLocal::DeleteFileOrDir(instance_, dirname, false));
+  ASSERT_FALSE(FileModuleLocal::QueryFile(instance_, dirname, &unused));
+
+  // Test recursive directory deletion.
+  ASSERT_TRUE(FileModuleLocal::CreateDir(instance_, dirname));
+  file_handle = FileModuleLocal::OpenFile(
+      instance_, dirname + "/" + filename,
+      PP_FILEOPENFLAG_WRITE | PP_FILEOPENFLAG_CREATE);
+  ASSERT_NE(PP_kInvalidFileHandle, file_handle);
+  ASSERT_TRUE(WriteFile(file_handle, contents));
+  CloseFileHandle(file_handle);
+  ASSERT_FALSE(FileModuleLocal::DeleteFileOrDir(instance_, dirname, false));
+  ASSERT_TRUE(FileModuleLocal::DeleteFileOrDir(instance_, dirname, true));
+  ASSERT_FALSE(FileModuleLocal::QueryFile(instance_, filename, &unused));
+
+  PASS();
+}
+
+std::string TestFlashFile::TestCreateDir() {
+  SetUp();
+  std::string dirname = "abc";
+  PP_FileInfo info;
+  ASSERT_FALSE(FileModuleLocal::QueryFile(instance_, dirname, &info));
+  ASSERT_TRUE(FileModuleLocal::CreateDir(instance_, dirname));
+  ASSERT_TRUE(FileModuleLocal::QueryFile(instance_, dirname, &info));
+  ASSERT_EQ(info.type, PP_FILETYPE_DIRECTORY);
+
+  PASS();
+}
+
+std::string TestFlashFile::TestQueryFile() {
+  std::string filename = "abc.txt";
+  std::string dirname = "def";
+  std::string contents = "This is file.";
+  PP_FileInfo info;
+
+  // Test querying a file.
+  PP_FileHandle file_handle = FileModuleLocal::OpenFile(instance_,
+                                                        filename,
+                                                        PP_FILEOPENFLAG_WRITE |
+                                                        PP_FILEOPENFLAG_CREATE);
+  ASSERT_NE(PP_kInvalidFileHandle, file_handle);
+  ASSERT_TRUE(WriteFile(file_handle, contents));
+  CloseFileHandle(file_handle);
+  ASSERT_TRUE(FileModuleLocal::QueryFile(instance_, filename, &info));
+  ASSERT_EQ(static_cast<size_t>(info.size), contents.size());
+  ASSERT_EQ(info.type, PP_FILETYPE_REGULAR);
+  // TODO(raymes): Test the other fields.
+
+  // Test querying a directory.
+  ASSERT_TRUE(FileModuleLocal::CreateDir(instance_, dirname));
+  ASSERT_TRUE(FileModuleLocal::QueryFile(instance_, dirname, &info));
+  ASSERT_EQ(info.type, PP_FILETYPE_DIRECTORY);
+  // TODO(raymes): Test the other fields.
+
+  // Test querying a non-existent file.
+  ASSERT_FALSE(FileModuleLocal::QueryFile(instance_, "xx", &info));
+
+  PASS();
+}
+
+std::string TestFlashFile::TestGetDirContents() {
+  SetUp();
+  std::vector<FileModuleLocal::DirEntry> result;
+  ASSERT_TRUE(FileModuleLocal::GetDirContents(instance_, std::string(),
+                                              &result));
+  ASSERT_EQ(result.size(), 1);
+  ASSERT_EQ(result[0].name, "..");
+  ASSERT_EQ(result[0].is_dir, true);
+
+  std::string filename = "abc.txt";
+  std::string dirname = "def";
+  std::string contents = "This is file.";
+  PP_FileHandle file_handle = FileModuleLocal::OpenFile(instance_,
+                                                        filename,
+                                                        PP_FILEOPENFLAG_WRITE |
+                                                        PP_FILEOPENFLAG_CREATE);
+  ASSERT_NE(PP_kInvalidFileHandle, file_handle);
+  ASSERT_TRUE(WriteFile(file_handle, contents));
+  CloseFileHandle(file_handle);
+  ASSERT_TRUE(FileModuleLocal::CreateDir(instance_, dirname));
+
+  ASSERT_TRUE(FileModuleLocal::GetDirContents(instance_, "", &result));
+  FileModuleLocal::DirEntry expected[] =
+    { {"..", true},
+      {filename, false},
+      {dirname, true}
+    };
+  size_t expected_size = sizeof(expected) / sizeof(expected[0]);
+
+  std::sort(expected, expected + expected_size, DirEntryLessThan);
+  std::sort(result.begin(), result.end(), DirEntryLessThan);
+
+  ASSERT_EQ(expected_size, result.size());
+  ASSERT_TRUE(std::equal(expected, expected + expected_size, result.begin(),
+                         DirEntryEqual));
+
+  PASS();
+}
+
+std::string TestFlashFile::TestCreateTemporaryFile() {
+  SetUp();
   size_t before_create = 0;
   ASSERT_SUBTEST_SUCCESS(GetItemCountUnderModuleLocalRoot(&before_create));
 
diff --git a/ppapi/tests/test_flash_file.h b/ppapi/tests/test_flash_file.h
index b58890d..86055db 100644
--- a/ppapi/tests/test_flash_file.h
+++ b/ppapi/tests/test_flash_file.h
@@ -19,10 +19,21 @@
   virtual void RunTests(const std::string& filter);
 
  private:
-  // TODO(yzshen): Add more test cases for PPB_Flash_File_ModuleLocal and
-  // PPB_Flash_File_FileRef.
+  // TODO(raymes): We should have SetUp/TearDown methods for ppapi tests.
+  void SetUp();
+
+  std::string TestOpenFile();
+  std::string TestRenameFile();
+  std::string TestDeleteFileOrDir();
+  std::string TestCreateDir();
+  std::string TestQueryFile();
+  std::string TestGetDirContents();
   std::string TestCreateTemporaryFile();
 
+  // TODO(raymes): Add these when we can test file chooser properly.
+  // std::string TestOpenFileRef();
+  // std::string TestQueryFileRef();
+
   // Gets the number of files and directories under the module-local root
   // directory.
   std::string GetItemCountUnderModuleLocalRoot(size_t* item_count);
diff --git a/ppapi/tests/test_graphics_2d.cc b/ppapi/tests/test_graphics_2d.cc
index 4b31c92..aea741d 100644
--- a/ppapi/tests/test_graphics_2d.cc
+++ b/ppapi/tests/test_graphics_2d.cc
@@ -14,11 +14,14 @@
 #include "ppapi/c/ppb_graphics_2d.h"
 #include "ppapi/cpp/completion_callback.h"
 #include "ppapi/cpp/dev/graphics_2d_dev.h"
+#include "ppapi/cpp/dev/graphics_2d_dev.h"
 #include "ppapi/cpp/graphics_2d.h"
+#include "ppapi/cpp/graphics_3d.h"
 #include "ppapi/cpp/image_data.h"
 #include "ppapi/cpp/instance.h"
 #include "ppapi/cpp/module.h"
 #include "ppapi/cpp/rect.h"
+#include "ppapi/tests/test_utils.h"
 #include "ppapi/tests/testing_instance.h"
 
 REGISTER_TEST_CASE(Graphics2D);
@@ -63,6 +66,7 @@
   RUN_TEST_FORCEASYNC_AND_NOT(FlushOffscreenUpdate, filter);
   RUN_TEST(Dev, filter);
   RUN_TEST(ReplaceContentsCaching, filter);
+  RUN_TEST(BindNull, filter);
 }
 
 void TestGraphics2D::QuitMessageLoop() {
@@ -89,6 +93,29 @@
   return IsSquareInImage(readback, 0, pp::Rect(dc.size()), color);
 }
 
+bool TestGraphics2D::ResourceHealthCheck(pp::Instance* instance,
+                                         pp::Graphics2D* context) {
+  TestCompletionCallback callback(instance->pp_instance(), callback_type());
+  callback.WaitForResult(context->Flush(callback.GetCallback()));
+  if (callback.result() < 0)
+    return callback.result() != PP_ERROR_FAILED;
+  else if (callback.result() == 0)
+    return false;
+  return true;
+}
+
+bool TestGraphics2D::ResourceHealthCheckForC(pp::Instance* instance,
+                                             PP_Resource graphics_2d) {
+  TestCompletionCallback callback(instance->pp_instance(), callback_type());
+  callback.WaitForResult(graphics_2d_interface_->Flush(
+      graphics_2d, callback.GetCallback().pp_completion_callback()));
+  if (callback.result() < 0)
+    return callback.result() != PP_ERROR_FAILED;
+  else if (callback.result() == 0)
+    return false;
+  return true;
+}
+
 bool TestGraphics2D::FlushAndWaitForDone(pp::Graphics2D* context) {
   int32_t flags = (force_async_ ? 0 : PP_COMPLETIONCALLBACK_FLAG_OPTIONAL);
   pp::CompletionCallback cc(&FlushCallbackQuitMessageLoop, this, flags);
@@ -260,31 +287,40 @@
 
 std::string TestGraphics2D::TestInvalidSize() {
   pp::Graphics2D a(instance_, pp::Size(16, 0), false);
-  if (!a.is_null())
+  if (ResourceHealthCheck(instance_, &a))
     return "0 height accepted";
 
   pp::Graphics2D b(instance_, pp::Size(0, 16), false);
-  if (!b.is_null())
-    return "0 width accepted";
+  if (ResourceHealthCheck(instance_, &b))
+    return "0 height accepted";
 
   // Need to use the C API since pp::Size prevents negative sizes.
   PP_Size size;
   size.width = 16;
   size.height = -16;
-  ASSERT_FALSE(!!graphics_2d_interface_->Create(
-      instance_->pp_instance(), &size, PP_FALSE));
+  PP_Resource graphics = graphics_2d_interface_->Create(
+      instance_->pp_instance(), &size, PP_FALSE);
+  ASSERT_FALSE(ResourceHealthCheckForC(instance_, graphics));
 
   size.width = -16;
   size.height = 16;
-  ASSERT_FALSE(!!graphics_2d_interface_->Create(
-      instance_->pp_instance(), &size, PP_FALSE));
+  graphics = graphics_2d_interface_->Create(
+      instance_->pp_instance(), &size, PP_FALSE);
+  ASSERT_FALSE(ResourceHealthCheckForC(instance_, graphics));
+
+  // Overflow to negative size
+  size.width = std::numeric_limits<int32_t>::max();
+  size.height = std::numeric_limits<int32_t>::max();
+  graphics = graphics_2d_interface_->Create(
+      instance_->pp_instance(), &size, PP_FALSE);
+  ASSERT_FALSE(ResourceHealthCheckForC(instance_, graphics));
 
   PASS();
 }
 
 std::string TestGraphics2D::TestHumongous() {
   pp::Graphics2D a(instance_, pp::Size(100000, 100000), false);
-  if (!a.is_null())
+  if (ResourceHealthCheck(instance_, &a))
     return "Humongous device created";
   PASS();
 }
@@ -816,3 +852,24 @@
 
   PASS();
 }
+
+std::string TestGraphics2D::TestBindNull() {
+  // Binding a null resource is not an error, it should clear all bound
+  // resources. We can't easily test what resource is bound, but we can test
+  // that this doesn't throw an error.
+  ASSERT_TRUE(instance_->BindGraphics(pp::Graphics2D()));
+  ASSERT_TRUE(instance_->BindGraphics(pp::Graphics3D()));
+
+  const int w = 115, h = 117;
+  pp::Graphics2D dc(instance_, pp::Size(w, h), false);
+  if (dc.is_null())
+    return "Failure creating device.";
+  if (!instance_->BindGraphics(dc))
+    return "Failure to bind the boring device.";
+
+  ASSERT_TRUE(instance_->BindGraphics(pp::Graphics2D()));
+  ASSERT_TRUE(instance_->BindGraphics(pp::Graphics3D()));
+
+  PASS();
+}
+
diff --git a/ppapi/tests/test_graphics_2d.h b/ppapi/tests/test_graphics_2d.h
index 193aa44..4107504 100644
--- a/ppapi/tests/test_graphics_2d.h
+++ b/ppapi/tests/test_graphics_2d.h
@@ -66,6 +66,10 @@
   // Validates that the given device context is filled with the given color.
   bool IsDCUniformColor(const pp::Graphics2D& dc, uint32_t color) const;
 
+  // Returns true if Graphics2D resource is created correctly.
+  bool ResourceHealthCheck(pp::Instance* instance, pp::Graphics2D* context);
+  bool ResourceHealthCheckForC(pp::Instance* instance, PP_Resource graphics_2d);
+
   // Issues a flush on the given device context and blocks until the flush
   // has issued its callback. Returns true on success.
   bool FlushAndWaitForDone(pp::Graphics2D* context);
@@ -99,6 +103,7 @@
   std::string TestFlushOffscreenUpdate();
   std::string TestDev();
   std::string TestReplaceContentsCaching();
+  std::string TestBindNull();
 
   // Used by the tests that access the C API directly.
   const PPB_Graphics2D* graphics_2d_interface_;
diff --git a/ppapi/tests/test_graphics_3d.cc b/ppapi/tests/test_graphics_3d.cc
index e1b4e33..987d5a8 100644
--- a/ppapi/tests/test_graphics_3d.cc
+++ b/ppapi/tests/test_graphics_3d.cc
@@ -15,6 +15,7 @@
 #include "ppapi/cpp/graphics_3d.h"
 #include "ppapi/cpp/module.h"
 #include "ppapi/lib/gl/gles2/gl2ext_ppapi.h"
+#include "ppapi/tests/test_case.h"
 #include "ppapi/tests/test_utils.h"
 #include "ppapi/tests/testing_instance.h"
 
@@ -30,9 +31,9 @@
 }
 
 void TestGraphics3D::RunTests(const std::string& filter) {
-  RUN_TEST(FramePPAPI, filter);
-  RUN_TEST(FrameGL, filter);
-  RUN_TEST(ExtensionsGL, filter);
+  RUN_CALLBACK_TEST(TestGraphics3D, FramePPAPI, filter);
+  RUN_CALLBACK_TEST(TestGraphics3D, FrameGL, filter);
+  RUN_CALLBACK_TEST(TestGraphics3D, ExtensionsGL, filter);
 }
 
 std::string TestGraphics3D::TestFramePPAPI() {
@@ -135,8 +136,8 @@
 }
 
 int32_t TestGraphics3D::SwapBuffersSync(pp::Graphics3D* context) {
-  TestCompletionCallback callback(instance_->pp_instance(), true);
-  int32_t rv = context->SwapBuffers(callback);
+  TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+  int32_t rv = context->SwapBuffers(callback.GetCallback());
   if (rv != PP_OK_COMPLETIONPENDING)
     return rv;
 
diff --git a/ppapi/tests/test_host_resolver_private.cc b/ppapi/tests/test_host_resolver_private.cc
index 8de75b3..5531e83 100644
--- a/ppapi/tests/test_host_resolver_private.cc
+++ b/ppapi/tests/test_host_resolver_private.cc
@@ -50,7 +50,7 @@
                                                  const std::string& host,
                                                  uint16_t port) {
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-  int32_t rv = socket->Connect(host.c_str(), port, callback);
+  int32_t rv = socket->Connect(host.c_str(), port, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("PPB_TCPSocket_Private::Connect force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -63,7 +63,7 @@
     pp::TCPSocketPrivate* socket,
     const PP_NetAddress_Private& address) {
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-  int32_t rv = socket->ConnectWithNetAddress(&address, callback);
+  int32_t rv = socket->ConnectWithNetAddress(&address, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("PPB_TCPSocket_Private::Connect force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -77,7 +77,7 @@
                                               int32_t num_bytes,
                                               int32_t* bytes_read) {
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-  int32_t rv = socket->Read(buffer, num_bytes, callback);
+  int32_t rv = socket->Read(buffer, num_bytes, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("PPB_TCPSocket_Private::Read force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -93,7 +93,7 @@
                                                int32_t num_bytes,
                                                int32_t* bytes_written) {
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-  int32_t rv = socket->Write(buffer, num_bytes, callback);
+  int32_t rv = socket->Write(buffer, num_bytes, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("PPB_TCPSocket_Private::Write force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -128,7 +128,7 @@
     uint16_t port,
     const PP_HostResolver_Private_Hint& hint) {
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-  int32_t rv = host_resolver->Resolve(host, port, hint, callback);
+  int32_t rv = host_resolver->Resolve(host, port, hint, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("PPB_HostResolver_Private::Resolve force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
diff --git a/ppapi/tests/test_host_resolver_private_disallowed.cc b/ppapi/tests/test_host_resolver_private_disallowed.cc
new file mode 100644
index 0000000..cc5bce0
--- /dev/null
+++ b/ppapi/tests/test_host_resolver_private_disallowed.cc
@@ -0,0 +1,54 @@
+// 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 "ppapi/tests/test_host_resolver_private_disallowed.h"
+
+#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/private/net_address_private.h"
+#include "ppapi/tests/test_utils.h"
+#include "ppapi/tests/testing_instance.h"
+
+REGISTER_TEST_CASE(HostResolverPrivateDisallowed);
+
+TestHostResolverPrivateDisallowed::TestHostResolverPrivateDisallowed(
+    TestingInstance* instance)
+    : TestCase(instance) {
+}
+
+bool TestHostResolverPrivateDisallowed::Init() {
+  bool host_resolver_private_is_available =
+      pp::HostResolverPrivate::IsAvailable();
+  if (!host_resolver_private_is_available)
+    instance_->AppendError("PPB_HostResolver_Private interface not available");
+
+  bool init_host_port =
+      GetLocalHostPort(instance_->pp_instance(), &host_, &port_);
+  if (!init_host_port)
+    instance_->AppendError("Can't init host and port");
+
+  return host_resolver_private_is_available &&
+      init_host_port &&
+      EnsureRunningOverHTTP();
+}
+
+void TestHostResolverPrivateDisallowed::RunTests(const std::string& filter) {
+  RUN_TEST_FORCEASYNC_AND_NOT(Resolve, filter);
+}
+
+std::string TestHostResolverPrivateDisallowed::TestResolve() {
+  pp::HostResolverPrivate host_resolver(instance_);
+  PP_HostResolver_Private_Hint hint;
+  hint.family = PP_NETADDRESSFAMILY_UNSPECIFIED;
+  hint.flags = PP_HOST_RESOLVER_FLAGS_CANONNAME;
+  TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+  int32_t rv = host_resolver.Resolve(host_, port_, hint,
+                                     callback.GetCallback());
+  if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+    return ReportError("PPB_HostResolver_Private::Resolve force_async", rv);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = callback.WaitForResult();
+  if (rv != PP_ERROR_FAILED)
+    return "PPB_HostResolver_Private can resolve without allowing switch";
+  PASS();
+}
diff --git a/ppapi/tests/test_host_resolver_private_disallowed.h b/ppapi/tests/test_host_resolver_private_disallowed.h
new file mode 100644
index 0000000..564c858
--- /dev/null
+++ b/ppapi/tests/test_host_resolver_private_disallowed.h
@@ -0,0 +1,28 @@
+// 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 PPAPI_TESTS_TEST_HOST_RESOLVER_PRIVATE_DISALLOWED_H_
+#define PPAPI_TESTS_TEST_HOST_RESOLVER_PRIVATE_DISALLOWED_H_
+
+#include <string>
+
+#include "ppapi/cpp/private/host_resolver_private.h"
+#include "ppapi/tests/test_case.h"
+
+class TestHostResolverPrivateDisallowed : public TestCase {
+ public:
+  explicit TestHostResolverPrivateDisallowed(TestingInstance* instance);
+
+  // TestCase implementation.
+  virtual bool Init();
+  virtual void RunTests(const std::string& filter);
+
+ private:
+  std::string TestResolve();
+
+  std::string host_;
+  uint16_t port_;
+};
+
+#endif  // PPAPI_TESTS_TEST_HOST_RESOLVER_PRIVATE_DISALLOWED_H_
diff --git a/ppapi/tests/test_image_data.cc b/ppapi/tests/test_image_data.cc
index d5b78f0..856eaa3 100644
--- a/ppapi/tests/test_image_data.cc
+++ b/ppapi/tests/test_image_data.cc
@@ -19,13 +19,13 @@
 }
 
 void TestImageData::RunTests(const std::string& filter) {
-  instance_->LogTest("InvalidFormat", TestInvalidFormat());
-  instance_->LogTest("GetNativeFormat", TestGetNativeFormat());
-  instance_->LogTest("IsImageDataFormatSupported", TestFormatSupported());
-  instance_->LogTest("InvalidSize", TestInvalidSize());
-  instance_->LogTest("HugeSize", TestHugeSize());
-  instance_->LogTest("InitToZero", TestInitToZero());
-  instance_->LogTest("IsImageData", TestIsImageData());
+  RUN_TEST(InvalidFormat, filter);
+  RUN_TEST(GetNativeFormat, filter);
+  RUN_TEST(FormatSupported, filter);
+  RUN_TEST(InvalidSize, filter);
+  RUN_TEST(HugeSize, filter);
+  RUN_TEST(InitToZero, filter);
+  RUN_TEST(IsImageData, filter);
 }
 
 std::string TestImageData::TestInvalidFormat() {
diff --git a/ppapi/tests/test_input_event.cc b/ppapi/tests/test_input_event.cc
index c55912d..8aa8340 100644
--- a/ppapi/tests/test_input_event.cc
+++ b/ppapi/tests/test_input_event.cc
@@ -32,20 +32,16 @@
 void TestInputEvent::RunTests(const std::string& filter) {
   RUN_TEST(Events, filter);
 
-// Like RUN_TEST, but does an exact match with the filter (which means it does
-// not run the test if filter is empty).
-#define RUN_TEST_EXACT_MATCH(name, test_filter) \
-  if (test_filter == #name) { \
-    set_callback_type(PP_OPTIONAL); \
-    instance_->LogTest(#name, CheckResourcesAndVars(Test##name())); \
+  // The AcceptTouchEvent_N tests should not be run when the filter is empty;
+  // they can only be run one at a time.
+  // TODO(dmichael): Figure out a way to make these run in the same test fixture
+  //                 instance.
+  if (!ShouldRunAllTests(filter)) {
+    RUN_TEST(AcceptTouchEvent_1, filter);
+    RUN_TEST(AcceptTouchEvent_2, filter);
+    RUN_TEST(AcceptTouchEvent_3, filter);
+    RUN_TEST(AcceptTouchEvent_4, filter);
   }
-
-  RUN_TEST_EXACT_MATCH(AcceptTouchEvent_1, filter);
-  RUN_TEST_EXACT_MATCH(AcceptTouchEvent_2, filter);
-  RUN_TEST_EXACT_MATCH(AcceptTouchEvent_3, filter);
-  RUN_TEST_EXACT_MATCH(AcceptTouchEvent_4, filter);
-
-#undef RUN_TEST_EXACT_MATCH
 }
 
 TestInputEvent::TestInputEvent(TestingInstance* instance)
diff --git a/ppapi/tests/test_message_loop.cc b/ppapi/tests/test_message_loop.cc
index 49845fb..475d9b2 100644
--- a/ppapi/tests/test_message_loop.cc
+++ b/ppapi/tests/test_message_loop.cc
@@ -7,8 +7,8 @@
 #include "ppapi/c/pp_macros.h"
 #include "ppapi/cpp/core.h"
 #include "ppapi/cpp/logging.h"
+#include "ppapi/cpp/message_loop.h"
 #include "ppapi/cpp/module.h"
-#include "ppapi/cpp/dev/message_loop_dev.h"
 #include "ppapi/tests/testing_instance.h"
 #include "ppapi/utility/threading/simple_thread.h"
 
@@ -32,17 +32,17 @@
 std::string TestMessageLoop::TestBasics() {
   // The main thread message loop should be valid, and equal to the "current"
   // one.
-  ASSERT_NE(0, pp::MessageLoop_Dev::GetForMainThread().pp_resource());
-  ASSERT_EQ(pp::MessageLoop_Dev::GetForMainThread().pp_resource(),
-            pp::MessageLoop_Dev::GetCurrent().pp_resource());
+  ASSERT_NE(0, pp::MessageLoop::GetForMainThread().pp_resource());
+  ASSERT_EQ(pp::MessageLoop::GetForMainThread().pp_resource(),
+            pp::MessageLoop::GetCurrent().pp_resource());
 
   // We shouldn't be able to attach a new loop to the main thread.
-  pp::MessageLoop_Dev loop(instance_);
+  pp::MessageLoop loop(instance_);
   ASSERT_EQ(PP_ERROR_INPROGRESS, loop.AttachToCurrentThread());
 
   // Nested loops aren't allowed.
   ASSERT_EQ(PP_ERROR_INPROGRESS,
-            pp::MessageLoop_Dev::GetForMainThread().Run());
+            pp::MessageLoop::GetForMainThread().Run());
 
   // We can't run on a loop that isn't attached to a thread.
   ASSERT_EQ(PP_ERROR_WRONG_THREAD, loop.Run());
@@ -52,7 +52,7 @@
 
 std::string TestMessageLoop::TestPost() {
   // Make sure we can post a task from the main thread back to the main thread.
-  pp::MessageLoop_Dev::GetCurrent().PostWork(callback_factory_.NewCallback(
+  pp::MessageLoop::GetCurrent().PostWork(callback_factory_.NewCallback(
       &TestMessageLoop::SetParamAndQuitTask, kMainToMain));
   main_loop_task_ran_.Wait();
   ASSERT_EQ(param_, kMainToMain);
@@ -77,7 +77,7 @@
 
   // Nested loops aren't allowed.
   ASSERT_EQ(PP_ERROR_INPROGRESS,
-            pp::MessageLoop_Dev::GetForMainThread().Run());
+            pp::MessageLoop::GetForMainThread().Run());
   thread.message_loop().PostWork(callback_factory_.NewCallback(
       &TestMessageLoop::EchoParamToMainTask, kAfterStart));
   main_loop_task_ran_.Wait();
@@ -98,7 +98,7 @@
 
 void TestMessageLoop::EchoParamToMainTask(int32_t result, TestParam param) {
   PP_DCHECK(result == PP_OK);
-  pp::MessageLoop_Dev::GetForMainThread().PostWork(
+  pp::MessageLoop::GetForMainThread().PostWork(
       callback_factory_.NewCallback(
           &TestMessageLoop::SetParamAndQuitTask, param));
 }
diff --git a/ppapi/tests/test_mouse_lock.cc b/ppapi/tests/test_mouse_lock.cc
index 8376989..0c4efd4 100644
--- a/ppapi/tests/test_mouse_lock.cc
+++ b/ppapi/tests/test_mouse_lock.cc
@@ -41,7 +41,7 @@
   // Please see chrome/test/ppapi/ppapi_interactive_browsertest.cc.
   TestCompletionCallback callback(instance_->pp_instance(), callback_type());
   SimulateUserGesture();
-  callback.WaitForResult(LockMouse(callback));
+  callback.WaitForResult(LockMouse(callback.GetCallback()));
   ASSERT_EQ(PP_OK, callback.result());
 
   UnlockMouse();
@@ -56,7 +56,7 @@
   // Please see chrome/test/ppapi/ppapi_interactive_browsertest.cc.
   TestCompletionCallback callback(instance_->pp_instance(), callback_type());
   SimulateUserGesture();
-  callback.WaitForResult(LockMouse(callback));
+  callback.WaitForResult(LockMouse(callback.GetCallback()));
   ASSERT_NE(PP_OK, callback.result());
 
   PASS();
diff --git a/ppapi/tests/test_net_address_private_untrusted.cc b/ppapi/tests/test_net_address_private_untrusted.cc
index d8e0996..7ad64e2 100644
--- a/ppapi/tests/test_net_address_private_untrusted.cc
+++ b/ppapi/tests/test_net_address_private_untrusted.cc
@@ -57,7 +57,7 @@
                                                 uint16_t port) {
   TestCompletionCallback callback(instance_->pp_instance(), false);
 
-  int32_t rv = socket->Connect(host.c_str(), port, callback);
+  int32_t rv = socket->Connect(host.c_str(), port, callback.GetCallback());
   if (rv == PP_OK_COMPLETIONPENDING)
     rv = callback.WaitForResult();
   return rv;
diff --git a/ppapi/tests/test_post_message.cc b/ppapi/tests/test_post_message.cc
index 68fe633..8b16620 100644
--- a/ppapi/tests/test_post_message.cc
+++ b/ppapi/tests/test_post_message.cc
@@ -261,7 +261,11 @@
 
   // TODO(sehr,dmichael): Add testing of longer array buffers when
   // crbug.com/110086 is fixed.
-  uint32_t sizes[] = { 0, 100, 1000, 10000, 100000 };
+#if defined(OS_LINUX)
+  uint32_t sizes[] = { 0, 100, 1000, 10000, 100000, 1000000 };
+#else
+  uint32_t sizes[] = { 0, 100, 1000, 10000, 100000  };
+#endif
   for (size_t i = 0; i < sizeof(sizes)/sizeof(sizes[i]); ++i) {
     std::ostringstream size_stream;
     size_stream << sizes[i];
diff --git a/ppapi/tests/test_scrollbar.cc b/ppapi/tests/test_scrollbar.cc
index 83c8365..cde40a7 100644
--- a/ppapi/tests/test_scrollbar.cc
+++ b/ppapi/tests/test_scrollbar.cc
@@ -27,7 +27,7 @@
 }
 
 void TestScrollbar::RunTests(const std::string& filter) {
-  instance_->LogTest("HandleEvent", TestHandleEvent());
+  RUN_TEST(HandleEvent, filter);
 }
 
 std::string TestScrollbar::TestHandleEvent() {
diff --git a/ppapi/tests/test_talk_private.cc b/ppapi/tests/test_talk_private.cc
new file mode 100644
index 0000000..4b49ed1
--- /dev/null
+++ b/ppapi/tests/test_talk_private.cc
@@ -0,0 +1,85 @@
+// 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 "ppapi/tests/test_talk_private.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <string>
+
+#include "ppapi/c/dev/ppb_testing_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_talk_private.h"
+#include "ppapi/cpp/instance.h"
+#include "ppapi/cpp/module.h"
+#include "ppapi/tests/test_utils.h"
+#include "ppapi/tests/testing_instance.h"
+
+REGISTER_TEST_CASE(TalkPrivate);
+
+TestTalkPrivate::TestTalkPrivate(TestingInstance* instance)
+    : TestCase(instance),
+      talk_private_interface_(NULL) {
+}
+
+bool TestTalkPrivate::Init() {
+  if (!CheckTestingInterface()) {
+    instance_->AppendError("Testing interface not available");
+    return false;
+  }
+
+  talk_private_interface_ = static_cast<const PPB_Talk_Private*>(
+      pp::Module::Get()->GetBrowserInterface(PPB_TALK_PRIVATE_INTERFACE));
+
+#if defined(__native_client__)
+  if (talk_private_interface_)
+    instance_->AppendError("TalkPrivate interface is supported by NaCl");
+#else
+  if (!talk_private_interface_)
+    instance_->AppendError("TalkPrivate interface not available");
+#endif
+  return true;
+}
+
+void TestTalkPrivate::RunTests(const std::string& filter) {
+  RUN_CALLBACK_TEST(TestTalkPrivate, GetPermission, filter);
+}
+
+std::string TestTalkPrivate::TestGetPermission() {
+  if (!talk_private_interface_) {
+    PASS();
+  }
+
+  if (!testing_interface_->IsOutOfProcess()) {
+    // We only support out-of-process access to this API, so skip in-process
+    PASS();
+  }
+
+#if defined(USE_ASH)
+  // Under Ash, this will prompt the user so the test cannot run in an automated
+  // fashion. To manually test under Ash, comment this out.
+  PASS();
+#endif
+
+  PP_Resource talk_resource = talk_private_interface_->Create(
+      instance_->pp_instance());
+
+  TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+  callback.WaitForResult(talk_private_interface_->GetPermission(talk_resource,
+      callback.GetCallback().pp_completion_callback()));
+  CHECK_CALLBACK_BEHAVIOR(callback);
+
+#if defined(USE_ASH)
+  // Under Ash, this test will actually prompt the user and return either true
+  // or false depending on their choice.
+  if (callback.result() != 0 && callback.result() != 1)
+    return "Unexpected result";
+#else
+  // Currently not implemented without Ash, bur always returns false.
+  if (callback.result() != 0)
+    return "Unexpected non-zero result";
+#endif
+
+  PASS();
+}
diff --git a/ppapi/tests/test_talk_private.h b/ppapi/tests/test_talk_private.h
new file mode 100644
index 0000000..223f202
--- /dev/null
+++ b/ppapi/tests/test_talk_private.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 PAPPI_TESTS_TEST_TALK_PRIVATE_H_
+#define PAPPI_TESTS_TEST_TALK_PRIVATE_H_
+
+#include <string>
+
+#include "ppapi/c/private/ppb_talk_private.h"
+#include "ppapi/tests/test_case.h"
+
+class TestTalkPrivate : public TestCase {
+ public:
+  explicit TestTalkPrivate(TestingInstance* instance);
+
+  // TestCase implementation.
+  virtual bool Init();
+  virtual void RunTests(const std::string& filter);
+
+ private:
+  std::string TestGetPermission();
+
+  const PPB_Talk_Private* talk_private_interface_;
+};
+
+#endif  // PPAPI_TESTS_TEST_TALK_PRIVATE_H_
diff --git a/ppapi/tests/test_tcp_server_socket_private.cc b/ppapi/tests/test_tcp_server_socket_private.cc
index 26673b8..26b43e6 100644
--- a/ppapi/tests/test_tcp_server_socket_private.cc
+++ b/ppapi/tests/test_tcp_server_socket_private.cc
@@ -68,7 +68,7 @@
     PP_NetAddress_Private* address) {
   TCPSocketPrivate socket(instance_);
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-  int32_t rv = socket.Connect(host_.c_str(), port_, callback);
+  int32_t rv = socket.Connect(host_.c_str(), port_, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("PPB_TCPSocket_Private::Connect force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -86,7 +86,7 @@
                                                  size_t num_bytes) {
   while (num_bytes > 0) {
     TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-    int32_t rv = socket->Read(buffer, num_bytes, callback);
+    int32_t rv = socket->Read(buffer, num_bytes, callback.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return ReportError("PPB_TCPSocket_Private::Read force_async", rv);
     if (rv == PP_OK_COMPLETIONPENDING)
@@ -104,7 +104,7 @@
                                                   size_t num_bytes) {
   while (num_bytes > 0) {
     TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-    int32_t rv = socket->Write(buffer, num_bytes, callback);
+    int32_t rv = socket->Write(buffer, num_bytes, callback.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return ReportError("PPB_TCPSocket_Private::Write force_async", rv);
     if (rv == PP_OK_COMPLETIONPENDING)
@@ -121,7 +121,7 @@
     TCPSocketPrivate* socket,
     PP_NetAddress_Private* address) {
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-  int32_t rv = socket->ConnectWithNetAddress(address, callback);
+  int32_t rv = socket->ConnectWithNetAddress(address, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("PPB_TCPSocket_Private::Connect force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -154,7 +154,7 @@
       return ReportError("PPB_NetAddress_Private::ReplacePort", 0);
 
     TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-    int32_t rv = socket->Listen(address, backlog, callback);
+    int32_t rv = socket->Listen(address, backlog, callback.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return ReportError("PPB_TCPServerSocket_Private::Listen force_async", rv);
     if (rv == PP_OK_COMPLETIONPENDING)
@@ -181,7 +181,8 @@
   TestCompletionCallback accept_callback(instance_->pp_instance(),
                                          force_async_);
   PP_Resource resource;
-  int32_t accept_rv = server_socket.Accept(&resource, accept_callback);
+  int32_t accept_rv = server_socket.Accept(&resource,
+                                           accept_callback.GetCallback());
 
   TCPSocketPrivate client_socket(instance_);
   ForceConnect(&client_socket, &address);
@@ -233,7 +234,7 @@
                                                       force_async_);
     connect_rv[i] = client_sockets[i]->ConnectWithNetAddress(
         &address,
-        *connect_callbacks[i]);
+        connect_callbacks[i]->GetCallback());
     if (force_async_ && connect_rv[i] != PP_OK_COMPLETIONPENDING) {
       return ReportError("PPB_TCPSocket_Private::Connect force_async",
                          connect_rv[i]);
@@ -244,7 +245,7 @@
   std::vector<TCPSocketPrivate*> accepted_sockets(kBacklog);
   for (size_t i = 0; i < kBacklog; ++i) {
     TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-    int32_t rv = server_socket.Accept(&resources[i], callback);
+    int32_t rv = server_socket.Accept(&resources[i], callback.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return ReportError("PPB_TCPServerSocket_Private::Accept force_async", rv);
     if (rv == PP_OK_COMPLETIONPENDING)
diff --git a/ppapi/tests/test_tcp_server_socket_private_disallowed.cc b/ppapi/tests/test_tcp_server_socket_private_disallowed.cc
index 86036d7..55a61a6 100644
--- a/ppapi/tests/test_tcp_server_socket_private_disallowed.cc
+++ b/ppapi/tests/test_tcp_server_socket_private_disallowed.cc
@@ -74,8 +74,7 @@
         socket,
         &current_address,
         1,
-        static_cast<pp::CompletionCallback>(
-            callback).pp_completion_callback());
+        callback.GetCallback().pp_completion_callback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return ReportError("PPB_TCPServerSocket_Private::Listen force_async", rv);
     if (rv == PP_OK_COMPLETIONPENDING)
diff --git a/ppapi/tests/test_tcp_socket_private.cc b/ppapi/tests/test_tcp_socket_private.cc
index 6bffe49..a15c36e 100644
--- a/ppapi/tests/test_tcp_socket_private.cc
+++ b/ppapi/tests/test_tcp_socket_private.cc
@@ -51,13 +51,14 @@
   RUN_TEST_FORCEASYNC_AND_NOT(ReadWrite, filter);
   RUN_TEST_FORCEASYNC_AND_NOT(ReadWriteSSL, filter);
   RUN_TEST_FORCEASYNC_AND_NOT(ConnectAddress, filter);
+  RUN_TEST_FORCEASYNC_AND_NOT(SetOption, filter);
 }
 
 std::string TestTCPSocketPrivate::TestBasic() {
   pp::TCPSocketPrivate socket(instance_);
   TestCompletionCallback cb(instance_->pp_instance(), force_async_);
 
-  int32_t rv = socket.Connect(host_.c_str(), port_, cb);
+  int32_t rv = socket.Connect(host_.c_str(), port_, cb.GetCallback());
   ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
   if (rv == PP_OK_COMPLETIONPENDING)
     rv = cb.WaitForResult();
@@ -77,7 +78,7 @@
   pp::TCPSocketPrivate socket(instance_);
   TestCompletionCallback cb(instance_->pp_instance(), force_async_);
 
-  int32_t rv = socket.Connect(host_.c_str(), port_, cb);
+  int32_t rv = socket.Connect(host_.c_str(), port_, cb.GetCallback());
   ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
   if (rv == PP_OK_COMPLETIONPENDING)
     rv = cb.WaitForResult();
@@ -99,13 +100,13 @@
   pp::TCPSocketPrivate socket(instance_);
   TestCompletionCallback cb(instance_->pp_instance(), force_async_);
 
-  int32_t rv = socket.Connect(host_.c_str(), ssl_port_, cb);
+  int32_t rv = socket.Connect(host_.c_str(), ssl_port_, cb.GetCallback());
   ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
   if (rv == PP_OK_COMPLETIONPENDING)
     rv = cb.WaitForResult();
   ASSERT_EQ(PP_OK, rv);
 
-  rv = socket.SSLHandshake(host_.c_str(), ssl_port_, cb);
+  rv = socket.SSLHandshake(host_.c_str(), ssl_port_, cb.GetCallback());
   ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
   if (rv == PP_OK_COMPLETIONPENDING)
     rv = cb.WaitForResult();
@@ -130,7 +131,7 @@
   {
     pp::TCPSocketPrivate socket(instance_);
     TestCompletionCallback cb(instance_->pp_instance(), force_async_);
-    int32_t rv = socket.Connect(host_.c_str(), port_, cb);
+    int32_t rv = socket.Connect(host_.c_str(), port_, cb.GetCallback());
     ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
     if (rv == PP_OK_COMPLETIONPENDING)
       rv = cb.WaitForResult();
@@ -143,7 +144,7 @@
   // Connect to that address.
   pp::TCPSocketPrivate socket(instance_);
   TestCompletionCallback cb(instance_->pp_instance(), force_async_);
-  int32_t rv = socket.ConnectWithNetAddress(&address, cb);
+  int32_t rv = socket.ConnectWithNetAddress(&address, cb.GetCallback());
   ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
   if (rv == PP_OK_COMPLETIONPENDING)
     rv = cb.WaitForResult();
@@ -160,6 +161,40 @@
   PASS();
 }
 
+std::string TestTCPSocketPrivate::TestSetOption() {
+  pp::TCPSocketPrivate socket(instance_);
+  TestCompletionCallback cb(instance_->pp_instance(), force_async_);
+
+  int32_t rv = socket.SetOption(PP_TCPSOCKETOPTION_NO_DELAY, true,
+                                cb.GetCallback());
+  ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = cb.WaitForResult();
+  ASSERT_EQ(PP_ERROR_FAILED, rv);
+
+  rv = socket.Connect(host_.c_str(), port_, cb.GetCallback());
+  ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = cb.WaitForResult();
+  ASSERT_EQ(PP_OK, rv);
+
+  rv = socket.SetOption(PP_TCPSOCKETOPTION_NO_DELAY, true, cb.GetCallback());
+  ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = cb.WaitForResult();
+  ASSERT_EQ(PP_OK, rv);
+
+  rv = socket.SetOption(PP_TCPSOCKETOPTION_INVALID, true, cb.GetCallback());
+  ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
+  if (rv == PP_OK_COMPLETIONPENDING)
+    rv = cb.WaitForResult();
+  ASSERT_EQ(PP_ERROR_BADARGUMENT, rv);
+
+  socket.Disconnect();
+
+  PASS();
+}
+
 int32_t TestTCPSocketPrivate::ReadFirstLineFromSocket(
     pp::TCPSocketPrivate* socket,
     std::string* s) {
@@ -169,7 +204,7 @@
   // Make sure we don't just hang if |Read()| spews.
   while (s->size() < 1000000) {
     TestCompletionCallback cb(instance_->pp_instance(), force_async_);
-    int32_t rv = socket->Read(buffer, sizeof(buffer), cb);
+    int32_t rv = socket->Read(buffer, sizeof(buffer), cb.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return PP_ERROR_FAILED;
     if (rv == PP_OK_COMPLETIONPENDING)
@@ -194,7 +229,8 @@
   size_t written = 0;
   while (written < s.size()) {
     TestCompletionCallback cb(instance_->pp_instance(), force_async_);
-    int32_t rv = socket->Write(buffer + written, s.size() - written, cb);
+    int32_t rv = socket->Write(buffer + written, s.size() - written,
+                               cb.GetCallback());
     if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
       return PP_ERROR_FAILED;
     if (rv == PP_OK_COMPLETIONPENDING)
diff --git a/ppapi/tests/test_tcp_socket_private.h b/ppapi/tests/test_tcp_socket_private.h
index 4c31853..a7b747f 100644
--- a/ppapi/tests/test_tcp_socket_private.h
+++ b/ppapi/tests/test_tcp_socket_private.h
@@ -27,6 +27,7 @@
   std::string TestReadWrite();
   std::string TestReadWriteSSL();
   std::string TestConnectAddress();
+  std::string TestSetOption();
 
   int32_t ReadFirstLineFromSocket(pp::TCPSocketPrivate* socket, std::string* s);
   int32_t WriteStringToSocket(pp::TCPSocketPrivate* socket,
diff --git a/ppapi/tests/test_tcp_socket_private_disallowed.cc b/ppapi/tests/test_tcp_socket_private_disallowed.cc
index 25e60dc..6325a4f 100644
--- a/ppapi/tests/test_tcp_socket_private_disallowed.cc
+++ b/ppapi/tests/test_tcp_socket_private_disallowed.cc
@@ -41,7 +41,7 @@
     TestCompletionCallback callback(instance_->pp_instance());
     int32_t rv = tcp_socket_private_interface_->Connect(
         socket, kServerName, kPort,
-        static_cast<pp::CompletionCallback>(callback).pp_completion_callback());
+        callback.GetCallback().pp_completion_callback());
 
     if (PP_OK_COMPLETIONPENDING == rv)
       rv = callback.WaitForResult();
diff --git a/ppapi/tests/test_tcp_socket_private_trusted.cc b/ppapi/tests/test_tcp_socket_private_trusted.cc
index debb3ce..82c2257 100644
--- a/ppapi/tests/test_tcp_socket_private_trusted.cc
+++ b/ppapi/tests/test_tcp_socket_private_trusted.cc
@@ -42,13 +42,13 @@
   pp::TCPSocketPrivate socket(instance_);
   TestCompletionCallback cb(instance_->pp_instance(), force_async_);
 
-  int32_t rv = socket.Connect(host_.c_str(), ssl_port_, cb);
+  int32_t rv = socket.Connect(host_.c_str(), ssl_port_, cb.GetCallback());
   ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
   if (rv == PP_OK_COMPLETIONPENDING)
     rv = cb.WaitForResult();
   ASSERT_EQ(PP_OK, rv);
 
-  rv = socket.SSLHandshake(host_.c_str(), ssl_port_, cb);
+  rv = socket.SSLHandshake(host_.c_str(), ssl_port_, cb.GetCallback());
   ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
   if (rv == PP_OK_COMPLETIONPENDING)
     rv = cb.WaitForResult();
diff --git a/ppapi/tests/test_udp_socket_private.cc b/ppapi/tests/test_udp_socket_private.cc
index 4680ff2..995b53a 100644
--- a/ppapi/tests/test_udp_socket_private.cc
+++ b/ppapi/tests/test_udp_socket_private.cc
@@ -64,7 +64,7 @@
     PP_NetAddress_Private* address) {
   pp::TCPSocketPrivate socket(instance_);
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-  int32_t rv = socket.Connect(host_.c_str(), port_, callback);
+  int32_t rv = socket.Connect(host_.c_str(), port_, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("PPB_TCPSocket_Private::Connect force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -95,7 +95,7 @@
     pp::UDPSocketPrivate* socket,
     PP_NetAddress_Private* address) {
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-  int32_t rv = socket->Bind(address, callback);
+  int32_t rv = socket->Bind(address, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("PPB_UDPSocket_Private::Bind force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -131,7 +131,7 @@
     pp::UDPSocketPrivate* socket,
     PP_NetAddress_Private *address) {
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-  int32_t rv = socket->Bind(address, callback);
+  int32_t rv = socket->Bind(address, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("PPB_UDPSocket_Private::Bind force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -149,7 +149,7 @@
                                              std::string* message) {
   std::vector<char> buffer(size);
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-  int32_t rv = socket->RecvFrom(&buffer[0], size, callback);
+  int32_t rv = socket->RecvFrom(&buffer[0], size, callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("PPB_UDPSocket_Private::RecvFrom force_async", rv);
   if (rv == PP_OK_COMPLETIONPENDING)
@@ -166,7 +166,7 @@
                                               const std::string& message) {
   TestCompletionCallback callback(instance_->pp_instance(), force_async_);
   int32_t rv = source->SendTo(message.c_str(), message.size(), address,
-                              callback);
+                              callback.GetCallback());
   if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
     return ReportError("PPB_UDPSocket_Private::SendTo force_async", rv);
 
diff --git a/ppapi/tests/test_udp_socket_private_disallowed.cc b/ppapi/tests/test_udp_socket_private_disallowed.cc
index fa0c179..655ed35 100644
--- a/ppapi/tests/test_udp_socket_private_disallowed.cc
+++ b/ppapi/tests/test_udp_socket_private_disallowed.cc
@@ -37,7 +37,7 @@
 
     TestCompletionCallback callback(instance_->pp_instance());
     int32_t rv = udp_socket_private_interface_->Bind(socket, &addr,
-        static_cast<pp::CompletionCallback>(callback).pp_completion_callback());
+        callback.GetCallback().pp_completion_callback());
 
     if (PP_OK_COMPLETIONPENDING == rv)
       rv = callback.WaitForResult();
diff --git a/ppapi/tests/test_url_loader.cc b/ppapi/tests/test_url_loader.cc
index 9024491..112a483 100644
--- a/ppapi/tests/test_url_loader.cc
+++ b/ppapi/tests/test_url_loader.cc
@@ -44,7 +44,7 @@
     callback.WaitForResult(file_io->Write(write_offset,
                                           &buf[write_offset - offset],
                                           size - write_offset + offset,
-                                          callback));
+                                          callback.GetCallback()));
     if (callback.result() < 0)
       return callback.result();
     if (callback.result() == 0)
@@ -128,7 +128,8 @@
   int64_t offset = 0;
 
   for (;;) {
-    callback.WaitForResult(file_io->Read(offset, buf, sizeof(buf), callback));
+    callback.WaitForResult(file_io->Read(offset, buf, sizeof(buf),
+                           callback.GetCallback()));
     if (callback.result() < 0)
       return ReportError("FileIO::Read", callback.result());
     if (callback.result() == 0)
@@ -147,7 +148,7 @@
 
   for (;;) {
     callback.WaitForResult(
-        loader->ReadResponseBody(buf, sizeof(buf), callback));
+        loader->ReadResponseBody(buf, sizeof(buf), callback.GetCallback()));
     if (callback.result() < 0)
       return ReportError("URLLoader::ReadResponseBody", callback.result());
     if (callback.result() == 0)
@@ -164,7 +165,7 @@
   TestCompletionCallback callback(instance_->pp_instance(), callback_type());
 
   pp::URLLoader loader(instance_);
-  callback.WaitForResult(loader.Open(request, callback));
+  callback.WaitForResult(loader.Open(request, callback.GetCallback()));
   CHECK_CALLBACK_BEHAVIOR(callback);
   ASSERT_EQ(PP_OK, callback.result());
 
@@ -191,7 +192,7 @@
 int32_t TestURLLoader::OpenFileSystem(pp::FileSystem* file_system,
                                       std::string* message) {
   TestCompletionCallback callback(instance_->pp_instance(), callback_type());
-  callback.WaitForResult(file_system->Open(1024, callback));
+  callback.WaitForResult(file_system->Open(1024, callback.GetCallback()));
   if (callback.failed()) {
     message->assign(callback.errors());
     return callback.result();
@@ -213,7 +214,7 @@
                                       PP_FILEOPENFLAG_CREATE |
                                       PP_FILEOPENFLAG_TRUNCATE |
                                       PP_FILEOPENFLAG_WRITE,
-                                      callback));
+                                      callback.GetCallback()));
   if (callback.failed()) {
     message->assign(callback.errors());
     return callback.result();
@@ -297,7 +298,7 @@
   if (trusted)
     url_loader_trusted_interface_->GrantUniversalAccess(loader.pp_resource());
   TestCompletionCallback callback(instance_->pp_instance(), callback_type());
-  callback.WaitForResult(loader.Open(request, callback));
+  callback.WaitForResult(loader.Open(request, callback.GetCallback()));
   return callback.result();
 }
 
@@ -421,7 +422,7 @@
   TestCompletionCallback callback(instance_->pp_instance(), callback_type());
 
   pp::URLLoader loader(instance_);
-  callback.WaitForResult(loader.Open(request, callback));
+  callback.WaitForResult(loader.Open(request, callback.GetCallback()));
   CHECK_CALLBACK_BEHAVIOR(callback);
   ASSERT_EQ(PP_OK, callback.result());
 
@@ -436,12 +437,13 @@
   if (body.is_null())
     return "URLResponseInfo::GetBody returned null";
 
-  callback.WaitForResult(loader.FinishStreamingToFile(callback));
+  callback.WaitForResult(loader.FinishStreamingToFile(callback.GetCallback()));
   CHECK_CALLBACK_BEHAVIOR(callback);
   ASSERT_EQ(PP_OK, callback.result());
 
   pp::FileIO reader(instance_);
-  callback.WaitForResult(reader.Open(body, PP_FILEOPENFLAG_READ, callback));
+  callback.WaitForResult(reader.Open(body, PP_FILEOPENFLAG_READ,
+                                     callback.GetCallback()));
   CHECK_CALLBACK_BEHAVIOR(callback);
   ASSERT_EQ(PP_OK, callback.result());
 
@@ -697,7 +699,7 @@
   TestCompletionCallback callback(instance_->pp_instance(), callback_type());
 
   pp::URLLoader loader(instance_);
-  callback.WaitForResult(loader.Open(request, callback));
+  callback.WaitForResult(loader.Open(request, callback.GetCallback()));
   CHECK_CALLBACK_BEHAVIOR(callback);
   ASSERT_EQ(PP_OK, callback.result());
 
@@ -711,7 +713,7 @@
     return "Response status should be 301";
 
   // Test that the paused loader can be resumed.
-  callback.WaitForResult(loader.FollowRedirect(callback));
+  callback.WaitForResult(loader.FollowRedirect(callback.GetCallback()));
   CHECK_CALLBACK_BEHAVIOR(callback);
   ASSERT_EQ(PP_OK, callback.result());
   std::string body;
@@ -734,7 +736,7 @@
 
   // Abort |Open()|.
   {
-    rv = pp::URLLoader(instance_).Open(request, callback);
+    rv = pp::URLLoader(instance_).Open(request, callback.GetCallback());
   }
   callback.WaitForAbortResult(rv);
   CHECK_CALLBACK_BEHAVIOR(callback);
@@ -744,11 +746,11 @@
     char buf[2] = { 0 };
     {
       pp::URLLoader loader(instance_);
-      callback.WaitForResult(loader.Open(request, callback));
+      callback.WaitForResult(loader.Open(request, callback.GetCallback()));
       CHECK_CALLBACK_BEHAVIOR(callback);
       ASSERT_EQ(PP_OK, callback.result());
 
-      rv = loader.ReadResponseBody(buf, sizeof(buf), callback);
+      rv = loader.ReadResponseBody(buf, sizeof(buf), callback.GetCallback());
     }  // Destroy |loader|.
     callback.WaitForAbortResult(rv);
     CHECK_CALLBACK_BEHAVIOR(callback);
@@ -773,7 +775,7 @@
   TestCompletionCallback callback(instance_->pp_instance(), callback_type());
 
   pp::URLLoader loader(instance_);
-  callback.WaitForResult(loader.Open(request, callback));
+  callback.WaitForResult(loader.Open(request, callback.GetCallback()));
   CHECK_CALLBACK_BEHAVIOR(callback);
   ASSERT_EQ(PP_OK, callback.result());
 
@@ -793,7 +795,7 @@
     //                 with GetForMainThread. We only need to yield on the main
     //                 thread.
     if (callback_type() != PP_BLOCKING) {
-      pp::Module::Get()->core()->CallOnMainThread(10, callback);
+      pp::Module::Get()->core()->CallOnMainThread(10, callback.GetCallback());
       callback.WaitForResult();
     }
   }
diff --git a/ppapi/tests/test_utils.cc b/ppapi/tests/test_utils.cc
index 20a8a81..e28afda 100644
--- a/ppapi/tests/test_utils.cc
+++ b/ppapi/tests/test_utils.cc
@@ -13,7 +13,6 @@
 #endif
 
 #include "ppapi/c/pp_errors.h"
-#include "ppapi/cpp/dev/message_loop_dev.h"
 #include "ppapi/cpp/module.h"
 #include "ppapi/cpp/var.h"
 
@@ -201,7 +200,7 @@
     return pp::CompletionCallback();
   else if (callback_type_ == PP_OPTIONAL)
     flags = PP_COMPLETIONCALLBACK_FLAG_OPTIONAL;
-  target_loop_ = pp::MessageLoop_Dev::GetCurrent();
+  target_loop_ = pp::MessageLoop::GetCurrent();
   return pp::CompletionCallback(&TestCompletionCallback::Handler,
                                 const_cast<TestCompletionCallback*>(this),
                                 flags);
@@ -233,7 +232,7 @@
     callback->post_quit_task_ = false;
     callback->QuitMessageLoop();
   }
-  if (callback->target_loop_ != pp::MessageLoop_Dev::GetCurrent()) {
+  if (callback->target_loop_ != pp::MessageLoop::GetCurrent()) {
     // Note, in-process, loop_ and GetCurrent() will both be NULL, so should
     // still be equal.
     callback->errors_.assign(
@@ -244,20 +243,20 @@
 }
 
 void TestCompletionCallback::RunMessageLoop() {
-  pp::MessageLoop_Dev loop(pp::MessageLoop_Dev::GetCurrent());
+  pp::MessageLoop loop(pp::MessageLoop::GetCurrent());
   // If we don't have a message loop, we're probably running in process, where
   // PPB_MessageLoop is not supported. Just use the Testing message loop.
-  if (loop.is_null() || loop == pp::MessageLoop_Dev::GetForMainThread())
+  if (loop.is_null() || loop == pp::MessageLoop::GetForMainThread())
     GetTestingInterface()->RunMessageLoop(instance_);
   else
     loop.Run();
 }
 
 void TestCompletionCallback::QuitMessageLoop() {
-  pp::MessageLoop_Dev loop(pp::MessageLoop_Dev::GetCurrent());
+  pp::MessageLoop loop(pp::MessageLoop::GetCurrent());
   // If we don't have a message loop, we're probably running in process, where
   // PPB_MessageLoop is not supported. Just use the Testing message loop.
-  if (loop.is_null() || loop == pp::MessageLoop_Dev::GetForMainThread()) {
+  if (loop.is_null() || loop == pp::MessageLoop::GetForMainThread()) {
     GetTestingInterface()->QuitMessageLoop(instance_);
   } else {
     const bool should_quit = false;
diff --git a/ppapi/tests/test_utils.h b/ppapi/tests/test_utils.h
index 60f7fc4..e61efbd 100644
--- a/ppapi/tests/test_utils.h
+++ b/ppapi/tests/test_utils.h
@@ -11,7 +11,7 @@
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_stdint.h"
 #include "ppapi/cpp/completion_callback.h"
-#include "ppapi/cpp/dev/message_loop_dev.h"
+#include "ppapi/cpp/message_loop.h"
 #include "ppapi/utility/completion_callback_factory.h"
 
 // Timeout to wait for some action to complete.
@@ -133,9 +133,6 @@
   // Retrieve a pp::CompletionCallback for use in testing. This Reset()s the
   // TestCompletionCallback.
   pp::CompletionCallback GetCallback();
-  operator pp::CompletionCallback() {
-    return GetCallback();
-  }
 
   // TODO(dmichael): Remove run_count when all tests are updated. Most cases
   //                 that use this can simply use CHECK_CALLBACK_BEHAVIOR.
@@ -151,7 +148,7 @@
   // Reset so that this callback can be used again.
   void Reset();
 
- private:
+ protected:
   static void Handler(void* user_data, int32_t result);
   void RunMessageLoop();
   void QuitMessageLoop();
@@ -169,9 +166,59 @@
   unsigned run_count_;
   PP_Instance instance_;
   Delegate* delegate_;
-  pp::MessageLoop_Dev target_loop_;
+  pp::MessageLoop target_loop_;
 };
 
+template <typename OutputT>
+class TestCompletionCallbackWithOutput : public TestCompletionCallback {
+ public:
+  explicit TestCompletionCallbackWithOutput(PP_Instance instance) :
+    TestCompletionCallback(instance) {
+  }
+
+  TestCompletionCallbackWithOutput(PP_Instance instance, bool force_async) :
+    TestCompletionCallback(instance, force_async) {
+  }
+
+  TestCompletionCallbackWithOutput(PP_Instance instance,
+                                   CallbackType callback_type) :
+    TestCompletionCallback(instance, callback_type) {
+  }
+
+  pp::CompletionCallbackWithOutput<OutputT> GetCallbackWithOutput();
+  operator pp::CompletionCallbackWithOutput<OutputT>() {
+    return GetCallbackWithOutput();
+  }
+
+  const OutputT& output() { return output_storage_.output(); }
+
+  typename pp::CompletionCallbackWithOutput<OutputT>::OutputStorageType
+      output_storage_;
+};
+
+template <typename OutputT>
+pp::CompletionCallbackWithOutput<OutputT>
+TestCompletionCallbackWithOutput<OutputT>::GetCallbackWithOutput() {
+  Reset();
+  if (callback_type_ == PP_BLOCKING) {
+    pp::CompletionCallbackWithOutput<OutputT> cc(
+        &TestCompletionCallback::Handler,
+        this,
+        &output_storage_);
+    return cc;
+  }
+
+  target_loop_ = pp::MessageLoop::GetCurrent();
+  pp::CompletionCallbackWithOutput<OutputT> cc(
+        &TestCompletionCallback::Handler,
+        this,
+        &output_storage_);
+  if (callback_type_ == PP_OPTIONAL)
+    cc.set_flags(PP_COMPLETIONCALLBACK_FLAG_OPTIONAL);
+  return cc;
+}
+
+
 // Verifies that the callback didn't record any errors. If the callback is run
 // in an unexpected way (e.g., if it's invoked asynchronously when the call
 // should have blocked), this returns an appropriate error string.
diff --git a/ppapi/tests/test_websocket.cc b/ppapi/tests/test_websocket.cc
index d5dc486..c0f813e 100644
--- a/ppapi/tests/test_websocket.cc
+++ b/ppapi/tests/test_websocket.cc
@@ -240,8 +240,13 @@
 }
 
 std::string TestWebSocket::GetFullURL(const char* url) {
-  std::string rv = "ws://localhost";
-  // Some WebSocket tests don't start the server so there'll be no port.
+  std::string rv = "ws://";
+  // Some WebSocket tests don't start the server so there'll be no host and
+  // port.
+  if (instance_->websocket_host().empty())
+    rv += "127.0.0.1";
+  else
+    rv += instance_->websocket_host();
   if (instance_->websocket_port() != -1) {
     char buffer[10];
     sprintf(buffer, ":%d", instance_->websocket_port());
@@ -464,6 +469,7 @@
   PP_Var extensions = websocket_interface_->GetExtensions(ws);
   ASSERT_TRUE(AreEqualWithString(extensions, ""));
   core_interface_->ReleaseResource(ws);
+  ReleaseVar(extensions);
 
   PASS();
 }
@@ -1107,7 +1113,8 @@
   TestCompletionCallback connect_callback(
       instance_->pp_instance(), callback_type());
   connect_callback.WaitForResult(ws.Connect(
-      pp::Var(GetFullURL(kCloseServerURL)), NULL, 0U, connect_callback));
+      pp::Var(GetFullURL(kCloseServerURL)), NULL, 0U,
+              connect_callback.GetCallback()));
   CHECK_CALLBACK_BEHAVIOR(connect_callback);
   ASSERT_EQ(PP_OK, connect_callback.result());
 
@@ -1126,7 +1133,8 @@
   TestCompletionCallback text_receive_callback(
       instance_->pp_instance(), callback_type());
   text_receive_callback.WaitForResult(
-      ws.ReceiveMessage(&text_receive_var, text_receive_callback));
+      ws.ReceiveMessage(&text_receive_var,
+                        text_receive_callback.GetCallback()));
   ASSERT_EQ(PP_OK, text_receive_callback.result());
   ASSERT_TRUE(
       AreEqualWithString(text_receive_var.pp_var(), text_message.c_str()));
@@ -1135,7 +1143,8 @@
   TestCompletionCallback binary_receive_callback(
       instance_->pp_instance(), callback_type());
   binary_receive_callback.WaitForResult(
-      ws.ReceiveMessage(&binary_receive_var, binary_receive_callback));
+      ws.ReceiveMessage(&binary_receive_var,
+                        binary_receive_callback.GetCallback()));
   ASSERT_EQ(PP_OK, binary_receive_callback.result());
   ASSERT_TRUE(AreEqualWithBinary(binary_receive_var.pp_var(), binary));
 
@@ -1143,7 +1152,8 @@
       instance_->pp_instance(), callback_type());
   std::string reason("bye");
   close_callback.WaitForResult(ws.Close(
-      PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE, pp::Var(reason), close_callback));
+      PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE, pp::Var(reason),
+      close_callback.GetCallback()));
   CHECK_CALLBACK_BEHAVIOR(close_callback);
   ASSERT_EQ(PP_OK, close_callback.result());
 
diff --git a/ppapi/tests/testing_instance.cc b/ppapi/tests/testing_instance.cc
index a6fa0dd..465bbb1 100644
--- a/ppapi/tests/testing_instance.cc
+++ b/ppapi/tests/testing_instance.cc
@@ -6,9 +6,11 @@
 
 #include <algorithm>
 #include <cstring>
+#include <iomanip>
 #include <sstream>
 #include <vector>
 
+#include "ppapi/cpp/core.h"
 #include "ppapi/cpp/module.h"
 #include "ppapi/cpp/var.h"
 #include "ppapi/cpp/view.h"
@@ -52,6 +54,8 @@
         nacl_mode_ = true;
     } else if (std::strcmp(argn[i], "protocol") == 0) {
       protocol_ = argv[i];
+    } else if (std::strcmp(argn[i], "websocket_host") == 0) {
+      websocket_host_ = argv[i];
     } else if (std::strcmp(argn[i], "websocket_port") == 0) {
       websocket_port_ = atoi(argv[i]);
     } else if (std::strcmp(argn[i], "ssl_server_port") == 0) {
@@ -64,7 +68,7 @@
       if (argv[i][0] == '\0')
         break;
       current_case_ = CaseForTestName(argv[i]);
-      test_filter_ = FilterForTestName(argv[i]);
+      test_filter_ = argv[i];
       if (!current_case_)
         errors_.append(std::string("Unknown test case ") + argv[i]);
       else if (!current_case_->Init())
@@ -118,7 +122,15 @@
 }
 
 void TestingInstance::LogTest(const std::string& test_name,
-                              const std::string& error_message) {
+                              const std::string& error_message,
+                              PP_TimeTicks start_time) {
+  // Compute the time to run the test and save it in a string for logging:
+  PP_TimeTicks end_time(pp::Module::Get()->core()->GetTimeTicks());
+  std::ostringstream number_stream;
+  PP_TimeTicks elapsed_time(end_time - start_time);
+  number_stream << std::fixed << std::setprecision(3) << elapsed_time;
+  std::string time_string(number_stream.str());
+
   // Tell the browser we're still working.
   ReportProgress(kProgressSignal);
 
@@ -139,6 +151,10 @@
       errors_.append(", ");  // Separator for different error messages.
     errors_.append(test_name + " FAIL: " + error_message);
   }
+  html.append(" <span class=\"time\">(");
+  html.append(time_string);
+  html.append("s)</span>");
+
   html.append("</div>");
   LogHTML(html);
 }
@@ -170,11 +186,34 @@
                      "restrictive: '" + test_filter_ + "'.");
       LogError(errors_);
     }
-    else {
-      // Automated PyAuto tests rely on finding the exact strings below.
-      LogHTML(errors_.empty() ?
-              "<span class=\"pass\">[SHUTDOWN]</span> All tests passed." :
-              "<span class=\"fail\">[SHUTDOWN]</span> Some tests failed.");
+    if (current_case_->skipped_tests().size()) {
+      // TODO(dmichael): Convert all TestCases to run all tests in one fixture,
+      //                 and enable this check. Currently, a lot of our tests
+      //                 run 1 test per fixture, which is slow.
+      /*
+      errors_.append("Some tests were not listed and thus were not run. Make "
+                     "sure all tests are passed in the test_case URL (even if "
+                     "they are marked DISABLED_). Forgotten tests: ");
+      std::set<std::string>::const_iterator iter =
+          current_case_->skipped_tests().begin();
+      for (; iter != current_case_->skipped_tests().end(); ++iter) {
+        errors_.append(*iter);
+        errors_.append(" ");
+      }
+      LogError(errors_);
+      */
+    }
+    if (current_case_->remaining_tests().size()) {
+      errors_.append("Some listed tests were not found in the TestCase. Check "
+                     "the test names that were passed to make sure they match "
+                     "tests in the TestCase. Unknown tests: ");
+      std::map<std::string, bool>::const_iterator iter =
+          current_case_->remaining_tests().begin();
+      for (; iter != current_case_->remaining_tests().end(); ++iter) {
+        errors_.append(iter->first);
+        errors_.append(" ");
+      }
+      LogError(errors_);
     }
   }
 
@@ -197,13 +236,6 @@
   return NULL;
 }
 
-std::string TestingInstance::FilterForTestName(const std::string& name) {
-  size_t delim = name.find_first_of('_');
-  if (delim != std::string::npos)
-    return name.substr(delim+1);
-  return "";
-}
-
 void TestingInstance::SendTestCommand(const std::string& command) {
   std::string msg("TESTING_MESSAGE:");
   msg += command;
diff --git a/ppapi/tests/testing_instance.h b/ppapi/tests/testing_instance.h
index 013c694..a523137 100644
--- a/ppapi/tests/testing_instance.h
+++ b/ppapi/tests/testing_instance.h
@@ -62,12 +62,17 @@
 
   // Outputs the information from one test run, using the format
   //   <test_name> [PASS|FAIL <error_message>]
+  //
+  // You should generally use one of the RUN_TEST* macros in test_case.h
+  // instead.
+  //
   // If error_message is empty, we say the test passed and emit PASS. If
   // error_message is nonempty, the test failed with that message as the error
   // string.
   //
   // Intended usage:
-  //   LogTest("Foo", FooTest());
+  //   PP_TimeTicks start_time(core.GetTimeTicks());
+  //   LogTest("Foo", FooTest(), start_time);
   //
   // Where FooTest is defined as:
   //   std::string FooTest() {
@@ -75,7 +80,13 @@
   //       return "Something horrible happened";
   //     return "";
   //   }
-  void LogTest(const std::string& test_name, const std::string& error_message);
+  //
+  // NOTE: It's important to get the start time in the previous line, rather
+  //       than calling GetTimeTicks in the LogTestLine. There's no guarantee
+  //       that GetTimeTicks will be evaluated before FooTest().
+  void LogTest(const std::string& test_name,
+               const std::string& error_message,
+               PP_TimeTicks start_time);
 
   // Appends an error message to the log.
   void AppendError(const std::string& message);
@@ -90,6 +101,7 @@
 
   int ssl_server_port() { return ssl_server_port_; }
 
+  const std::string& websocket_host() { return websocket_host_; }
   int websocket_port() { return websocket_port_; }
 
   // Posts a message to the test page to eval() the script.
@@ -115,15 +127,6 @@
   // test. Ownership is passed to the caller. The given string is split by '_'.
   // The test case name is the first part.
   TestCase* CaseForTestName(const std::string& name);
-  // Returns the filter (second part) of the given string. If there is no '_',
-  // returns the empty string, which means 'run all tests for this test case'.
-  // E.g.:
-  //  http://testserver/test_case.html?testcase=PostMessage
-  // Otherwise, the part of the testcase after '_' is returned, and the test
-  // whose name matches that string (if any) will be run:
-  //  http://testserver/test_case.html?testcase=PostMessage_SendingData
-  // Runs 'PostMessage_SendingData.
-  std::string FilterForTestName(const std::string& name);
 
   // Sends a test command to the page using PostMessage.
   void SendTestCommand(const std::string& command);
@@ -166,6 +169,9 @@
   // SSL server port.
   int ssl_server_port_;
 
+  // WebSocket host.
+  std::string websocket_host_;
+
   // WebSocket port.
   int websocket_port_;
 
diff --git a/ppapi/thunk/enter.cc b/ppapi/thunk/enter.cc
index 296a8b4..0248eba 100644
--- a/ppapi/thunk/enter.cc
+++ b/ppapi/thunk/enter.cc
@@ -40,13 +40,16 @@
 EnterBase::EnterBase()
     : resource_(NULL),
       retval_(PP_OK) {
-  // TODO(dmichael) validate that threads have an associated message loop.
 }
 
 EnterBase::EnterBase(PP_Resource resource)
     : resource_(GetResource(resource)),
       retval_(PP_OK) {
-  // TODO(dmichael) validate that threads have an associated message loop.
+}
+
+EnterBase::EnterBase(PP_Instance instance, SingletonResourceID resource_id)
+    : resource_(GetSingletonResource(instance, resource_id)),
+      retval_(PP_OK) {
 }
 
 EnterBase::EnterBase(PP_Resource resource,
@@ -54,8 +57,14 @@
     : resource_(GetResource(resource)),
       retval_(PP_OK) {
   callback_ = new TrackedCallback(resource_, callback);
+}
 
-  // TODO(dmichael) validate that threads have an associated message loop.
+EnterBase::EnterBase(PP_Instance instance, SingletonResourceID resource_id,
+                     const PP_CompletionCallback& callback)
+    : resource_(GetSingletonResource(instance, resource_id)),
+      retval_(PP_OK) {
+  DCHECK(resource_);
+  callback_ = new TrackedCallback(resource_, callback);
 }
 
 EnterBase::~EnterBase() {
@@ -105,6 +114,17 @@
   return PpapiGlobals::Get()->GetResourceTracker()->GetResource(resource);
 }
 
+// static
+Resource* EnterBase::GetSingletonResource(PP_Instance instance,
+                                          SingletonResourceID resource_id) {
+  PPB_Instance_API* ppb_instance =
+      PpapiGlobals::Get()->GetInstanceAPI(instance);
+  if (!ppb_instance)
+    return NULL;
+
+  return ppb_instance->GetSingletonResource(instance, resource_id);
+}
+
 void EnterBase::SetStateForCallbackError(bool report_error) {
   if (PpapiGlobals::Get()->IsHostGlobals()) {
     // In-process plugins can't make PPAPI calls off the main thread.
diff --git a/ppapi/thunk/enter.h b/ppapi/thunk/enter.h
index 276f045..a5a0072 100644
--- a/ppapi/thunk/enter.h
+++ b/ppapi/thunk/enter.h
@@ -11,11 +11,11 @@
 #include "base/memory/ref_counted.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/c/pp_resource.h"
-#include "ppapi/shared_impl/api_id.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
 #include "ppapi/shared_impl/proxy_lock.h"
 #include "ppapi/shared_impl/resource.h"
 #include "ppapi/shared_impl/resource_tracker.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
 #include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/ppapi_thunk_export.h"
 #include "ppapi/thunk/ppb_instance_api.h"
@@ -48,9 +48,13 @@
 
 // This helps us define our RAII Enter classes easily. To make an RAII class
 // which locks the proxy lock on construction and unlocks on destruction,
-// inherit from |LockOnEntry<true>|. For cases where you don't want to lock,
-// inherit from |LockOnEntry<false>|. This allows us to share more code between
-// Enter* and Enter*NoLock classes.
+// inherit from |LockOnEntry<true>| before all other base classes. This ensures
+// that the lock is acquired before any other base class's constructor can run,
+// and that the lock is only released after all other destructors have run.
+// (This order of initialization is guaranteed by C++98/C++11 12.6.2.10).
+//
+// For cases where you don't want to lock, inherit from |LockOnEntry<false>|.
+// This allows us to share more code between Enter* and Enter*NoLock classes.
 template <bool lock_on_entry>
 struct LockOnEntry;
 
@@ -84,7 +88,10 @@
  public:
   EnterBase();
   explicit EnterBase(PP_Resource resource);
+  EnterBase(PP_Instance instance, SingletonResourceID resource_id);
   EnterBase(PP_Resource resource, const PP_CompletionCallback& callback);
+  EnterBase(PP_Instance instance, SingletonResourceID resource_id,
+            const PP_CompletionCallback& callback);
   virtual ~EnterBase();
 
   // Sets the result for calls that use a completion callback. It handles making
@@ -114,6 +121,11 @@
   // it in every template.
   static Resource* GetResource(PP_Resource resource);
 
+  // Helper function to return a Resource from a PP_Instance and singleton
+  // resource identifier.
+  static Resource* GetSingletonResource(PP_Instance instance,
+                                        SingletonResourceID resource_id);
+
   void ClearCallback();
 
   // Does error handling associated with entering a resource. The resource_base
@@ -161,8 +173,9 @@
 // EnterResource ---------------------------------------------------------------
 
 template<typename ResourceT, bool lock_on_entry = true>
-class EnterResource : public subtle::EnterBase,
-                      public subtle::LockOnEntry<lock_on_entry> {
+class EnterResource
+    : public subtle::LockOnEntry<lock_on_entry>,  // Must be first; see above.
+      public subtle::EnterBase {
  public:
   EnterResource(PP_Resource resource, bool report_error)
       : EnterBase(resource) {
@@ -213,10 +226,10 @@
 // EnterInstance ---------------------------------------------------------------
 
 class PPAPI_THUNK_EXPORT EnterInstance
-    : public subtle::EnterBase,
-      public subtle::LockOnEntry<true> {
+    : public subtle::LockOnEntry<true>,  // Must be first; see above.
+      public subtle::EnterBase {
  public:
-  EnterInstance(PP_Instance instance);
+  explicit EnterInstance(PP_Instance instance);
   EnterInstance(PP_Instance instance,
                 const PP_CompletionCallback& callback);
   ~EnterInstance();
@@ -224,17 +237,17 @@
   bool succeeded() const { return !!functions_; }
   bool failed() const { return !functions_; }
 
-  PPB_Instance_API* functions() { return functions_; }
+  PPB_Instance_API* functions() const { return functions_; }
 
  private:
   PPB_Instance_API* functions_;
 };
 
 class PPAPI_THUNK_EXPORT EnterInstanceNoLock
-    : public subtle::EnterBase,
-      public subtle::LockOnEntry<false> {
+    : public subtle::LockOnEntry<false>,  // Must be first; see above.
+      public subtle::EnterBase {
  public:
-  EnterInstanceNoLock(PP_Instance instance);
+  explicit EnterInstanceNoLock(PP_Instance instance);
   EnterInstanceNoLock(PP_Instance instance,
                       const PP_CompletionCallback& callback);
   ~EnterInstanceNoLock();
@@ -245,13 +258,54 @@
   PPB_Instance_API* functions_;
 };
 
+// EnterInstanceAPI ------------------------------------------------------------
+
+template<typename ApiT, bool lock_on_entry = true>
+class EnterInstanceAPI
+    : public subtle::LockOnEntry<lock_on_entry>,  // Must be first; see above
+      public subtle::EnterBase {
+ public:
+  explicit EnterInstanceAPI(PP_Instance instance)
+      : EnterBase(instance, ApiT::kSingletonResourceID),
+        functions_(NULL) {
+    if (resource_)
+      functions_ = resource_->GetAs<ApiT>();
+    SetStateForFunctionError(instance, functions_, true);
+  }
+  EnterInstanceAPI(PP_Instance instance,
+                   const PP_CompletionCallback& callback)
+      : EnterBase(instance, ApiT::kSingletonResourceID, callback),
+        functions_(NULL) {
+    if (resource_)
+      functions_ = resource_->GetAs<ApiT>();
+    SetStateForFunctionError(instance, functions_, true);
+  }
+  ~EnterInstanceAPI() {}
+
+  bool succeeded() const { return !!functions_; }
+  bool failed() const { return !functions_; }
+
+  ApiT* functions() const { return functions_; }
+
+ private:
+  ApiT* functions_;
+};
+
+template<typename ApiT>
+class EnterInstanceAPINoLock : public EnterInstanceAPI<ApiT, false> {
+ public:
+  explicit EnterInstanceAPINoLock(PP_Instance instance)
+      : EnterInstanceAPI<ApiT, false>(instance) {
+  }
+};
+
 // EnterResourceCreation -------------------------------------------------------
 
 class PPAPI_THUNK_EXPORT EnterResourceCreation
-    : public subtle::EnterBase,
-      public subtle::LockOnEntry<true> {
+    : public subtle::LockOnEntry<true>,  // Must be first; see above.
+      public subtle::EnterBase {
  public:
-  EnterResourceCreation(PP_Instance instance);
+  explicit EnterResourceCreation(PP_Instance instance);
   ~EnterResourceCreation();
 
   ResourceCreationAPI* functions() { return functions_; }
@@ -261,10 +315,10 @@
 };
 
 class PPAPI_THUNK_EXPORT EnterResourceCreationNoLock
-    : public subtle::EnterBase,
-      public subtle::LockOnEntry<false> {
+    : public subtle::LockOnEntry<false>,  // Must be first; see above.
+      public subtle::EnterBase {
  public:
-  EnterResourceCreationNoLock(PP_Instance instance);
+  explicit EnterResourceCreationNoLock(PP_Instance instance);
   ~EnterResourceCreationNoLock();
 
   ResourceCreationAPI* functions() { return functions_; }
diff --git a/ppapi/thunk/interfaces_ppb_private.h b/ppapi/thunk/interfaces_ppb_private.h
index ac06344..60ac0bb 100644
--- a/ppapi/thunk/interfaces_ppb_private.h
+++ b/ppapi/thunk/interfaces_ppb_private.h
@@ -17,10 +17,11 @@
 
 #if !defined(OS_NACL)
 PROXIED_API(PPB_Broker)
-PROXIED_API(PPB_Talk_Private)
 
 PROXIED_IFACE(PPB_Broker, PPB_BROKER_TRUSTED_INTERFACE_0_2,
               PPB_BrokerTrusted_0_2)
+PROXIED_IFACE(PPB_Broker, PPB_BROKER_TRUSTED_INTERFACE_0_3,
+              PPB_BrokerTrusted_0_3)
 PROXIED_IFACE(PPB_Instance, PPB_BROWSERFONT_TRUSTED_INTERFACE_1_0,
               PPB_BrowserFont_Trusted_1_0)
 PROXIED_IFACE(PPB_Instance,
@@ -34,15 +35,17 @@
               PPB_FileChooserTrusted_0_6)
 PROXIED_IFACE(PPB_FileRef, PPB_FILEREFPRIVATE_INTERFACE_0_1,
               PPB_FileRefPrivate_0_1)
-// This uses the FileIO API which is declared in the public stable file.
-PROXIED_IFACE(PPB_FileIO, PPB_FILEIOTRUSTED_INTERFACE_0_4,
-              PPB_FileIOTrusted_0_4)
 PROXIED_IFACE(PPB_Instance, PPB_FLASHFULLSCREEN_INTERFACE_0_1,
               PPB_FlashFullscreen_0_1)
 PROXIED_IFACE(PPB_Instance, PPB_FLASHFULLSCREEN_INTERFACE_1_0,
               PPB_FlashFullscreen_0_1)
-PROXIED_IFACE(PPB_Talk_Private, PPB_TALK_PRIVATE_INTERFACE_1_0,
+PROXIED_IFACE(NoAPIName, PPB_PDF_INTERFACE,
+              PPB_PDF)
+
+PROXIED_IFACE(NoAPIName, PPB_TALK_PRIVATE_INTERFACE_1_0,
               PPB_Talk_Private_1_0)
+// This uses the FileIO API which is declared in the public stable file.
+PROXIED_IFACE(NoAPIName, PPB_FILEIOTRUSTED_INTERFACE_0_4, PPB_FileIOTrusted_0_4)
 
 // Hack to keep font working. The Font 0.6 API is binary compatible with
 // BrowserFont 1.0, so just map the string to the same thing.
diff --git a/ppapi/thunk/interfaces_ppb_private_flash.h b/ppapi/thunk/interfaces_ppb_private_flash.h
index b89cd63..a020a3a 100644
--- a/ppapi/thunk/interfaces_ppb_private_flash.h
+++ b/ppapi/thunk/interfaces_ppb_private_flash.h
@@ -7,38 +7,26 @@
 
 #include "ppapi/thunk/interfaces_preamble.h"
 
-PROXIED_API(PPB_Flash)
-PROXIED_IFACE(PPB_Flash,
-              PPB_FLASH_INTERFACE_12_0,
-              PPB_Flash_12_0)
-PROXIED_IFACE(PPB_Flash,
-              PPB_FLASH_INTERFACE_12_1,
-              PPB_Flash_12_1)
-PROXIED_IFACE(PPB_Flash,
-              PPB_FLASH_INTERFACE_12_2,
-              PPB_Flash_12_2)
-PROXIED_IFACE(PPB_Flash,
-              PPB_FLASH_INTERFACE_12_3,
-              PPB_Flash_12_3)
-PROXIED_IFACE(PPB_Flash,
+PROXIED_IFACE(NoAPIName,
               PPB_FLASH_INTERFACE_12_4,
-            PPB_Flash_12_4)
-PROXIED_IFACE(PPB_Flash,
+              PPB_Flash_12_4)
+PROXIED_IFACE(NoAPIName,
               PPB_FLASH_INTERFACE_12_5,
               PPB_Flash_12_5)
-PROXIED_IFACE(PPB_Flash,
+PROXIED_IFACE(NoAPIName,
               PPB_FLASH_INTERFACE_12_6,
               PPB_Flash_12_6)
+PROXIED_IFACE(NoAPIName,
+              PPB_FLASH_INTERFACE_13_0,
+              PPB_Flash_13_0)
 
-PROXIED_IFACE(PPB_Flash,
-              PPB_FLASH_FILE_MODULELOCAL_INTERFACE_2_0,
-              PPB_Flash_File_ModuleLocal_2_0)
-PROXIED_IFACE(PPB_Flash,
+PROXIED_IFACE(NoAPIName,
               PPB_FLASH_FILE_MODULELOCAL_INTERFACE_3_0,
               PPB_Flash_File_ModuleLocal_3_0)
-PROXIED_IFACE(PPB_Flash,
+PROXIED_IFACE(NoAPIName,
               PPB_FLASH_FILE_FILEREF_INTERFACE,
               PPB_Flash_File_FileRef)
+
 PROXIED_IFACE(NoAPIName,
               PPB_FLASH_CLIPBOARD_INTERFACE_4_0,
               PPB_Flash_Clipboard_4_0)
@@ -46,7 +34,6 @@
               PPB_FLASH_CLIPBOARD_INTERFACE_5_0,
               PPB_Flash_Clipboard_5_0)
 
-
 PROXIED_IFACE(NoAPIName,
               PPB_FLASH_DEVICEID_INTERFACE_1_0,
               PPB_Flash_DeviceID_1_0)
@@ -55,8 +42,7 @@
               PPB_FLASH_FONTFILE_INTERFACE_0_1,
               PPB_Flash_FontFile_0_1)
 
-PROXIED_API(PPB_Flash_Menu)
-PROXIED_IFACE(PPB_Flash_Menu,
+PROXIED_IFACE(NoAPIName,
               PPB_FLASH_MENU_INTERFACE_0_2,
               PPB_Flash_Menu_0_2)
 
@@ -65,4 +51,8 @@
               PPB_FLASH_MESSAGELOOP_INTERFACE_0_1,
               PPB_Flash_MessageLoop_0_1)
 
+PROXIED_IFACE(NoAPIName,
+              PPB_FLASH_PRINT_INTERFACE_1_0,
+              PPB_Flash_Print_1_0)
+
 #include "ppapi/thunk/interfaces_postamble.h"
diff --git a/ppapi/thunk/interfaces_ppb_private_no_permissions.h b/ppapi/thunk/interfaces_ppb_private_no_permissions.h
index 0eb636a..059f603 100644
--- a/ppapi/thunk/interfaces_ppb_private_no_permissions.h
+++ b/ppapi/thunk/interfaces_ppb_private_no_permissions.h
@@ -9,14 +9,12 @@
 
 // These interfaces don't require private permissions. However, they only work
 // for whitelisted origins.
-PROXIED_API(PPB_HostResolver_Private)
 PROXIED_API(PPB_TCPServerSocket_Private)
 PROXIED_API(PPB_TCPSocket_Private)
-PROXIED_API(PPB_UDPSocket_Private)
 UNPROXIED_API(PPB_NetworkList_Private)
 PROXIED_API(PPB_NetworkMonitor_Private)
 
-PROXIED_IFACE(PPB_HostResolver_Private, PPB_HOSTRESOLVER_PRIVATE_INTERFACE_0_1,
+PROXIED_IFACE(NoAPIName, PPB_HOSTRESOLVER_PRIVATE_INTERFACE_0_1,
               PPB_HostResolver_Private_0_1)
 PROXIED_IFACE(PPB_TCPServerSocket_Private,
               PPB_TCPSERVERSOCKET_PRIVATE_INTERFACE_0_1,
@@ -25,11 +23,13 @@
               PPB_TCPSocket_Private_0_3)
 PROXIED_IFACE(PPB_TCPSocket_Private, PPB_TCPSOCKET_PRIVATE_INTERFACE_0_4,
               PPB_TCPSocket_Private_0_4)
-PROXIED_IFACE(PPB_UDPSocket_Private, PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2,
+PROXIED_IFACE(PPB_TCPSocket_Private, PPB_TCPSOCKET_PRIVATE_INTERFACE_0_5,
+              PPB_TCPSocket_Private_0_5)
+PROXIED_IFACE(NoAPIName, PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2,
               PPB_UDPSocket_Private_0_2)
-PROXIED_IFACE(PPB_UDPSocket_Private, PPB_UDPSOCKET_PRIVATE_INTERFACE_0_3,
+PROXIED_IFACE(NoAPIName, PPB_UDPSOCKET_PRIVATE_INTERFACE_0_3,
               PPB_UDPSocket_Private_0_3)
-PROXIED_IFACE(PPB_UDPSocket_Private, PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4,
+PROXIED_IFACE(NoAPIName, PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4,
               PPB_UDPSocket_Private_0_4)
 
 PROXIED_IFACE(NoAPIName, PPB_NETADDRESS_PRIVATE_INTERFACE_0_1,
@@ -45,4 +45,3 @@
               PPB_NetworkMonitor_Private_0_2)
 
 #include "ppapi/thunk/interfaces_postamble.h"
-
diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h
index 90007e2..90d00c5 100644
--- a/ppapi/thunk/interfaces_ppb_public_dev.h
+++ b/ppapi/thunk/interfaces_ppb_public_dev.h
@@ -7,65 +7,74 @@
 
 #include "ppapi/thunk/interfaces_preamble.h"
 
+// Map the old dev console interface to the stable one (which is the same) to
+// keep Flash, etc. working.
+PROXIED_IFACE(PPB_Instance, "PPB_Console(Dev);0.1", PPB_Console_1_0)
 PROXIED_IFACE(NoAPIName, PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4,
               PPB_CursorControl_Dev_0_4)
+PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_DEV_INTERFACE_0_5,
+              PPB_FileChooser_Dev_0_5)
+PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_DEV_INTERFACE_0_6,
+              PPB_FileChooser_Dev_0_6)
+UNPROXIED_IFACE(PPB_Find, PPB_FIND_DEV_INTERFACE_0_3, PPB_Find_Dev_0_3)
+PROXIED_IFACE(NoAPIName, PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_2,
+              PPB_IMEInputEvent_Dev_0_2)
+PROXIED_IFACE(NoAPIName, PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_1,
+              PPB_KeyboardInputEvent_Dev_0_1)
 PROXIED_IFACE(NoAPIName, PPB_MEMORY_DEV_INTERFACE_0_1, PPB_Memory_Dev_0_1)
+PROXIED_IFACE(NoAPIName, PPB_PRINTING_DEV_INTERFACE_0_7,
+              PPB_Printing_Dev_0_7)
+PROXIED_IFACE(NoAPIName, PPB_RESOURCEARRAY_DEV_INTERFACE_0_1,
+              PPB_ResourceArray_Dev_0_1)
+PROXIED_IFACE(PPB_Instance, PPB_TEXTINPUT_DEV_INTERFACE_0_2,
+              PPB_TextInput_Dev_0_2)
+PROXIED_IFACE(NoAPIName, PPB_TRUETYPEFONT_DEV_INTERFACE_0_1,
+              PPB_TrueTypeFont_Dev_0_1)
+PROXIED_IFACE(NoAPIName, PPB_VAR_ARRAY_DEV_INTERFACE_0_1, PPB_VarArray_Dev_0_1)
+PROXIED_IFACE(NoAPIName, PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1,
+              PPB_VarDictionary_Dev_0_1)
+PROXIED_IFACE(NoAPIName, PPB_VIEW_DEV_INTERFACE_0_1,
+              PPB_View_Dev_0_1)
+UNPROXIED_IFACE(PPB_Instance, PPB_ZOOM_DEV_INTERFACE_0_2, PPB_Zoom_Dev_0_2)
+PROXIED_IFACE(PPB_Instance, PPB_TRACE_EVENT_DEV_INTERFACE_0_1,
+              PPB_Trace_Event_Dev_0_1)
 
 #if !defined(OS_NACL)
 PROXIED_API(PPB_Buffer)
-UNPROXIED_API(PPB_DirectoryReader)
 UNPROXIED_API(PPB_Scrollbar)
-PROXIED_API(PPB_VideoCapture)
 PROXIED_API(PPB_VideoDecoder)
 UNPROXIED_API(PPB_Widget)
 
 PROXIED_IFACE(NoAPIName, PPB_AUDIO_INPUT_DEV_INTERFACE_0_2,
               PPB_AudioInput_Dev_0_2)
+PROXIED_IFACE(NoAPIName, PPB_AUDIO_INPUT_DEV_INTERFACE_0_3,
+              PPB_AudioInput_Dev_0_3)
 PROXIED_IFACE(NoAPIName, PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_1,
               PPB_IMEInputEvent_Dev_0_1)
-PROXIED_IFACE(NoAPIName, PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_2,
-              PPB_IMEInputEvent_Dev_0_2)
 PROXIED_IFACE(PPB_Buffer, PPB_BUFFER_DEV_INTERFACE_0_4, PPB_Buffer_Dev_0_4)
 PROXIED_IFACE(PPB_Graphics3D,
               PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE_0_1,
               PPB_GLESChromiumTextureMapping_Dev_0_1)
 PROXIED_IFACE(NoAPIName, PPB_CRYPTO_DEV_INTERFACE_0_1, PPB_Crypto_Dev_0_1)
 PROXIED_IFACE(NoAPIName, PPB_DEVICEREF_DEV_INTERFACE_0_1, PPB_DeviceRef_Dev_0_1)
-UNPROXIED_IFACE(PPB_DirectoryReader, PPB_DIRECTORYREADER_DEV_INTERFACE_0_5,
-                PPB_DirectoryReader_Dev_0_5)
-UNPROXIED_IFACE(PPB_Find, PPB_FIND_DEV_INTERFACE_0_3, PPB_Find_Dev_0_3)
-PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_DEV_INTERFACE_0_5,
-              PPB_FileChooser_Dev_0_5)
-PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_DEV_INTERFACE_0_6,
-              PPB_FileChooser_Dev_0_6)
+PROXIED_IFACE(NoAPIName, PPB_DIRECTORYREADER_DEV_INTERFACE_0_6,
+              PPB_DirectoryReader_Dev_0_6)
 PROXIED_IFACE(NoAPIName, PPB_GRAPHICS2D_DEV_INTERFACE_0_1,
               PPB_Graphics2D_Dev_0_1)
 PROXIED_IFACE(PPB_Instance, PPB_CHAR_SET_DEV_INTERFACE_0_4, PPB_CharSet_Dev_0_4)
-PROXIED_IFACE(PPB_Instance, PPB_CONSOLE_DEV_INTERFACE_0_1, PPB_Console_Dev_0_1)
 PROXIED_IFACE(PPB_Instance, PPB_URLUTIL_DEV_INTERFACE_0_6, PPB_URLUtil_Dev_0_6)
-UNPROXIED_IFACE(PPB_Instance, PPB_ZOOM_DEV_INTERFACE_0_2, PPB_Zoom_Dev_0_2)
-PROXIED_IFACE(NoAPIName, PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_1,
-              PPB_KeyboardInputEvent_Dev_0_1)
-PROXIED_IFACE(NoAPIName, PPB_PRINTING_DEV_INTERFACE_0_7,
-              PPB_Printing_Dev_0_7)
 PROXIED_IFACE(PPB_Instance, PPB_PRINTING_DEV_INTERFACE_0_6,
               PPB_Printing_Dev_0_6)
-PROXIED_IFACE(NoAPIName, PPB_RESOURCEARRAY_DEV_INTERFACE_0_1,
-              PPB_ResourceArray_Dev_0_1)
 UNPROXIED_IFACE(PPB_Scrollbar, PPB_SCROLLBAR_DEV_INTERFACE_0_5,
                 PPB_Scrollbar_Dev_0_5)
 PROXIED_IFACE(PPB_Instance, PPB_TEXTINPUT_DEV_INTERFACE_0_1,
               PPB_TextInput_Dev_0_1)
-PROXIED_IFACE(PPB_Instance, PPB_TEXTINPUT_DEV_INTERFACE_0_2,
-              PPB_TextInput_Dev_0_2)
-PROXIED_IFACE(PPB_VideoCapture, PPB_VIDEOCAPTURE_DEV_INTERFACE_0_1,
-              PPB_VideoCapture_Dev_0_1)
-PROXIED_IFACE(PPB_VideoCapture, PPB_VIDEOCAPTURE_DEV_INTERFACE_0_2,
+PROXIED_IFACE(NoAPIName, PPB_VIDEOCAPTURE_DEV_INTERFACE_0_2,
               PPB_VideoCapture_Dev_0_2)
+PROXIED_IFACE(NoAPIName, PPB_VIDEOCAPTURE_DEV_INTERFACE_0_3,
+              PPB_VideoCapture_Dev_0_3)
 PROXIED_IFACE(PPB_VideoDecoder, PPB_VIDEODECODER_DEV_INTERFACE_0_16,
               PPB_VideoDecoder_Dev_0_16)
-PROXIED_IFACE(NoAPIName, PPB_VIEW_DEV_INTERFACE_0_1,
-              PPB_View_Dev_0_1)
 UNPROXIED_IFACE(PPB_Widget, PPB_WIDGET_DEV_INTERFACE_0_3, PPB_Widget_Dev_0_3)
 UNPROXIED_IFACE(PPB_Widget, PPB_WIDGET_DEV_INTERFACE_0_4, PPB_Widget_Dev_0_4)
 #endif  // !defined(OS_NACL)
diff --git a/ppapi/thunk/interfaces_ppb_public_stable.h b/ppapi/thunk/interfaces_ppb_public_stable.h
index 19b299c..3bf9479 100644
--- a/ppapi/thunk/interfaces_ppb_public_stable.h
+++ b/ppapi/thunk/interfaces_ppb_public_stable.h
@@ -19,15 +19,12 @@
 // that exist in the webkit/plugins/ppapi/*_impl.h, but not in the proxy.
 PROXIED_API(PPB_Audio)
 PROXIED_API(PPB_Core)
-PROXIED_API(PPB_FileIO)
 PROXIED_API(PPB_FileRef)
 PROXIED_API(PPB_FileSystem)
-PROXIED_API(PPB_Graphics2D)
 PROXIED_API(PPB_Graphics3D)
 PROXIED_API(PPB_ImageData)
 PROXIED_API(PPB_Instance)
 PROXIED_API(PPB_URLLoader)
-PROXIED_API(PPB_URLResponseInfo)
 
 // AudioConfig isn't proxied in the normal way, we have only local classes and
 // serialize it to a struct when we need it on the host side.
@@ -50,14 +47,16 @@
 // interface string.
 // Note: Core is special and is registered manually.
 PROXIED_IFACE(PPB_Audio, PPB_AUDIO_INTERFACE_1_0, PPB_Audio_1_0)
-PROXIED_IFACE(PPB_FileIO, PPB_FILEIO_INTERFACE_1_0, PPB_FileIO_1_0)
 PROXIED_IFACE(PPB_FileRef, PPB_FILEREF_INTERFACE_1_0, PPB_FileRef_1_0)
 PROXIED_IFACE(PPB_FileSystem, PPB_FILESYSTEM_INTERFACE_1_0, PPB_FileSystem_1_0)
-PROXIED_IFACE(PPB_Graphics2D, PPB_GRAPHICS_2D_INTERFACE_1_0, PPB_Graphics2D_1_0)
 PROXIED_IFACE(PPB_Graphics3D, PPB_GRAPHICS_3D_INTERFACE_1_0, PPB_Graphics3D_1_0)
 PROXIED_IFACE(PPB_ImageData, PPB_IMAGEDATA_INTERFACE_1_0, PPB_ImageData_1_0)
+PROXIED_IFACE(PPB_Instance, PPB_CONSOLE_INTERFACE_1_0, PPB_Console_1_0)
 PROXIED_IFACE(PPB_Instance, PPB_GAMEPAD_INTERFACE_1_0, PPB_Gamepad_1_0)
 PROXIED_IFACE(PPB_Instance, PPB_INSTANCE_INTERFACE_1_0, PPB_Instance_1_0)
+PROXIED_IFACE(NoAPIName, PPB_FILEIO_INTERFACE_1_0, PPB_FileIO_1_0)
+PROXIED_IFACE(NoAPIName, PPB_FILEIO_INTERFACE_1_1, PPB_FileIO_1_1)
+PROXIED_IFACE(NoAPIName, PPB_GRAPHICS_2D_INTERFACE_1_0, PPB_Graphics2D_1_0)
 PROXIED_IFACE(NoAPIName, PPB_INPUT_EVENT_INTERFACE_1_0, PPB_InputEvent_1_0)
 PROXIED_IFACE(NoAPIName, PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0,
               PPB_KeyboardInputEvent_1_0)
@@ -76,7 +75,7 @@
 PROXIED_IFACE(PPB_URLLoader, PPB_URLLOADER_INTERFACE_1_0, PPB_URLLoader_1_0)
 PROXIED_IFACE(NoAPIName, PPB_URLREQUESTINFO_INTERFACE_1_0,
               PPB_URLRequestInfo_1_0)
-PROXIED_IFACE(PPB_URLResponseInfo, PPB_URLRESPONSEINFO_INTERFACE_1_0,
+PROXIED_IFACE(NoAPIName, PPB_URLRESPONSEINFO_INTERFACE_1_0,
               PPB_URLResponseInfo_1_0)
 PROXIED_IFACE(NoAPIName, PPB_WEBSOCKET_INTERFACE_1_0, PPB_WebSocket_1_0)
 
diff --git a/ppapi/thunk/ppb_audio_input_api.h b/ppapi/thunk/ppb_audio_input_api.h
index e820c08..ebae557 100644
--- a/ppapi/thunk/ppb_audio_input_api.h
+++ b/ppapi/thunk/ppb_audio_input_api.h
@@ -20,9 +20,14 @@
  public:
   virtual ~PPB_AudioInput_API() {}
 
-  virtual int32_t EnumerateDevices(PP_Resource* devices,
+  virtual int32_t EnumerateDevices0_2(
+      PP_Resource* devices,
+      scoped_refptr<TrackedCallback> callback) = 0;
+  virtual int32_t EnumerateDevices(const PP_ArrayOutput& output,
                                    scoped_refptr<TrackedCallback> callback) = 0;
-  virtual int32_t Open(const std::string& device_id,
+  virtual int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback,
+                                      void* user_data) = 0;
+  virtual int32_t Open(PP_Resource device_ref,
                        PP_Resource config,
                        PPB_AudioInput_Callback audio_input_callback,
                        void* user_data,
diff --git a/ppapi/thunk/ppb_audio_input_dev_thunk.cc b/ppapi/thunk/ppb_audio_input_dev_thunk.cc
new file mode 100644
index 0000000..7a23c63
--- /dev/null
+++ b/ppapi/thunk/ppb_audio_input_dev_thunk.cc
@@ -0,0 +1,141 @@
+// 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.
+
+// From dev/ppb_audio_input_dev.idl modified Fri Feb 22 11:43:43 2013.
+
+#include "ppapi/c/dev/ppb_audio_input_dev.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_audio_input_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+  EnterResourceCreation enter(instance);
+  if (enter.failed())
+    return 0;
+  return enter.functions()->CreateAudioInput(instance);
+}
+
+PP_Bool IsAudioInput(PP_Resource resource) {
+  EnterResource<PPB_AudioInput_API> enter(resource, false);
+  return PP_FromBool(enter.succeeded());
+}
+
+int32_t EnumerateDevices_0_2(PP_Resource audio_input,
+                             PP_Resource* devices,
+                             struct PP_CompletionCallback callback) {
+  EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true);
+  if (enter.failed())
+    return enter.retval();
+  return enter.SetResult(enter.object()->EnumerateDevices0_2(
+      devices,
+      enter.callback()));
+}
+
+int32_t EnumerateDevices(PP_Resource audio_input,
+                         struct PP_ArrayOutput output,
+                         struct PP_CompletionCallback callback) {
+  EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true);
+  if (enter.failed())
+    return enter.retval();
+  return enter.SetResult(enter.object()->EnumerateDevices(output,
+                                                          enter.callback()));
+}
+
+int32_t MonitorDeviceChange(PP_Resource audio_input,
+                            PP_MonitorDeviceChangeCallback callback,
+                            void* user_data) {
+  EnterResource<PPB_AudioInput_API> enter(audio_input, true);
+  if (enter.failed())
+    return enter.retval();
+  return enter.object()->MonitorDeviceChange(callback, user_data);
+}
+
+int32_t Open(PP_Resource audio_input,
+             PP_Resource device_ref,
+             PP_Resource config,
+             PPB_AudioInput_Callback audio_input_callback,
+             void* user_data,
+             struct PP_CompletionCallback callback) {
+  EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true);
+  if (enter.failed())
+    return enter.retval();
+  return enter.SetResult(enter.object()->Open(device_ref,
+                                              config,
+                                              audio_input_callback,
+                                              user_data,
+                                              enter.callback()));
+}
+
+PP_Resource GetCurrentConfig(PP_Resource audio_input) {
+  EnterResource<PPB_AudioInput_API> enter(audio_input, true);
+  if (enter.failed())
+    return 0;
+  return enter.object()->GetCurrentConfig();
+}
+
+PP_Bool StartCapture(PP_Resource audio_input) {
+  EnterResource<PPB_AudioInput_API> enter(audio_input, true);
+  if (enter.failed())
+    return PP_FALSE;
+  return enter.object()->StartCapture();
+}
+
+PP_Bool StopCapture(PP_Resource audio_input) {
+  EnterResource<PPB_AudioInput_API> enter(audio_input, true);
+  if (enter.failed())
+    return PP_FALSE;
+  return enter.object()->StopCapture();
+}
+
+void Close(PP_Resource audio_input) {
+  EnterResource<PPB_AudioInput_API> enter(audio_input, true);
+  if (enter.succeeded())
+    enter.object()->Close();
+}
+
+const PPB_AudioInput_Dev_0_2 g_ppb_audioinput_dev_thunk_0_2 = {
+  &Create,
+  &IsAudioInput,
+  &EnumerateDevices_0_2,
+  &Open,
+  &GetCurrentConfig,
+  &StartCapture,
+  &StopCapture,
+  &Close
+};
+
+const PPB_AudioInput_Dev_0_3 g_ppb_audioinput_dev_thunk_0_3 = {
+  &Create,
+  &IsAudioInput,
+  &EnumerateDevices,
+  &MonitorDeviceChange,
+  &Open,
+  &GetCurrentConfig,
+  &StartCapture,
+  &StopCapture,
+  &Close
+};
+
+}  // namespace
+
+const PPB_AudioInput_Dev_0_2* GetPPB_AudioInput_Dev_0_2_Thunk() {
+  return &g_ppb_audioinput_dev_thunk_0_2;
+}
+
+const PPB_AudioInput_Dev_0_3* GetPPB_AudioInput_Dev_0_3_Thunk() {
+  return &g_ppb_audioinput_dev_thunk_0_3;
+}
+
+}  // namespace thunk
+}  // namespace ppapi
diff --git a/ppapi/thunk/ppb_audio_input_thunk.cc b/ppapi/thunk/ppb_audio_input_thunk.cc
deleted file mode 100644
index 94d978d..0000000
--- a/ppapi/thunk/ppb_audio_input_thunk.cc
+++ /dev/null
@@ -1,116 +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 "ppapi/c/pp_errors.h"
-#include "ppapi/shared_impl/ppb_device_ref_shared.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_device_ref_api.h"
-#include "ppapi/thunk/ppb_audio_input_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
-#include "ppapi/thunk/thunk.h"
-
-namespace ppapi {
-namespace thunk {
-
-namespace {
-
-typedef EnterResource<PPB_AudioInput_API> EnterAudioInput;
-
-PP_Resource Create(PP_Instance instance) {
-  EnterResourceCreation enter(instance);
-  if (enter.failed())
-    return 0;
-
-  return enter.functions()->CreateAudioInput(instance);
-}
-
-PP_Bool IsAudioInput(PP_Resource resource) {
-  EnterAudioInput enter(resource, false);
-  return PP_FromBool(enter.succeeded());
-}
-
-int32_t EnumerateDevices(PP_Resource audio_input,
-                         PP_Resource* devices,
-                         PP_CompletionCallback callback) {
-  EnterAudioInput enter(audio_input, callback, true);
-  if (enter.failed())
-    return enter.retval();
-
-  return enter.SetResult(enter.object()->EnumerateDevices(devices,
-                                                          enter.callback()));
-}
-
-int32_t Open(PP_Resource audio_input,
-             PP_Resource device_ref,
-             PP_Resource config,
-             PPB_AudioInput_Callback audio_input_callback,
-             void* user_data,
-             PP_CompletionCallback callback) {
-  EnterAudioInput enter(audio_input, callback, true);
-  if (enter.failed())
-    return enter.retval();
-
-  std::string device_id;
-  // |device_id| remains empty if |device_ref| is 0, which means the default
-  // device.
-  if (device_ref != 0) {
-    EnterResourceNoLock<PPB_DeviceRef_API> enter_device_ref(device_ref, true);
-    if (enter_device_ref.failed())
-      return enter.SetResult(PP_ERROR_BADRESOURCE);
-    device_id = enter_device_ref.object()->GetDeviceRefData().id;
-  }
-
-  return enter.SetResult(enter.object()->Open(
-      device_id, config, audio_input_callback, user_data, enter.callback()));
-}
-
-PP_Resource GetCurrentConfig(PP_Resource audio_input) {
-  EnterAudioInput enter(audio_input, true);
-  if (enter.failed())
-    return 0;
-  return enter.object()->GetCurrentConfig();
-}
-
-PP_Bool StartCapture(PP_Resource audio_input) {
-  EnterAudioInput enter(audio_input, true);
-  if (enter.failed())
-    return PP_FALSE;
-
-  return enter.object()->StartCapture();
-}
-
-PP_Bool StopCapture(PP_Resource audio_input) {
-  EnterAudioInput enter(audio_input, true);
-  if (enter.failed())
-    return PP_FALSE;
-
-  return enter.object()->StopCapture();
-}
-
-void Close(PP_Resource audio_input) {
-  EnterAudioInput enter(audio_input, true);
-  if (enter.succeeded())
-    enter.object()->Close();
-}
-
-const PPB_AudioInput_Dev_0_2 g_ppb_audioinput_0_2_thunk = {
-  &Create,
-  &IsAudioInput,
-  &EnumerateDevices,
-  &Open,
-  &GetCurrentConfig,
-  &StartCapture,
-  &StopCapture,
-  &Close
-};
-
-}  // namespace
-
-const PPB_AudioInput_Dev_0_2* GetPPB_AudioInput_Dev_0_2_Thunk() {
-  return &g_ppb_audioinput_0_2_thunk;
-}
-
-}  // namespace thunk
-}  // namespace ppapi
diff --git a/ppapi/thunk/ppb_audio_thunk.cc b/ppapi/thunk/ppb_audio_thunk.cc
index 28740e5..1bd1692 100644
--- a/ppapi/thunk/ppb_audio_thunk.cc
+++ b/ppapi/thunk/ppb_audio_thunk.cc
@@ -2,59 +2,65 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "ppapi/thunk/thunk.h"
+// From ppb_audio.idl modified Thu Dec 20 13:10:26 2012.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_audio.h"
+#include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/ppb_audio_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
 #include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
 namespace thunk {
 
 namespace {
 
-typedef EnterResource<PPB_Audio_API> EnterAudio;
-
 PP_Resource Create(PP_Instance instance,
-                   PP_Resource config_id,
-                   PPB_Audio_Callback callback,
+                   PP_Resource config,
+                   PPB_Audio_Callback audio_callback,
                    void* user_data) {
   EnterResourceCreation enter(instance);
   if (enter.failed())
     return 0;
-  return enter.functions()->CreateAudio(instance, config_id,
-                                        callback, user_data);
+  return enter.functions()->CreateAudio(instance,
+                                        config,
+                                        audio_callback,
+                                        user_data);
 }
 
 PP_Bool IsAudio(PP_Resource resource) {
-  EnterAudio enter(resource, false);
-  return enter.succeeded() ? PP_TRUE : PP_FALSE;
+  EnterResource<PPB_Audio_API> enter(resource, false);
+  return PP_FromBool(enter.succeeded());
 }
 
-PP_Resource GetCurrentConfiguration(PP_Resource audio_id) {
-  EnterAudio enter(audio_id, true);
+PP_Resource GetCurrentConfig(PP_Resource audio) {
+  EnterResource<PPB_Audio_API> enter(audio, true);
   if (enter.failed())
     return 0;
   return enter.object()->GetCurrentConfig();
 }
 
-PP_Bool StartPlayback(PP_Resource audio_id) {
-  EnterAudio enter(audio_id, true);
+PP_Bool StartPlayback(PP_Resource audio) {
+  EnterResource<PPB_Audio_API> enter(audio, true);
   if (enter.failed())
     return PP_FALSE;
   return enter.object()->StartPlayback();
 }
 
-PP_Bool StopPlayback(PP_Resource audio_id) {
-  EnterAudio enter(audio_id, true);
+PP_Bool StopPlayback(PP_Resource audio) {
+  EnterResource<PPB_Audio_API> enter(audio, true);
   if (enter.failed())
     return PP_FALSE;
   return enter.object()->StopPlayback();
 }
 
-const PPB_Audio g_ppb_audio_thunk = {
+const PPB_Audio_1_0 g_ppb_audio_thunk_1_0 = {
   &Create,
   &IsAudio,
-  &GetCurrentConfiguration,
+  &GetCurrentConfig,
   &StartPlayback,
   &StopPlayback
 };
@@ -62,7 +68,7 @@
 }  // namespace
 
 const PPB_Audio_1_0* GetPPB_Audio_1_0_Thunk() {
-  return &g_ppb_audio_thunk;
+  return &g_ppb_audio_thunk_1_0;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_broker_api.h b/ppapi/thunk/ppb_broker_api.h
index 803c99e..8ac1dd2 100644
--- a/ppapi/thunk/ppb_broker_api.h
+++ b/ppapi/thunk/ppb_broker_api.h
@@ -6,8 +6,10 @@
 #define PPAPI_THUNK_PPB_BROKER_API_H_
 
 #include "base/memory/ref_counted.h"
+#include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/pp_stdint.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
 
 namespace ppapi {
 
@@ -23,6 +25,19 @@
   virtual int32_t GetHandle(int32_t* handle) = 0;
 };
 
+// TODO(raymes): Merge this into PPB_Broker_API when the PPB_Broker proxy is
+// refactored to the new resource model. The IsAllowed function should be
+// attached to the resource implementing the PPB_Broker_API. However in order to
+// implement this quickly, the function is added in a new instance API.
+class PPB_Broker_Instance_API {
+ public:
+  virtual ~PPB_Broker_Instance_API() {}
+
+  virtual PP_Bool IsAllowed() = 0;
+
+  static const SingletonResourceID kSingletonResourceID = BROKER_SINGLETON_ID;
+};
+
 }  // namespace thunk
 }  // namespace ppapi
 
diff --git a/ppapi/thunk/ppb_broker_thunk.cc b/ppapi/thunk/ppb_broker_thunk.cc
index fa192b6..0f2f1c9 100644
--- a/ppapi/thunk/ppb_broker_thunk.cc
+++ b/ppapi/thunk/ppb_broker_thunk.cc
@@ -42,17 +42,44 @@
   return enter.object()->GetHandle(handle);
 }
 
-const PPB_BrokerTrusted g_ppb_broker_thunk = {
+PP_Bool IsAllowed(PP_Resource resource) {
+  // TODO(raymes): This is a hack. See the note in ppb_broker_api.h.
+  PP_Instance instance = 0;
+  {
+    EnterResource<PPB_Broker_API> enter_resource(resource, true);
+    if (enter_resource.failed())
+      return PP_FALSE;
+    instance = enter_resource.resource()->pp_instance();
+  }
+  EnterInstanceAPI<PPB_Broker_Instance_API> enter_instance(instance);
+  if (enter_instance.failed())
+    return PP_FALSE;
+  return enter_instance.functions()->IsAllowed();
+}
+
+const PPB_BrokerTrusted_0_2 g_ppb_broker_0_2_thunk = {
   &CreateTrusted,
   &IsBrokerTrusted,
   &Connect,
   &GetHandle,
 };
 
+const PPB_BrokerTrusted_0_3 g_ppb_broker_0_3_thunk = {
+  &CreateTrusted,
+  &IsBrokerTrusted,
+  &Connect,
+  &GetHandle,
+  &IsAllowed,
+};
+
 }  // namespace
 
 const PPB_BrokerTrusted_0_2* GetPPB_BrokerTrusted_0_2_Thunk() {
-  return &g_ppb_broker_thunk;
+  return &g_ppb_broker_0_2_thunk;
+}
+
+const PPB_BrokerTrusted_0_3* GetPPB_BrokerTrusted_0_3_Thunk() {
+  return &g_ppb_broker_0_3_thunk;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_browser_font_singleton_api.h b/ppapi/thunk/ppb_browser_font_singleton_api.h
new file mode 100644
index 0000000..e5717d6
--- /dev/null
+++ b/ppapi/thunk/ppb_browser_font_singleton_api.h
@@ -0,0 +1,28 @@
+// 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 PPAPI_THUNK_PPB_BROWSER_FONT_SINGLETON_API_H_
+#define PPAPI_THUNK_PPB_BROWSER_FONT_SINGLETON_API_H_
+
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPB_BrowserFont_Singleton_API {
+ public:
+  virtual ~PPB_BrowserFont_Singleton_API() {}
+
+  virtual PP_Var GetFontFamilies(PP_Instance instance) = 0;
+
+  static const SingletonResourceID kSingletonResourceID =
+      BROWSER_FONT_SINGLETON_ID;
+};
+
+}  // namespace thunk
+}  // namespace ppapi
+
+#endif  // PPAPI_THUNK_PPB_BROWSER_FONT_SINGLETON_API_H_
diff --git a/ppapi/thunk/ppb_browser_font_trusted_thunk.cc b/ppapi/thunk/ppb_browser_font_trusted_thunk.cc
index bcbc798..5db8b84 100644
--- a/ppapi/thunk/ppb_browser_font_trusted_thunk.cc
+++ b/ppapi/thunk/ppb_browser_font_trusted_thunk.cc
@@ -4,6 +4,7 @@
 
 #include "ppapi/thunk/thunk.h"
 #include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_browser_font_singleton_api.h"
 #include "ppapi/thunk/ppb_browser_font_trusted_api.h"
 #include "ppapi/thunk/resource_creation_api.h"
 
@@ -15,7 +16,7 @@
 typedef EnterResource<PPB_BrowserFont_Trusted_API> EnterBrowserFont;
 
 PP_Var GetFontFamilies(PP_Instance instance) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_BrowserFont_Singleton_API> enter(instance);
   if (enter.failed())
     return PP_MakeUndefined();
   return enter.functions()->GetFontFamilies(instance);
diff --git a/ppapi/thunk/ppb_buffer_api.h b/ppapi/thunk/ppb_buffer_api.h
index f11bbd0..2542ec4 100644
--- a/ppapi/thunk/ppb_buffer_api.h
+++ b/ppapi/thunk/ppb_buffer_api.h
@@ -7,11 +7,12 @@
 
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_stdint.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
 
 namespace ppapi {
 namespace thunk {
 
-class PPB_Buffer_API {
+class PPAPI_THUNK_EXPORT PPB_Buffer_API {
  public:
   virtual ~PPB_Buffer_API() {}
 
@@ -19,6 +20,9 @@
   virtual PP_Bool IsMapped() = 0;
   virtual void* Map() = 0;
   virtual void Unmap() = 0;
+
+  // Trusted API
+  virtual int32_t GetSharedMemory(int* handle) = 0;
 };
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_buffer_trusted_api.h b/ppapi/thunk/ppb_buffer_trusted_api.h
deleted file mode 100644
index 5301e6e..0000000
--- a/ppapi/thunk/ppb_buffer_trusted_api.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PPAPI_THUNK_BUFFER_TRUSTED_API_H_
-#define PPAPI_THUNK_BUFFER_TRUSTED_API_H_
-
-#include "ppapi/c/dev/ppb_buffer_dev.h"
-#include "ppapi/c/trusted/ppb_buffer_trusted.h"
-
-namespace ppapi {
-namespace thunk {
-
-class PPB_BufferTrusted_API {
- public:
-  virtual ~PPB_BufferTrusted_API() {}
-
-  virtual int32_t GetSharedMemory(int* handle) = 0;
-};
-
-}  // namespace thunk
-}  // namespace ppapi
-
-#endif  // PPAPI_THUNK_BUFFER_TRUSTED_API_H_
diff --git a/ppapi/thunk/ppb_buffer_trusted_thunk.cc b/ppapi/thunk/ppb_buffer_trusted_thunk.cc
index ba6c32e..7aa2750 100644
--- a/ppapi/thunk/ppb_buffer_trusted_thunk.cc
+++ b/ppapi/thunk/ppb_buffer_trusted_thunk.cc
@@ -2,32 +2,37 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+// From trusted/ppb_buffer_trusted.idl modified Wed Feb  6 15:21:31 2013.
+
 #include "ppapi/c/pp_errors.h"
-#include "ppapi/thunk/thunk.h"
+#include "ppapi/c/trusted/ppb_buffer_trusted.h"
+#include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_buffer_trusted_api.h"
+#include "ppapi/thunk/ppb_buffer_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
 #include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
 namespace thunk {
 
 namespace {
 
-int32_t GetSharedMemory(PP_Resource buffer_id, int* shm_handle) {
-  EnterResource<PPB_BufferTrusted_API> enter(buffer_id, true);
+int32_t GetSharedMemory(PP_Resource buffer, int* handle) {
+  EnterResource<PPB_Buffer_API> enter(buffer, true);
   if (enter.failed())
     return enter.retval();
-  return enter.object()->GetSharedMemory(shm_handle);
+  return enter.object()->GetSharedMemory(handle);
 }
 
-const PPB_BufferTrusted g_ppb_buffer_trusted_thunk = {
-  &GetSharedMemory,
+const PPB_BufferTrusted_0_1 g_ppb_buffertrusted_thunk_0_1 = {
+  &GetSharedMemory
 };
 
 }  // namespace
 
 const PPB_BufferTrusted_0_1* GetPPB_BufferTrusted_0_1_Thunk() {
-  return &g_ppb_buffer_trusted_thunk;
+  return &g_ppb_buffertrusted_thunk_0_1;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_console_thunk.cc b/ppapi/thunk/ppb_console_thunk.cc
index 1a14164..2dd5481 100644
--- a/ppapi/thunk/ppb_console_thunk.cc
+++ b/ppapi/thunk/ppb_console_thunk.cc
@@ -2,40 +2,45 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "ppapi/c/dev/ppb_console_dev.h"
-#include "ppapi/thunk/thunk.h"
+// From ppb_console.idl modified Thu Dec 20 13:10:26 2012.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_console.h"
+#include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
 namespace thunk {
 
 namespace {
 
-void Log(PP_Instance instance, PP_LogLevel_Dev level, struct PP_Var value) {
+void Log(PP_Instance instance, PP_LogLevel level, struct PP_Var value) {
   EnterInstance enter(instance);
   if (enter.succeeded())
-    return enter.functions()->Log(instance, level, value);
+    enter.functions()->Log(instance, level, value);
 }
 
 void LogWithSource(PP_Instance instance,
-                   PP_LogLevel_Dev level,
-                   PP_Var source,
-                   PP_Var value) {
+                   PP_LogLevel level,
+                   struct PP_Var source,
+                   struct PP_Var value) {
   EnterInstance enter(instance);
   if (enter.succeeded())
-    return enter.functions()->LogWithSource(instance, level, source, value);
+    enter.functions()->LogWithSource(instance, level, source, value);
 }
 
-const PPB_Console_Dev g_ppb_console_thunk = {
+const PPB_Console_1_0 g_ppb_console_thunk_1_0 = {
   &Log,
   &LogWithSource
 };
 
 }  // namespace
 
-const PPB_Console_Dev_0_1* GetPPB_Console_Dev_0_1_Thunk() {
-  return &g_ppb_console_thunk;
+const PPB_Console_1_0* GetPPB_Console_1_0_Thunk() {
+  return &g_ppb_console_thunk_1_0;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_content_decryptor_private_thunk.cc b/ppapi/thunk/ppb_content_decryptor_private_thunk.cc
index 905d482..c6417b4 100644
--- a/ppapi/thunk/ppb_content_decryptor_private_thunk.cc
+++ b/ppapi/thunk/ppb_content_decryptor_private_thunk.cc
@@ -2,9 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+// From private/ppb_content_decryptor_private.idl,
+//   modified Mon Feb 25 14:49:36 2013.
+
+#include "ppapi/c/pp_errors.h"
 #include "ppapi/c/private/ppb_content_decryptor_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
 #include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
@@ -13,52 +19,58 @@
 namespace {
 
 void NeedKey(PP_Instance instance,
-             PP_Var key_system,
-             PP_Var session_id,
-             PP_Var init_data) {
+             struct PP_Var key_system,
+             struct PP_Var session_id,
+             struct PP_Var init_data) {
   EnterInstance enter(instance);
   if (enter.succeeded())
     enter.functions()->NeedKey(instance, key_system, session_id, init_data);
 }
 
 void KeyAdded(PP_Instance instance,
-              PP_Var key_system,
-              PP_Var session_id) {
+              struct PP_Var key_system,
+              struct PP_Var session_id) {
   EnterInstance enter(instance);
   if (enter.succeeded())
     enter.functions()->KeyAdded(instance, key_system, session_id);
 }
 
 void KeyMessage(PP_Instance instance,
-                PP_Var key_system,
-                PP_Var session_id,
-                PP_Resource message,
-                PP_Var default_url) {
+                struct PP_Var key_system,
+                struct PP_Var session_id,
+                struct PP_Var message,
+                struct PP_Var default_url) {
   EnterInstance enter(instance);
-  if (enter.succeeded()) {
-    enter.functions()->KeyMessage(instance, key_system, session_id, message,
+  if (enter.succeeded())
+    enter.functions()->KeyMessage(instance,
+                                  key_system,
+                                  session_id,
+                                  message,
                                   default_url);
-  }
 }
 
 void KeyError(PP_Instance instance,
-              PP_Var key_system,
-              PP_Var session_id,
+              struct PP_Var key_system,
+              struct PP_Var session_id,
               int32_t media_error,
               int32_t system_code) {
   EnterInstance enter(instance);
-  if (enter.succeeded()) {
-    enter.functions()->KeyError(instance, key_system, session_id, media_error,
+  if (enter.succeeded())
+    enter.functions()->KeyError(instance,
+                                key_system,
+                                session_id,
+                                media_error,
                                 system_code);
-  }
 }
 
 void DeliverBlock(PP_Instance instance,
                   PP_Resource decrypted_block,
-                  const PP_DecryptedBlockInfo* block_info) {
+                  const struct PP_DecryptedBlockInfo* decrypted_block_info) {
   EnterInstance enter(instance);
   if (enter.succeeded())
-    enter.functions()->DeliverBlock(instance, decrypted_block, block_info);
+    enter.functions()->DeliverBlock(instance,
+                                    decrypted_block,
+                                    decrypted_block_info);
 }
 
 void DecoderInitializeDone(PP_Instance instance,
@@ -66,23 +78,21 @@
                            uint32_t request_id,
                            PP_Bool success) {
   EnterInstance enter(instance);
-  if (enter.succeeded()) {
+  if (enter.succeeded())
     enter.functions()->DecoderInitializeDone(instance,
                                              decoder_type,
                                              request_id,
                                              success);
-  }
 }
 
 void DecoderDeinitializeDone(PP_Instance instance,
                              PP_DecryptorStreamType decoder_type,
                              uint32_t request_id) {
   EnterInstance enter(instance);
-  if (enter.succeeded()) {
+  if (enter.succeeded())
     enter.functions()->DecoderDeinitializeDone(instance,
                                                decoder_type,
                                                request_id);
-  }
 }
 
 void DecoderResetDone(PP_Instance instance,
@@ -95,21 +105,27 @@
 
 void DeliverFrame(PP_Instance instance,
                   PP_Resource decrypted_frame,
-                  const PP_DecryptedFrameInfo* frame_info) {
+                  const struct PP_DecryptedFrameInfo* decrypted_frame_info) {
   EnterInstance enter(instance);
   if (enter.succeeded())
-    enter.functions()->DeliverFrame(instance, decrypted_frame, frame_info);
+    enter.functions()->DeliverFrame(instance,
+                                    decrypted_frame,
+                                    decrypted_frame_info);
 }
 
-void DeliverSamples(PP_Instance instance,
-                    PP_Resource audio_frames,
-                    const PP_DecryptedBlockInfo* block_info) {
+void DeliverSamples(
+    PP_Instance instance,
+    PP_Resource audio_frames,
+    const struct PP_DecryptedBlockInfo* decrypted_block_info) {
   EnterInstance enter(instance);
   if (enter.succeeded())
-    enter.functions()->DeliverSamples(instance, audio_frames, block_info);
+    enter.functions()->DeliverSamples(instance,
+                                      audio_frames,
+                                      decrypted_block_info);
 }
 
-const PPB_ContentDecryptor_Private g_ppb_decryption_thunk = {
+const PPB_ContentDecryptor_Private_0_6
+    g_ppb_contentdecryptor_private_thunk_0_6 = {
   &NeedKey,
   &KeyAdded,
   &KeyMessage,
@@ -124,9 +140,9 @@
 
 }  // namespace
 
-const PPB_ContentDecryptor_Private*
+const PPB_ContentDecryptor_Private_0_6*
     GetPPB_ContentDecryptor_Private_0_6_Thunk() {
-  return &g_ppb_decryption_thunk;
+  return &g_ppb_contentdecryptor_private_thunk_0_6;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_device_ref_thunk.cc b/ppapi/thunk/ppb_device_ref_dev_thunk.cc
similarity index 67%
rename from ppapi/thunk/ppb_device_ref_thunk.cc
rename to ppapi/thunk/ppb_device_ref_dev_thunk.cc
index 7424ca4..6e16288 100644
--- a/ppapi/thunk/ppb_device_ref_thunk.cc
+++ b/ppapi/thunk/ppb_device_ref_dev_thunk.cc
@@ -2,8 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+// From dev/ppb_device_ref_dev.idl modified Tue Jan 22 12:22:52 2013.
+
+#include "ppapi/c/dev/ppb_device_ref_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/ppb_device_ref_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
 #include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
@@ -13,7 +20,7 @@
 
 PP_Bool IsDeviceRef(PP_Resource resource) {
   EnterResource<PPB_DeviceRef_API> enter(resource, false);
-  return enter.succeeded() ? PP_TRUE : PP_FALSE;
+  return PP_FromBool(enter.succeeded());
 }
 
 PP_DeviceType_Dev GetType(PP_Resource device_ref) {
@@ -23,14 +30,14 @@
   return enter.object()->GetType();
 }
 
-PP_Var GetName(PP_Resource device_ref) {
+struct PP_Var GetName(PP_Resource device_ref) {
   EnterResource<PPB_DeviceRef_API> enter(device_ref, true);
   if (enter.failed())
     return PP_MakeUndefined();
   return enter.object()->GetName();
 }
 
-const PPB_DeviceRef_Dev g_ppb_device_ref_thunk = {
+const PPB_DeviceRef_Dev_0_1 g_ppb_deviceref_dev_thunk_0_1 = {
   &IsDeviceRef,
   &GetType,
   &GetName
@@ -39,7 +46,7 @@
 }  // namespace
 
 const PPB_DeviceRef_Dev_0_1* GetPPB_DeviceRef_Dev_0_1_Thunk() {
-  return &g_ppb_device_ref_thunk;
+  return &g_ppb_deviceref_dev_thunk_0_1;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_directory_reader_api.h b/ppapi/thunk/ppb_directory_reader_api.h
index 6a32934..cf71ddf 100644
--- a/ppapi/thunk/ppb_directory_reader_api.h
+++ b/ppapi/thunk/ppb_directory_reader_api.h
@@ -18,8 +18,8 @@
  public:
   virtual ~PPB_DirectoryReader_API() {}
 
-  virtual int32_t GetNextEntry(PP_DirectoryEntry_Dev* entry,
-                               scoped_refptr<TrackedCallback> callback) = 0;
+  virtual int32_t ReadEntries(const PP_ArrayOutput& output,
+                              scoped_refptr<TrackedCallback> callback) = 0;
 };
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_directory_reader_thunk.cc b/ppapi/thunk/ppb_directory_reader_thunk.cc
index 8ff54e9..aaee6f7 100644
--- a/ppapi/thunk/ppb_directory_reader_thunk.cc
+++ b/ppapi/thunk/ppb_directory_reader_thunk.cc
@@ -5,6 +5,7 @@
 #include "ppapi/c/dev/ppb_directory_reader_dev.h"
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/proxy_lock.h"
 #include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/thunk.h"
@@ -17,14 +18,16 @@
 namespace {
 
 PP_Resource Create(PP_Resource directory_ref) {
+  ppapi::ProxyAutoLock lock;
   Resource* object =
       PpapiGlobals::Get()->GetResourceTracker()->GetResource(directory_ref);
   if (!object)
     return 0;
-  EnterResourceCreation enter(object->pp_instance());
+  EnterResourceCreationNoLock enter(object->pp_instance());
   if (enter.failed())
     return 0;
-  return enter.functions()->CreateDirectoryReader(directory_ref);
+  return enter.functions()->CreateDirectoryReader(
+      object->pp_instance(), directory_ref);
 }
 
 PP_Bool IsDirectoryReader(PP_Resource resource) {
@@ -32,25 +35,25 @@
   return PP_FromBool(enter.succeeded());
 }
 
-int32_t GetNextEntry(PP_Resource directory_reader,
-                     PP_DirectoryEntry_Dev* entry,
-                     PP_CompletionCallback callback) {
+int32_t ReadEntries(PP_Resource directory_reader,
+                    PP_ArrayOutput output,
+                    PP_CompletionCallback callback) {
   EnterResource<PPB_DirectoryReader_API> enter(
       directory_reader, callback, true);
   if (enter.failed())
     return enter.retval();
-  return enter.SetResult(enter.object()->GetNextEntry(entry, enter.callback()));
+  return enter.SetResult(enter.object()->ReadEntries(output, enter.callback()));
 }
 
 const PPB_DirectoryReader_Dev g_ppb_directory_reader_thunk = {
   &Create,
   &IsDirectoryReader,
-  &GetNextEntry
+  &ReadEntries
 };
 
 }  // namespace
 
-const PPB_DirectoryReader_Dev_0_5* GetPPB_DirectoryReader_Dev_0_5_Thunk() {
+const PPB_DirectoryReader_Dev_0_6* GetPPB_DirectoryReader_Dev_0_6_Thunk() {
   return &g_ppb_directory_reader_thunk;
 }
 
diff --git a/ppapi/thunk/ppb_file_io_api.h b/ppapi/thunk/ppb_file_io_api.h
index 1e6e3ad..b7b3d90 100644
--- a/ppapi/thunk/ppb_file_io_api.h
+++ b/ppapi/thunk/ppb_file_io_api.h
@@ -31,6 +31,10 @@
                        char* buffer,
                        int32_t bytes_to_read,
                        scoped_refptr<TrackedCallback> callback) = 0;
+  virtual int32_t ReadToArray(int64_t offset,
+                              int32_t max_read_length,
+                              PP_ArrayOutput* buffer,
+                              scoped_refptr<TrackedCallback> callback) = 0;
   virtual int32_t Write(int64_t offset,
                         const char* buffer,
                         int32_t bytes_to_write,
diff --git a/ppapi/thunk/ppb_file_io_thunk.cc b/ppapi/thunk/ppb_file_io_thunk.cc
index 8fcfa52..52bc524 100644
--- a/ppapi/thunk/ppb_file_io_thunk.cc
+++ b/ppapi/thunk/ppb_file_io_thunk.cc
@@ -2,21 +2,23 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+// From ppb_file_io.idl modified Thu Dec 20 13:10:26 2012.
+
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_file_io.h"
 #include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/thunk.h"
 #include "ppapi/thunk/ppb_file_io_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
 #include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
 namespace thunk {
 
 namespace {
 
-typedef EnterResource<PPB_FileIO_API> EnterFileIO;
-
 PP_Resource Create(PP_Instance instance) {
   EnterResourceCreation enter(instance);
   if (enter.failed())
@@ -25,25 +27,26 @@
 }
 
 PP_Bool IsFileIO(PP_Resource resource) {
-  EnterFileIO enter(resource, false);
+  EnterResource<PPB_FileIO_API> enter(resource, false);
   return PP_FromBool(enter.succeeded());
 }
 
 int32_t Open(PP_Resource file_io,
              PP_Resource file_ref,
              int32_t open_flags,
-             PP_CompletionCallback callback) {
-  EnterFileIO enter(file_io, callback, true);
+             struct PP_CompletionCallback callback) {
+  EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
   if (enter.failed())
     return enter.retval();
-  return enter.SetResult(enter.object()->Open(file_ref, open_flags,
-                         enter.callback()));
+  return enter.SetResult(enter.object()->Open(file_ref,
+                                              open_flags,
+                                              enter.callback()));
 }
 
 int32_t Query(PP_Resource file_io,
-              PP_FileInfo* info,
-              PP_CompletionCallback callback) {
-  EnterFileIO enter(file_io, callback, true);
+              struct PP_FileInfo* info,
+              struct PP_CompletionCallback callback) {
+  EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
   if (enter.failed())
     return enter.retval();
   return enter.SetResult(enter.object()->Query(info, enter.callback()));
@@ -52,23 +55,26 @@
 int32_t Touch(PP_Resource file_io,
               PP_Time last_access_time,
               PP_Time last_modified_time,
-              PP_CompletionCallback callback) {
-  EnterFileIO enter(file_io, callback, true);
+              struct PP_CompletionCallback callback) {
+  EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
   if (enter.failed())
     return enter.retval();
-  return enter.SetResult(enter.object()->Touch(
-      last_access_time, last_modified_time, enter.callback()));
+  return enter.SetResult(enter.object()->Touch(last_access_time,
+                                               last_modified_time,
+                                               enter.callback()));
 }
 
 int32_t Read(PP_Resource file_io,
              int64_t offset,
              char* buffer,
              int32_t bytes_to_read,
-             PP_CompletionCallback callback) {
-  EnterFileIO enter(file_io, callback, true);
+             struct PP_CompletionCallback callback) {
+  EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
   if (enter.failed())
     return enter.retval();
-  return enter.SetResult(enter.object()->Read(offset, buffer, bytes_to_read,
+  return enter.SetResult(enter.object()->Read(offset,
+                                              buffer,
+                                              bytes_to_read,
                                               enter.callback()));
 }
 
@@ -76,38 +82,53 @@
               int64_t offset,
               const char* buffer,
               int32_t bytes_to_write,
-              PP_CompletionCallback callback) {
-  EnterFileIO enter(file_io, callback, true);
+              struct PP_CompletionCallback callback) {
+  EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
   if (enter.failed())
     return enter.retval();
-  return enter.SetResult(enter.object()->Write(offset, buffer, bytes_to_write,
+  return enter.SetResult(enter.object()->Write(offset,
+                                               buffer,
+                                               bytes_to_write,
                                                enter.callback()));
 }
 
 int32_t SetLength(PP_Resource file_io,
                   int64_t length,
-                  PP_CompletionCallback callback) {
-  EnterFileIO enter(file_io, callback, true);
+                  struct PP_CompletionCallback callback) {
+  EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
   if (enter.failed())
     return enter.retval();
   return enter.SetResult(enter.object()->SetLength(length, enter.callback()));
 }
 
-int32_t Flush(PP_Resource file_io,
-              PP_CompletionCallback callback) {
-  EnterFileIO enter(file_io, callback, true);
+int32_t Flush(PP_Resource file_io, struct PP_CompletionCallback callback) {
+  EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
   if (enter.failed())
     return enter.retval();
   return enter.SetResult(enter.object()->Flush(enter.callback()));
 }
 
 void Close(PP_Resource file_io) {
-  EnterFileIO enter(file_io, true);
+  EnterResource<PPB_FileIO_API> enter(file_io, true);
   if (enter.succeeded())
     enter.object()->Close();
 }
 
-const PPB_FileIO g_ppb_file_io_thunk = {
+int32_t ReadToArray(PP_Resource file_io,
+                    int64_t offset,
+                    int32_t max_read_length,
+                    struct PP_ArrayOutput* output,
+                    struct PP_CompletionCallback callback) {
+  EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
+  if (enter.failed())
+    return enter.retval();
+  return enter.SetResult(enter.object()->ReadToArray(offset,
+                                                     max_read_length,
+                                                     output,
+                                                     enter.callback()));
+}
+
+const PPB_FileIO_1_0 g_ppb_fileio_thunk_1_0 = {
   &Create,
   &IsFileIO,
   &Open,
@@ -120,10 +141,28 @@
   &Close
 };
 
+const PPB_FileIO_1_1 g_ppb_fileio_thunk_1_1 = {
+  &Create,
+  &IsFileIO,
+  &Open,
+  &Query,
+  &Touch,
+  &Read,
+  &Write,
+  &SetLength,
+  &Flush,
+  &Close,
+  &ReadToArray
+};
+
 }  // namespace
 
 const PPB_FileIO_1_0* GetPPB_FileIO_1_0_Thunk() {
-  return &g_ppb_file_io_thunk;
+  return &g_ppb_fileio_thunk_1_0;
+}
+
+const PPB_FileIO_1_1* GetPPB_FileIO_1_1_Thunk() {
+  return &g_ppb_fileio_thunk_1_1;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_file_ref_api.h b/ppapi/thunk/ppb_file_ref_api.h
index ed46098..0f9bbaa 100644
--- a/ppapi/thunk/ppb_file_ref_api.h
+++ b/ppapi/thunk/ppb_file_ref_api.h
@@ -33,7 +33,7 @@
   virtual int32_t Rename(PP_Resource new_file_ref,
                          scoped_refptr<TrackedCallback> callback) = 0;
 
-  // Intermal function for use in proxying. Returns the internal CreateInfo
+  // Internal function for use in proxying. Returns the internal CreateInfo
   // (the contained resource does not carry a ref on behalf of the caller).
   virtual const PPB_FileRef_CreateInfo& GetCreateInfo() const = 0;
 
diff --git a/ppapi/thunk/ppb_file_ref_thunk.cc b/ppapi/thunk/ppb_file_ref_thunk.cc
index 15122db..74db508 100644
--- a/ppapi/thunk/ppb_file_ref_thunk.cc
+++ b/ppapi/thunk/ppb_file_ref_thunk.cc
@@ -7,6 +7,7 @@
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/c/private/ppb_file_ref_private.h"
+#include "ppapi/shared_impl/proxy_lock.h"
 #include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/thunk.h"
@@ -21,11 +22,12 @@
 typedef EnterResource<PPB_FileRef_API> EnterFileRef;
 
 PP_Resource Create(PP_Resource file_system, const char* path) {
+  ppapi::ProxyAutoLock lock;
   Resource* object =
       PpapiGlobals::Get()->GetResourceTracker()->GetResource(file_system);
   if (!object)
     return 0;
-  EnterResourceCreation enter(object->pp_instance());
+  EnterResourceCreationNoLock enter(object->pp_instance());
   if (enter.failed())
     return 0;
   return enter.functions()->CreateFileRef(file_system, path);
diff --git a/ppapi/thunk/ppb_file_system_thunk.cc b/ppapi/thunk/ppb_file_system_thunk.cc
index 327594c..df02ec6 100644
--- a/ppapi/thunk/ppb_file_system_thunk.cc
+++ b/ppapi/thunk/ppb_file_system_thunk.cc
@@ -2,22 +2,23 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+// From ppb_file_system.idl modified Thu Dec 20 13:10:26 2012.
+
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/c/ppb_file_system.h"
 #include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/thunk.h"
 #include "ppapi/thunk/ppb_file_system_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
 #include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
 namespace thunk {
 
 namespace {
 
-typedef EnterResource<PPB_FileSystem_API> EnterFileSystem;
-
 PP_Resource Create(PP_Instance instance, PP_FileSystemType type) {
   EnterResourceCreation enter(instance);
   if (enter.failed())
@@ -26,27 +27,27 @@
 }
 
 PP_Bool IsFileSystem(PP_Resource resource) {
-  EnterFileSystem enter(resource, false);
+  EnterResource<PPB_FileSystem_API> enter(resource, false);
   return PP_FromBool(enter.succeeded());
 }
 
 int32_t Open(PP_Resource file_system,
-             int64 expected_size,
-             PP_CompletionCallback callback) {
-  EnterFileSystem enter(file_system, callback, true);
+             int64_t expected_size,
+             struct PP_CompletionCallback callback) {
+  EnterResource<PPB_FileSystem_API> enter(file_system, callback, true);
   if (enter.failed())
     return enter.retval();
   return enter.SetResult(enter.object()->Open(expected_size, enter.callback()));
 }
 
 PP_FileSystemType GetType(PP_Resource file_system) {
-  EnterFileSystem enter(file_system, true);
+  EnterResource<PPB_FileSystem_API> enter(file_system, true);
   if (enter.failed())
     return PP_FILESYSTEMTYPE_INVALID;
   return enter.object()->GetType();
 }
 
-const PPB_FileSystem g_ppb_file_system_thunk = {
+const PPB_FileSystem_1_0 g_ppb_filesystem_thunk_1_0 = {
   &Create,
   &IsFileSystem,
   &Open,
@@ -56,7 +57,7 @@
 }  // namespace
 
 const PPB_FileSystem_1_0* GetPPB_FileSystem_1_0_Thunk() {
-  return &g_ppb_file_system_thunk;
+  return &g_ppb_filesystem_thunk_1_0;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_find_thunk.cc b/ppapi/thunk/ppb_find_dev_thunk.cc
similarity index 60%
rename from ppapi/thunk/ppb_find_thunk.cc
rename to ppapi/thunk/ppb_find_dev_thunk.cc
index 53911e4..84b94dc 100644
--- a/ppapi/thunk/ppb_find_thunk.cc
+++ b/ppapi/thunk/ppb_find_dev_thunk.cc
@@ -2,9 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+// From dev/ppb_find_dev.idl modified Tue Dec  4 10:44:11 2012.
+
 #include "ppapi/c/dev/ppb_find_dev.h"
-#include "ppapi/thunk/thunk.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
 namespace thunk {
@@ -13,10 +19,12 @@
 
 void NumberOfFindResultsChanged(PP_Instance instance,
                                 int32_t total,
-                                PP_Bool final) {
+                                PP_Bool final_result) {
   EnterInstance enter(instance);
   if (enter.succeeded())
-    enter.functions()->NumberOfFindResultsChanged(instance, total, final);
+    enter.functions()->NumberOfFindResultsChanged(instance,
+                                                  total,
+                                                  final_result);
 }
 
 void SelectedFindResultChanged(PP_Instance instance, int32_t index) {
@@ -25,7 +33,7 @@
     enter.functions()->SelectedFindResultChanged(instance, index);
 }
 
-const PPB_Find_Dev g_ppb_find_thunk = {
+const PPB_Find_Dev_0_3 g_ppb_find_dev_thunk_0_3 = {
   &NumberOfFindResultsChanged,
   &SelectedFindResultChanged
 };
@@ -33,7 +41,7 @@
 }  // namespace
 
 const PPB_Find_Dev_0_3* GetPPB_Find_Dev_0_3_Thunk() {
-  return &g_ppb_find_thunk;
+  return &g_ppb_find_dev_thunk_0_3;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_flash_api.h b/ppapi/thunk/ppb_flash_api.h
deleted file mode 100644
index 1a7ed5b..0000000
--- a/ppapi/thunk/ppb_flash_api.h
+++ /dev/null
@@ -1,114 +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 PPAPI_THUNK_PPB_FLASH_API_H_
-#define PPAPI_THUNK_PPB_FLASH_API_H_
-
-#include "ppapi/c/private/ppb_flash.h"
-#include "ppapi/c/private/ppb_flash_file.h"
-#include "ppapi/thunk/ppapi_thunk_export.h"
-
-namespace ppapi {
-
-struct URLRequestInfoData;
-
-namespace thunk {
-
-/////////////////////////// WARNING:DEPRECTATED ////////////////////////////////
-// Please do not add any new functions to this API. They should be implemented
-// in the new-style resource proxy (see flash_functions_api.h and
-// flash_resource.h).
-// TODO(raymes): All of these functions should be moved to
-// flash_functions_api.h.
-////////////////////////////////////////////////////////////////////////////////
-// This class collects all of the Flash interface-related APIs into one place.
-class PPAPI_THUNK_EXPORT PPB_Flash_API {
- public:
-  virtual ~PPB_Flash_API() {}
-
-  // Flash.
-  virtual void SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) = 0;
-  virtual PP_Bool DrawGlyphs(PP_Instance instance,
-                             PP_Resource pp_image_data,
-                             const PP_FontDescription_Dev* font_desc,
-                             uint32_t color,
-                             const PP_Point* position,
-                             const PP_Rect* clip,
-                             const float transformation[3][3],
-                             PP_Bool allow_subpixel_aa,
-                             uint32_t glyph_count,
-                             const uint16_t glyph_indices[],
-                             const PP_Point glyph_advances[]) = 0;
-  virtual PP_Var GetProxyForURL(PP_Instance instance, const char* url) = 0;
-
-  // External function that takes a PPB_URLRequestInfo resource.
-  virtual int32_t Navigate(PP_Instance instance,
-                           PP_Resource request_info,
-                           const char* target,
-                           PP_Bool from_user_action) = 0;
-
-  // Internal navigate function that takes a URLRequestInfoData.
-  virtual int32_t Navigate(PP_Instance instance,
-                           const URLRequestInfoData& data,
-                           const char* target,
-                           PP_Bool from_user_action) = 0;
-
-  virtual void RunMessageLoop(PP_Instance instance) = 0;
-  virtual void QuitMessageLoop(PP_Instance instance) = 0;
-  virtual double GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) = 0;
-  virtual PP_Bool IsRectTopmost(PP_Instance instance, const PP_Rect* rect) = 0;
-  virtual void UpdateActivity(PP_Instance instance) = 0;
-  virtual PP_Var GetDeviceID(PP_Instance instance) = 0;
-  virtual int32_t GetSettingInt(PP_Instance instance,
-                                PP_FlashSetting setting) = 0;
-  virtual PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) = 0;
-  virtual PP_Bool SetCrashData(PP_Instance instance,
-                               PP_FlashCrashKey key,
-                               PP_Var value) = 0;
-
-  // FlashFile_ModuleLocal.
-  virtual bool CreateThreadAdapterForInstance(PP_Instance instance) = 0;
-  virtual void ClearThreadAdapterForInstance(PP_Instance instance) = 0;
-  virtual int32_t OpenFile(PP_Instance instance,
-                           const char* path,
-                           int32_t mode,
-                           PP_FileHandle* file) = 0;
-  virtual int32_t RenameFile(PP_Instance instance,
-                             const char* path_from,
-                             const char* path_to) = 0;
-  virtual int32_t DeleteFileOrDir(PP_Instance instance,
-                                  const char* path,
-                                  PP_Bool recursive) = 0;
-  virtual int32_t CreateDir(PP_Instance instance, const char* path) = 0;
-  virtual int32_t QueryFile(PP_Instance instance,
-                            const char* path,
-                            PP_FileInfo* info) = 0;
-  virtual int32_t GetDirContents(PP_Instance instance,
-                                 const char* path,
-                                 PP_DirContents_Dev** contents) = 0;
-  virtual void FreeDirContents(PP_Instance instance,
-                               PP_DirContents_Dev* contents) = 0;
-  virtual int32_t CreateTemporaryFile(PP_Instance instance,
-                                      PP_FileHandle* file) = 0;
-
-  // FlashFile_FileRef.
-  virtual int32_t OpenFileRef(PP_Instance instance,
-                              PP_Resource file_ref,
-                              int32_t mode,
-                              PP_FileHandle* file) = 0;
-  virtual int32_t QueryFileRef(PP_Instance instance,
-                               PP_Resource file_ref,
-                               PP_FileInfo* info) = 0;
-
-  // FlashFullscreen.
-  virtual PP_Bool FlashIsFullscreen(PP_Instance instance) = 0;
-  virtual PP_Bool FlashSetFullscreen(PP_Instance instance,
-                                     PP_Bool fullscreen) = 0;
-  virtual PP_Bool FlashGetScreenSize(PP_Instance instance, PP_Size* size) = 0;
-};
-
-}  // namespace thunk
-}  // namespace ppapi
-
-#endif // PPAPI_THUNK_PPB_FLASH_API_H_
diff --git a/ppapi/thunk/ppb_flash_clipboard_api.h b/ppapi/thunk/ppb_flash_clipboard_api.h
index ef022c4..4be9aee 100644
--- a/ppapi/thunk/ppb_flash_clipboard_api.h
+++ b/ppapi/thunk/ppb_flash_clipboard_api.h
@@ -6,6 +6,7 @@
 #define PPAPI_THUNK_PPB_FLASH_CLIPBOARD_API_H_
 
 #include "ppapi/c/private/ppb_flash_clipboard.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
 
 namespace ppapi {
 namespace thunk {
@@ -15,23 +16,22 @@
   virtual ~PPB_Flash_Clipboard_API() {}
 
   // PPB_Flash_Clipboard.
-  virtual uint32_t RegisterCustomFormat(
-    PP_Instance instance,
-    const char* format_name) = 0;
-  virtual PP_Bool IsFormatAvailable(
-    PP_Instance instance,
-    PP_Flash_Clipboard_Type clipboard_type,
-    uint32_t format) = 0;
-  virtual PP_Var ReadData(
-    PP_Instance instance,
-    PP_Flash_Clipboard_Type clipboard_type,
-    uint32_t format) = 0;
-  virtual int32_t WriteData(
-    PP_Instance instance,
-    PP_Flash_Clipboard_Type clipboard_type,
-    uint32_t data_item_count,
-    const uint32_t formats[],
-    const PP_Var data_items[]) = 0;
+  virtual uint32_t RegisterCustomFormat(PP_Instance instance,
+                                        const char* format_name) = 0;
+  virtual PP_Bool IsFormatAvailable(PP_Instance instance,
+                                    PP_Flash_Clipboard_Type clipboard_type,
+                                    uint32_t format) = 0;
+  virtual PP_Var ReadData(PP_Instance instance,
+                          PP_Flash_Clipboard_Type clipboard_type,
+                          uint32_t format) = 0;
+  virtual int32_t WriteData(PP_Instance instance,
+                            PP_Flash_Clipboard_Type clipboard_type,
+                            uint32_t data_item_count,
+                            const uint32_t formats[],
+                            const PP_Var data_items[]) = 0;
+
+  static const SingletonResourceID kSingletonResourceID =
+      FLASH_CLIPBOARD_SINGLETON_ID;
 };
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_flash_clipboard_thunk.cc b/ppapi/thunk/ppb_flash_clipboard_thunk.cc
index d982cd5..fcdc52e 100644
--- a/ppapi/thunk/ppb_flash_clipboard_thunk.cc
+++ b/ppapi/thunk/ppb_flash_clipboard_thunk.cc
@@ -16,31 +16,28 @@
 
 uint32_t RegisterCustomFormat(PP_Instance instance,
                               const char* format_name) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_Clipboard_API> enter(instance);
   if (enter.failed())
     return PP_FALSE;
-  return enter.functions()->GetFlashClipboardAPI(
-      instance)->RegisterCustomFormat(instance, format_name);
+  return enter.functions()->RegisterCustomFormat(instance, format_name);
 }
 
 PP_Bool IsFormatAvailable(PP_Instance instance,
                           PP_Flash_Clipboard_Type clipboard_type,
                           uint32_t format) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_Clipboard_API> enter(instance);
   if (enter.failed())
     return PP_FALSE;
-  return enter.functions()->GetFlashClipboardAPI(
-      instance)->IsFormatAvailable(instance, clipboard_type, format);
+  return enter.functions()->IsFormatAvailable(instance, clipboard_type, format);
 }
 
 PP_Var ReadData(PP_Instance instance,
                 PP_Flash_Clipboard_Type clipboard_type,
                 uint32_t format) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_Clipboard_API> enter(instance);
   if (enter.failed())
     return PP_MakeUndefined();
-  return enter.functions()->GetFlashClipboardAPI(instance)->ReadData(
-      instance, clipboard_type, format);
+  return enter.functions()->ReadData(instance, clipboard_type, format);
 }
 
 int32_t WriteData(PP_Instance instance,
@@ -48,10 +45,10 @@
                   uint32_t data_item_count,
                   const uint32_t formats[],
                   const PP_Var data_items[]) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_Clipboard_API> enter(instance);
   if (enter.failed())
     return enter.retval();
-  return enter.functions()->GetFlashClipboardAPI(instance)->WriteData(
+  return enter.functions()->WriteData(
       instance, clipboard_type, data_item_count, formats, data_items);
 }
 
diff --git a/ppapi/thunk/ppb_flash_device_id_thunk.cc b/ppapi/thunk/ppb_flash_device_id_thunk.cc
index 498df75..09a3749 100644
--- a/ppapi/thunk/ppb_flash_device_id_thunk.cc
+++ b/ppapi/thunk/ppb_flash_device_id_thunk.cc
@@ -2,11 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+// From private/ppb_flash_device_id.idl modified Thu Dec 20 13:10:26 2012.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
 #include "ppapi/c/private/ppb_flash_device_id.h"
+#include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/thunk.h"
 #include "ppapi/thunk/ppb_flash_device_id_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
 #include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
 namespace thunk {
@@ -20,16 +26,16 @@
   return enter.functions()->CreateFlashDeviceID(instance);
 }
 
-int32_t GetDeviceID(PP_Resource resource,
-                    PP_Var* id,
-                    PP_CompletionCallback callback) {
-  EnterResource<PPB_Flash_DeviceID_API> enter(resource, callback, true);
+int32_t GetDeviceID(PP_Resource device_id,
+                    struct PP_Var* id,
+                    struct PP_CompletionCallback callback) {
+  EnterResource<PPB_Flash_DeviceID_API> enter(device_id, callback, true);
   if (enter.failed())
     return enter.retval();
   return enter.SetResult(enter.object()->GetDeviceID(id, enter.callback()));
 }
 
-const PPB_Flash_DeviceID g_ppb_flash_deviceid_thunk = {
+const PPB_Flash_DeviceID_1_0 g_ppb_flash_deviceid_thunk_1_0 = {
   &Create,
   &GetDeviceID
 };
@@ -37,7 +43,7 @@
 }  // namespace
 
 const PPB_Flash_DeviceID_1_0* GetPPB_Flash_DeviceID_1_0_Thunk() {
-  return &g_ppb_flash_deviceid_thunk;
+  return &g_ppb_flash_deviceid_thunk_1_0;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_flash_file_api.h b/ppapi/thunk/ppb_flash_file_api.h
new file mode 100644
index 0000000..d757253
--- /dev/null
+++ b/ppapi/thunk/ppb_flash_file_api.h
@@ -0,0 +1,63 @@
+// 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 PPAPI_THUNK_PPB_FLASH_FILE_API_H_
+#define PPAPI_THUNK_PPB_FLASH_FILE_API_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/private/pp_file_handle.h"
+#include "ppapi/c/private/ppb_flash_file.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+struct PP_FileInfo;
+
+namespace ppapi {
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_Flash_File_API {
+ public:
+  virtual ~PPB_Flash_File_API() {}
+
+  // FlashFile_ModuleLocal.
+  virtual int32_t OpenFile(PP_Instance instance,
+                           const char* path,
+                           int32_t mode,
+                           PP_FileHandle* file) = 0;
+  virtual int32_t RenameFile(PP_Instance instance,
+                             const char* path_from,
+                             const char* path_to) = 0;
+  virtual int32_t DeleteFileOrDir(PP_Instance instance,
+                                  const char* path,
+                                  PP_Bool recursive) = 0;
+  virtual int32_t CreateDir(PP_Instance instance, const char* path) = 0;
+  virtual int32_t QueryFile(PP_Instance instance,
+                            const char* path,
+                            PP_FileInfo* info) = 0;
+  virtual int32_t GetDirContents(PP_Instance instance,
+                                 const char* path,
+                                 PP_DirContents_Dev** contents) = 0;
+  virtual void FreeDirContents(PP_Instance instance,
+                               PP_DirContents_Dev* contents) = 0;
+  virtual int32_t CreateTemporaryFile(PP_Instance instance,
+                                      PP_FileHandle* file) = 0;
+
+  // FlashFile_FileRef.
+  virtual int32_t OpenFileRef(PP_Instance instance,
+                              PP_Resource file_ref,
+                              int32_t mode,
+                              PP_FileHandle* file) = 0;
+  virtual int32_t QueryFileRef(PP_Instance instance,
+                               PP_Resource file_ref,
+                               PP_FileInfo* info) = 0;
+
+  static const SingletonResourceID kSingletonResourceID =
+      FLASH_FILE_SINGLETON_ID;
+};
+
+}  // namespace thunk
+}  // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_FLASH_FILE_API_H_
diff --git a/ppapi/thunk/ppb_flash_file_fileref_thunk.cc b/ppapi/thunk/ppb_flash_file_fileref_thunk.cc
index 2b380c7..8ea0f24 100644
--- a/ppapi/thunk/ppb_flash_file_fileref_thunk.cc
+++ b/ppapi/thunk/ppb_flash_file_fileref_thunk.cc
@@ -6,8 +6,7 @@
 #include "ppapi/c/private/ppb_flash_file.h"
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/ppb_file_ref_api.h"
-#include "ppapi/thunk/ppb_flash_api.h"
-#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_flash_file_api.h"
 #include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
@@ -27,22 +26,20 @@
   // TODO(brettw): this function should take an instance.
   // To work around this, use the PP_Instance from the resource.
   PP_Instance instance = GetInstanceFromFileRef(file_ref_id);
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
   if (enter.failed())
     return PP_ERROR_BADARGUMENT;
-  return enter.functions()->GetFlashAPI()->OpenFileRef(instance, file_ref_id,
-                                                       mode, file);
+  return enter.functions()->OpenFileRef(instance, file_ref_id, mode, file);
 }
 
 int32_t QueryFile(PP_Resource file_ref_id, struct PP_FileInfo* info) {
   // TODO(brettw): this function should take an instance.
   // To work around this, use the PP_Instance from the resource.
   PP_Instance instance = GetInstanceFromFileRef(file_ref_id);
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
   if (enter.failed())
     return PP_ERROR_BADARGUMENT;
-  return enter.functions()->GetFlashAPI()->QueryFileRef(instance, file_ref_id,
-                                                        info);
+  return enter.functions()->QueryFileRef(instance, file_ref_id, info);
 }
 
 const PPB_Flash_File_FileRef g_ppb_flash_file_fileref_thunk = {
diff --git a/ppapi/thunk/ppb_flash_file_modulelocal_thunk.cc b/ppapi/thunk/ppb_flash_file_modulelocal_thunk.cc
index 7e9678a..11962e4 100644
--- a/ppapi/thunk/ppb_flash_file_modulelocal_thunk.cc
+++ b/ppapi/thunk/ppb_flash_file_modulelocal_thunk.cc
@@ -5,8 +5,7 @@
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/c/private/ppb_flash_file.h"
 #include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_flash_api.h"
-#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_flash_file_api.h"
 #include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
@@ -15,103 +14,79 @@
 namespace {
 
 bool CreateThreadAdapterForInstance(PP_Instance instance) {
-  EnterInstance enter(instance);
-  if (enter.failed())
-    return false;
-  return enter.functions()->GetFlashAPI()->CreateThreadAdapterForInstance(
-      instance);
+  return true;
 }
 
 void ClearThreadAdapterForInstance(PP_Instance instance) {
-  EnterInstance enter(instance);
-  if (enter.succeeded()) {
-    return enter.functions()->GetFlashAPI()->ClearThreadAdapterForInstance(
-        instance);
-  }
 }
 
 int32_t OpenFile(PP_Instance instance,
                  const char* path,
                  int32_t mode,
                  PP_FileHandle* file) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
   if (enter.failed())
     return PP_ERROR_BADARGUMENT;
-  return enter.functions()->GetFlashAPI()->OpenFile(instance, path, mode, file);
+  return enter.functions()->OpenFile(instance, path, mode, file);
 }
 
 int32_t RenameFile(PP_Instance instance,
                    const char* path_from,
                    const char* path_to) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
   if (enter.failed())
     return PP_ERROR_BADARGUMENT;
-  return enter.functions()->GetFlashAPI()->RenameFile(instance,
-                                                      path_from, path_to);
+  return enter.functions()->RenameFile(instance, path_from, path_to);
 }
 
 int32_t DeleteFileOrDir(PP_Instance instance,
                         const char* path,
                         PP_Bool recursive) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
   if (enter.failed())
     return PP_ERROR_BADARGUMENT;
-  return enter.functions()->GetFlashAPI()->DeleteFileOrDir(instance, path,
-                                                           recursive);
+  return enter.functions()->DeleteFileOrDir(instance, path, recursive);
 }
 
 int32_t CreateDir(PP_Instance instance, const char* path) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
   if (enter.failed())
     return PP_ERROR_BADARGUMENT;
-  return enter.functions()->GetFlashAPI()->CreateDir(instance, path);
+  return enter.functions()->CreateDir(instance, path);
 }
 
 int32_t QueryFile(PP_Instance instance, const char* path, PP_FileInfo* info) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
   if (enter.failed())
     return PP_ERROR_BADARGUMENT;
-  return enter.functions()->GetFlashAPI()->QueryFile(instance, path, info);
+  return enter.functions()->QueryFile(instance, path, info);
 }
 
 int32_t GetDirContents(PP_Instance instance,
                        const char* path,
                        PP_DirContents_Dev** contents) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
   if (enter.failed())
     return PP_ERROR_BADARGUMENT;
-  return enter.functions()->GetFlashAPI()->GetDirContents(instance, path,
-                                                          contents);
+  return enter.functions()->GetDirContents(instance, path, contents);
 }
 
 void FreeDirContents(PP_Instance instance,
                      PP_DirContents_Dev* contents) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
   if (enter.succeeded())
-    enter.functions()->GetFlashAPI()->FreeDirContents(instance, contents);
+    enter.functions()->FreeDirContents(instance, contents);
 }
 
 int32_t CreateTemporaryFile(PP_Instance instance, PP_FileHandle* file) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
   if (enter.failed())
     return PP_ERROR_BADARGUMENT;
 
   *file = PP_kInvalidFileHandle;
-  return enter.functions()->GetFlashAPI()->CreateTemporaryFile(instance, file);
+  return enter.functions()->CreateTemporaryFile(instance, file);
 }
 
-const PPB_Flash_File_ModuleLocal_2_0 g_ppb_flash_file_modulelocal_thunk_2_0 = {
-  &CreateThreadAdapterForInstance,
-  &ClearThreadAdapterForInstance,
-  &OpenFile,
-  &RenameFile,
-  &DeleteFileOrDir,
-  &CreateDir,
-  &QueryFile,
-  &GetDirContents,
-  &FreeDirContents
-};
-
 const PPB_Flash_File_ModuleLocal_3_0 g_ppb_flash_file_modulelocal_thunk_3_0 = {
   &CreateThreadAdapterForInstance,
   &ClearThreadAdapterForInstance,
@@ -127,11 +102,6 @@
 
 }  // namespace
 
-const PPB_Flash_File_ModuleLocal_2_0*
-    GetPPB_Flash_File_ModuleLocal_2_0_Thunk() {
-  return &g_ppb_flash_file_modulelocal_thunk_2_0;
-}
-
 const PPB_Flash_File_ModuleLocal_3_0*
     GetPPB_Flash_File_ModuleLocal_3_0_Thunk() {
   return &g_ppb_flash_file_modulelocal_thunk_3_0;
diff --git a/ppapi/thunk/ppb_flash_font_file_thunk.cc b/ppapi/thunk/ppb_flash_font_file_thunk.cc
index ee338f0..3a07365 100644
--- a/ppapi/thunk/ppb_flash_font_file_thunk.cc
+++ b/ppapi/thunk/ppb_flash_font_file_thunk.cc
@@ -14,7 +14,7 @@
 namespace {
 
 PP_Resource Create(PP_Instance instance,
-                   const PP_FontDescription_Dev* description,
+                   const PP_BrowserFont_Trusted_Description* description,
                    PP_PrivateFontCharset charset) {
   EnterResourceCreation enter(instance);
   if (enter.failed())
diff --git a/ppapi/thunk/ppb_flash_fullscreen_api.h b/ppapi/thunk/ppb_flash_fullscreen_api.h
new file mode 100644
index 0000000..d1435b5
--- /dev/null
+++ b/ppapi/thunk/ppb_flash_fullscreen_api.h
@@ -0,0 +1,35 @@
+// 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 PPAPI_THUNK_PPB_FLASH_FULLSCREEN_API_H_
+#define PPAPI_THUNK_PPB_FLASH_FULLSCREEN_API_H_
+
+#include "ppapi/shared_impl/singleton_resource_id.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_Flash_Fullscreen_API {
+ public:
+  virtual ~PPB_Flash_Fullscreen_API() {}
+
+  virtual PP_Bool IsFullscreen(PP_Instance instance) = 0;
+  virtual PP_Bool SetFullscreen(PP_Instance instance,
+                                PP_Bool fullscreen) = 0;
+
+  // Internal function used to update whether or not Flash fullscreen is enabled
+  // in the plugin side. The value is passed with a
+  // PpapiMsg_PPPInstance_DidChangeView message.
+  virtual void SetLocalIsFullscreen(PP_Instance instance,
+                                    PP_Bool fullscreen) = 0;
+
+  static const SingletonResourceID kSingletonResourceID =
+      FLASH_FULLSCREEN_SINGLETON_ID;
+};
+
+}  // namespace thunk
+}  // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_FLASH_FULLSCREEN_API_H_
diff --git a/ppapi/thunk/ppb_flash_fullscreen_thunk.cc b/ppapi/thunk/ppb_flash_fullscreen_thunk.cc
index 598dc71..f64ad99 100644
--- a/ppapi/thunk/ppb_flash_fullscreen_thunk.cc
+++ b/ppapi/thunk/ppb_flash_fullscreen_thunk.cc
@@ -6,8 +6,8 @@
 #include "ppapi/c/private/ppb_flash_fullscreen.h"
 #include "ppapi/thunk/thunk.h"
 #include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_fullscreen_api.h"
 #include "ppapi/thunk/ppb_instance_api.h"
-#include "ppapi/thunk/ppb_flash_api.h"
 #include "ppapi/thunk/resource_creation_api.h"
 
 namespace ppapi {
@@ -16,25 +16,26 @@
 namespace {
 
 PP_Bool IsFullscreen(PP_Instance instance) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_Fullscreen_API> enter(instance);
   if (enter.failed())
     return PP_FALSE;
-  return enter.functions()->GetFlashAPI()->FlashIsFullscreen(instance);
+  return enter.functions()->IsFullscreen(instance);
 }
 
 PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_Fullscreen_API> enter(instance);
   if (enter.failed())
     return PP_FALSE;
-  return enter.functions()->GetFlashAPI()->FlashSetFullscreen(instance,
-                                                              fullscreen);
+  return enter.functions()->SetFullscreen(instance, fullscreen);
 }
 
+// TODO(raymes): The codepaths for GetScreenSize in PPB_Fullscreen and
+// PPB_Flash_Fullscreen are the same. Consider deprecating the flash version.
 PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) {
   EnterInstance enter(instance);
   if (enter.failed())
     return PP_FALSE;
-  return enter.functions()->GetFlashAPI()->FlashGetScreenSize(instance, size);
+  return enter.functions()->GetScreenSize(instance, size);
 }
 
 const PPB_FlashFullscreen_0_1 g_ppb_flash_fullscreen_thunk = {
diff --git a/ppapi/thunk/ppb_flash_functions_api.h b/ppapi/thunk/ppb_flash_functions_api.h
index 2a4a24e..b746243 100644
--- a/ppapi/thunk/ppb_flash_functions_api.h
+++ b/ppapi/thunk/ppb_flash_functions_api.h
@@ -5,25 +5,50 @@
 #ifndef PPAPI_THUNK_PPB_FLASH_FUNCTIONS_API_H_
 #define PPAPI_THUNK_PPB_FLASH_FUNCTIONS_API_H_
 
+#include <string>
+
+#include "ppapi/c/private/ppb_flash.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
 #include "ppapi/thunk/ppapi_thunk_export.h"
 
-struct PP_ArrayOutput;
+struct PP_BrowserFont_Trusted_Description;
 
 namespace ppapi {
 namespace thunk {
 
 // This class collects all of the Flash interface-related APIs into one place.
-// PPB_Flash_API is deprecated in favor of this (the new resource model uses
-// this API).
 class PPAPI_THUNK_EXPORT PPB_Flash_Functions_API {
  public:
   virtual ~PPB_Flash_Functions_API() {}
 
- // PPB_Flash.
- virtual int32_t EnumerateVideoCaptureDevices(
-     PP_Instance instance,
-     PP_Resource video_capture,
-     const PP_ArrayOutput& devices) = 0;
+  virtual PP_Var GetProxyForURL(PP_Instance instance,
+                                const std::string& url) = 0;
+  virtual void UpdateActivity(PP_Instance instance) = 0;
+  virtual PP_Bool SetCrashData(PP_Instance instance, PP_FlashCrashKey key,
+                               PP_Var value) = 0;
+  virtual double GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) = 0;
+  virtual PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) = 0;
+  virtual void SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) = 0;
+  virtual PP_Bool DrawGlyphs(
+      PP_Instance instance,
+      PP_Resource pp_image_data,
+      const PP_BrowserFont_Trusted_Description* font_desc,
+      uint32_t color,
+      const PP_Point* position,
+      const PP_Rect* clip,
+      const float transformation[3][3],
+      PP_Bool allow_subpixel_aa,
+      uint32_t glyph_count,
+      const uint16_t glyph_indices[],
+      const PP_Point glyph_advances[]) = 0;
+  virtual int32_t Navigate(PP_Instance instance,
+                           PP_Resource request_info,
+                           const char* target,
+                           PP_Bool from_user_action) = 0;
+  virtual PP_Bool IsRectTopmost(PP_Instance instance, const PP_Rect* rect) = 0;
+  virtual void InvokePrinting(PP_Instance instance) = 0;
+
+  static const SingletonResourceID kSingletonResourceID = FLASH_SINGLETON_ID;
 };
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_flash_print_thunk.cc b/ppapi/thunk/ppb_flash_print_thunk.cc
new file mode 100644
index 0000000..1316784
--- /dev/null
+++ b/ppapi/thunk/ppb_flash_print_thunk.cc
@@ -0,0 +1,34 @@
+// 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 "ppapi/c/pp_instance.h"
+#include "ppapi/c/private/ppb_flash_print.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_functions_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void InvokePrinting(PP_Instance instance) {
+  EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
+  if (enter.failed())
+    return;
+  enter.functions()->InvokePrinting(instance);
+}
+
+const PPB_Flash_Print_1_0 g_ppb_flash_print_1_0_thunk = {
+  &InvokePrinting,
+};
+
+}  // namespace
+
+const PPB_Flash_Print_1_0* GetPPB_Flash_Print_1_0_Thunk() {
+  return &g_ppb_flash_print_1_0_thunk;
+}
+
+}  // namespace thunk
+}  // namespace ppapi
diff --git a/ppapi/thunk/ppb_flash_thunk.cc b/ppapi/thunk/ppb_flash_thunk.cc
index b95a724..574df87 100644
--- a/ppapi/thunk/ppb_flash_thunk.cc
+++ b/ppapi/thunk/ppb_flash_thunk.cc
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "base/logging.h"
 #include "ppapi/c/pp_array_output.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/c/private/ppb_flash.h"
@@ -9,9 +10,9 @@
 #include "ppapi/shared_impl/proxy_lock.h"
 #include "ppapi/shared_impl/var.h"
 #include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_flash_api.h"
 #include "ppapi/thunk/ppb_flash_functions_api.h"
 #include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_video_capture_api.h"
 #include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
@@ -20,15 +21,15 @@
 namespace {
 
 void SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
   if (enter.failed())
     return;
-  enter.functions()->GetFlashAPI()->SetInstanceAlwaysOnTop(instance, on_top);
+  enter.functions()->SetInstanceAlwaysOnTop(instance, on_top);
 }
 
 PP_Bool DrawGlyphs(PP_Instance instance,
                    PP_Resource pp_image_data,
-                   const PP_FontDescription_Dev* font_desc,
+                   const PP_BrowserFont_Trusted_Description* font_desc,
                    uint32_t color,
                    const PP_Point* position,
                    const PP_Rect* clip,
@@ -37,19 +38,19 @@
                    uint32_t glyph_count,
                    const uint16_t glyph_indices[],
                    const PP_Point glyph_advances[]) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
   if (enter.failed())
     return PP_FALSE;
-  return enter.functions()->GetFlashAPI()->DrawGlyphs(
+  return enter.functions()->DrawGlyphs(
       instance, pp_image_data, font_desc, color, position, clip, transformation,
       allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances);
 }
 
 PP_Var GetProxyForURL(PP_Instance instance, const char* url) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
   if (enter.failed())
     return PP_MakeUndefined();
-  return enter.functions()->GetFlashAPI()->GetProxyForURL(instance, url);
+  return enter.functions()->GetProxyForURL(instance, url);
 }
 
 int32_t Navigate(PP_Resource request_id,
@@ -59,38 +60,36 @@
   // To work around this, use the PP_Instance from the resource.
   PP_Instance instance;
   {
-    thunk::EnterResource<thunk::PPB_URLRequestInfo_API> enter(request_id, true);
+    EnterResource<PPB_URLRequestInfo_API> enter(request_id, true);
     if (enter.failed())
       return PP_ERROR_BADRESOURCE;
     instance = enter.resource()->pp_instance();
   }
 
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
   if (enter.failed())
     return PP_ERROR_BADARGUMENT;
-  return enter.functions()->GetFlashAPI()->Navigate(instance, request_id,
-                                                    target, from_user_action);
+  return enter.functions()->Navigate(instance, request_id, target,
+                                     from_user_action);
 }
 
 void RunMessageLoop(PP_Instance instance) {
-  EnterInstance enter(instance);
-  if (enter.failed())
-    return;
-  enter.functions()->GetFlashAPI()->RunMessageLoop(instance);
+  // Deprecated.
+  NOTREACHED();
+  return;
 }
 
 void QuitMessageLoop(PP_Instance instance) {
-  EnterInstance enter(instance);
-  if (enter.failed())
-    return;
-  enter.functions()->GetFlashAPI()->QuitMessageLoop(instance);
+  // Deprecated.
+  NOTREACHED();
+  return;
 }
 
 double GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
   if (enter.failed())
     return 0.0;
-  return enter.functions()->GetFlashAPI()->GetLocalTimeZoneOffset(instance, t);
+  return enter.functions()->GetLocalTimeZoneOffset(instance, t);
 }
 
 PP_Var GetCommandLineArgs(PP_Module /* pp_module */) {
@@ -107,10 +106,10 @@
 }
 
 PP_Bool IsRectTopmost(PP_Instance instance, const PP_Rect* rect) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
   if (enter.failed())
     return PP_FALSE;
-  return enter.functions()->GetFlashAPI()->IsRectTopmost(instance, rect);
+  return enter.functions()->IsRectTopmost(instance, rect);
 }
 
 int32_t InvokePrinting(PP_Instance instance) {
@@ -119,119 +118,49 @@
 }
 
 void UpdateActivity(PP_Instance instance) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
   if (enter.failed())
     return;
-  enter.functions()->GetFlashAPI()->UpdateActivity(instance);
+  enter.functions()->UpdateActivity(instance);
 }
 
 PP_Var GetDeviceID(PP_Instance instance) {
-  EnterInstance enter(instance);
-  if (enter.failed())
-    return PP_MakeUndefined();
-  return enter.functions()->GetFlashAPI()->GetDeviceID(instance);
+  // Deprecated.
+  NOTREACHED();
+  return PP_MakeUndefined();
 }
 
 int32_t GetSettingInt(PP_Instance instance, PP_FlashSetting setting) {
-  EnterInstance enter(instance);
-  if (enter.failed())
-    return -1;
-  return enter.functions()->GetFlashAPI()->GetSettingInt(instance, setting);
+  // Deprecated.
+  NOTREACHED();
+  return -1;
 }
 
 PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
   if (enter.failed())
     return PP_MakeUndefined();
-  return enter.functions()->GetFlashAPI()->GetSetting(instance, setting);
+  return enter.functions()->GetSetting(instance, setting);
 }
 
 PP_Bool SetCrashData(PP_Instance instance,
                      PP_FlashCrashKey key,
                      PP_Var value) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
   if (enter.failed())
     return PP_FALSE;
-  return enter.functions()->GetFlashAPI()->SetCrashData(instance, key, value);
+  return enter.functions()->SetCrashData(instance, key, value);
 }
 
 int32_t EnumerateVideoCaptureDevices(PP_Instance instance,
                                      PP_Resource video_capture,
                                      PP_ArrayOutput devices) {
-  EnterInstance enter(instance);
-  if (enter.succeeded()) {
-    PPB_Flash_Functions_API* api =
-        enter.functions()->GetFlashFunctionsAPI(instance);
-    if (api) {
-      return api->EnumerateVideoCaptureDevices(instance, video_capture,
-                                               devices);
-    } else {
-      return PP_ERROR_NOINTERFACE;
-    }
-  }
-  return PP_ERROR_BADRESOURCE;
+  EnterResource<PPB_VideoCapture_API> enter(video_capture, true);
+  if (enter.failed())
+    return enter.retval();
+  return enter.object()->EnumerateDevicesSync(devices);
 }
 
-const PPB_Flash_12_0 g_ppb_flash_12_0_thunk = {
-  &SetInstanceAlwaysOnTop,
-  &DrawGlyphs,
-  &GetProxyForURL,
-  &Navigate,
-  &RunMessageLoop,
-  &QuitMessageLoop,
-  &GetLocalTimeZoneOffset,
-  &GetCommandLineArgs,
-  &PreLoadFontWin
-};
-
-const PPB_Flash_12_1 g_ppb_flash_12_1_thunk = {
-  &SetInstanceAlwaysOnTop,
-  &DrawGlyphs,
-  &GetProxyForURL,
-  &Navigate,
-  &RunMessageLoop,
-  &QuitMessageLoop,
-  &GetLocalTimeZoneOffset,
-  &GetCommandLineArgs,
-  &PreLoadFontWin,
-  &IsRectTopmost,
-  &InvokePrinting,
-  &UpdateActivity
-};
-
-const PPB_Flash_12_2 g_ppb_flash_12_2_thunk = {
-  &SetInstanceAlwaysOnTop,
-  &DrawGlyphs,
-  &GetProxyForURL,
-  &Navigate,
-  &RunMessageLoop,
-  &QuitMessageLoop,
-  &GetLocalTimeZoneOffset,
-  &GetCommandLineArgs,
-  &PreLoadFontWin,
-  &IsRectTopmost,
-  &InvokePrinting,
-  &UpdateActivity,
-  &GetDeviceID
-};
-
-const PPB_Flash_12_3 g_ppb_flash_12_3_thunk = {
-  &SetInstanceAlwaysOnTop,
-  &DrawGlyphs,
-  &GetProxyForURL,
-  &Navigate,
-  &RunMessageLoop,
-  &QuitMessageLoop,
-  &GetLocalTimeZoneOffset,
-  &GetCommandLineArgs,
-  &PreLoadFontWin,
-  &IsRectTopmost,
-  &InvokePrinting,
-  &UpdateActivity,
-  &GetDeviceID,
-  &GetSettingInt
-};
-
 const PPB_Flash_12_4 g_ppb_flash_12_4_thunk = {
   &SetInstanceAlwaysOnTop,
   &DrawGlyphs,
@@ -289,24 +218,23 @@
   &EnumerateVideoCaptureDevices
 };
 
+const PPB_Flash_13_0 g_ppb_flash_13_0_thunk = {
+  &SetInstanceAlwaysOnTop,
+  &DrawGlyphs,
+  &GetProxyForURL,
+  &Navigate,
+  &GetLocalTimeZoneOffset,
+  &GetCommandLineArgs,
+  &PreLoadFontWin,
+  &IsRectTopmost,
+  &UpdateActivity,
+  &GetSetting,
+  &SetCrashData,
+  &EnumerateVideoCaptureDevices
+};
+
 }  // namespace
 
-const PPB_Flash_12_0* GetPPB_Flash_12_0_Thunk() {
-  return &g_ppb_flash_12_0_thunk;
-}
-
-const PPB_Flash_12_1* GetPPB_Flash_12_1_Thunk() {
-  return &g_ppb_flash_12_1_thunk;
-}
-
-const PPB_Flash_12_2* GetPPB_Flash_12_2_Thunk() {
-  return &g_ppb_flash_12_2_thunk;
-}
-
-const PPB_Flash_12_3* GetPPB_Flash_12_3_Thunk() {
-  return &g_ppb_flash_12_3_thunk;
-}
-
 const PPB_Flash_12_4* GetPPB_Flash_12_4_Thunk() {
   return &g_ppb_flash_12_4_thunk;
 }
@@ -319,5 +247,9 @@
   return &g_ppb_flash_12_6_thunk;
 }
 
+const PPB_Flash_13_0* GetPPB_Flash_13_0_Thunk() {
+  return &g_ppb_flash_13_0_thunk;
+}
+
 }  // namespace thunk
 }  // namespace ppapi
diff --git a/ppapi/thunk/ppb_gamepad_api.h b/ppapi/thunk/ppb_gamepad_api.h
index ee7199a..88b317c 100644
--- a/ppapi/thunk/ppb_gamepad_api.h
+++ b/ppapi/thunk/ppb_gamepad_api.h
@@ -5,6 +5,7 @@
 #ifndef PPAPI_THUNK_PPB_GAMEPAD_API_H_
 #define PPAPI_THUNK_PPB_GAMEPAD_API_H_
 
+#include "ppapi/shared_impl/singleton_resource_id.h"
 #include "ppapi/thunk/ppapi_thunk_export.h"
 
 struct PP_GamepadsSampleData;
@@ -16,7 +17,10 @@
  public:
   virtual ~PPB_Gamepad_API() {}
 
-  virtual void Sample(PP_GamepadsSampleData* data) = 0;
+  virtual void Sample(PP_Instance instance,
+                      PP_GamepadsSampleData* data) = 0;
+
+  static const SingletonResourceID kSingletonResourceID = GAMEPAD_SINGLETON_ID;
 };
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_gamepad_thunk.cc b/ppapi/thunk/ppb_gamepad_thunk.cc
index 3aeedb5..34386c6 100644
--- a/ppapi/thunk/ppb_gamepad_thunk.cc
+++ b/ppapi/thunk/ppb_gamepad_thunk.cc
@@ -17,13 +17,10 @@
 namespace {
 
 void SampleGamepads(PP_Instance instance, PP_GamepadsSampleData* data) {
-  EnterInstance enter(instance);
+  EnterInstanceAPI<PPB_Gamepad_API> enter(instance);
   if (enter.succeeded()) {
-    PPB_Gamepad_API* api = enter.functions()->GetGamepadAPI(instance);
-    if (api) {
-      api->Sample(data);
-      return;
-    }
+    enter.functions()->Sample(instance, data);
+    return;
   }
   // Failure, zero out.
   memset(data, 0, sizeof(PP_GamepadsSampleData));
diff --git a/ppapi/thunk/ppb_graphics_2d_api.h b/ppapi/thunk/ppb_graphics_2d_api.h
index 6f14b93..e6357c3 100644
--- a/ppapi/thunk/ppb_graphics_2d_api.h
+++ b/ppapi/thunk/ppb_graphics_2d_api.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef PPAPI_THUNK_PPB_GRAPHICS_2D_API_H_
+#define PPAPI_THUNK_PPB_GRAPHICS_2D_API_H_
+
 #include "base/memory/ref_counted.h"
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_completion_callback.h"
@@ -9,6 +12,7 @@
 #include "ppapi/c/pp_rect.h"
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/c/pp_size.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
 
 namespace ppapi {
 
@@ -16,7 +20,7 @@
 
 namespace thunk {
 
-class PPB_Graphics2D_API {
+class PPAPI_THUNK_EXPORT PPB_Graphics2D_API {
  public:
   virtual ~PPB_Graphics2D_API() {}
 
@@ -41,7 +45,12 @@
   // destroyed if there was one.
   virtual int32_t Flush(scoped_refptr<TrackedCallback> callback,
                         PP_Resource* old_image_data) = 0;
+
+  // Test only
+  virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0;
 };
 
 }  // namespace thunk
 }  // namespace ppapi
+
+#endif  // PPAPI_THUNK_PPB_GRAPHICS_2D_API_H_
diff --git a/ppapi/thunk/ppb_graphics_3d_api.h b/ppapi/thunk/ppb_graphics_3d_api.h
index 76197b1..4c7dbe6 100644
--- a/ppapi/thunk/ppb_graphics_3d_api.h
+++ b/ppapi/thunk/ppb_graphics_3d_api.h
@@ -53,6 +53,8 @@
                                          GLenum type,
                                          GLenum access) = 0;
   virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) = 0;
+
+  virtual uint32_t InsertSyncPoint() = 0;
 };
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_image_data_api.h b/ppapi/thunk/ppb_image_data_api.h
index 3e46206..9546304 100644
--- a/ppapi/thunk/ppb_image_data_api.h
+++ b/ppapi/thunk/ppb_image_data_api.h
@@ -8,10 +8,6 @@
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/ppb_image_data.h"
 
-namespace skia {
-class PlatformCanvas;
-}
-
 class SkCanvas;
 
 namespace ppapi {
@@ -39,13 +35,18 @@
   // a platform-specific canvas (e.g., for use with platform-specific APIs).
   // Anything that relies on having a PlatformCanvas will not work for ImageDat
   // objects created from NaCl.
-  virtual skia::PlatformCanvas* GetPlatformCanvas() = 0;
+  virtual SkCanvas* GetPlatformCanvas() = 0;
 
   // Get the canvas that backs this ImageData, if there is one.
   // The canvas will be NULL:
   //   * If the image is not mapped.
   //   * Within untrusted code (which does not have skia).
   virtual SkCanvas* GetCanvas() = 0;
+
+  // Sets whether this image was used in a ReplaceContents call. If the
+  // current implementation supports image data recycling (only supported
+  // out-of-process then it will be marked for potential re-use.
+  virtual void SetUsedInReplaceContents() = 0;
 };
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h
index c5f26e6..9c7e1c1 100644
--- a/ppapi/thunk/ppb_instance_api.h
+++ b/ppapi/thunk/ppb_instance_api.h
@@ -7,20 +7,21 @@
 
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "ppapi/c/dev/ppb_console_dev.h"
 #include "ppapi/c/dev/ppb_text_input_dev.h"
 #include "ppapi/c/dev/ppb_url_util_dev.h"
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/pp_size.h"
-#include "ppapi/c/pp_time.h"
 #include "ppapi/c/ppb_audio_config.h"
+#include "ppapi/c/ppb_console.h"
 #include "ppapi/c/ppb_gamepad.h"
 #include "ppapi/c/ppb_instance.h"
 #include "ppapi/c/ppb_mouse_cursor.h"
 #include "ppapi/c/private/pp_content_decryptor.h"
 #include "ppapi/c/private/ppb_instance_private.h"
 #include "ppapi/shared_impl/api_id.h"
+#include "ppapi/shared_impl/resource.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
 
 // Windows headers interfere with this file.
 #ifdef PostMessage
@@ -32,15 +33,13 @@
 
 namespace ppapi {
 
+class Resource;
 class TrackedCallback;
 struct ViewData;
 
 namespace thunk {
 
 class PPB_Flash_API;
-class PPB_Flash_Clipboard_API;
-class PPB_Flash_Functions_API;
-class PPB_Gamepad_API;
 
 class PPB_Instance_API {
  public:
@@ -49,8 +48,11 @@
   virtual PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) = 0;
   virtual PP_Bool IsFullFrame(PP_Instance instance) = 0;
 
-  // Not an exposed PPAPI function, this returns the internal view data struct.
+  // Unexposed PPAPI functions for proxying.
+  // Returns the internal view data struct.
   virtual const ViewData* GetViewData(PP_Instance instance) = 0;
+  // Returns the flash fullscreen status.
+  virtual PP_Bool FlashIsFullscreen(PP_Instance instance) = 0;
 
   // InstancePrivate.
   virtual PP_Var GetWindowObject(PP_Instance instance) = 0;
@@ -68,10 +70,10 @@
 
   // Console.
   virtual void Log(PP_Instance instance,
-                   PP_LogLevel_Dev log_level,
+                   PP_LogLevel log_level,
                    PP_Var value) = 0;
   virtual void LogWithSource(PP_Instance instance,
-                             PP_LogLevel_Dev log_level,
+                             PP_LogLevel log_level,
                              PP_Var source,
                              PP_Var value) = 0;
 
@@ -82,26 +84,17 @@
   virtual void SelectedFindResultChanged(PP_Instance instance,
                                          int32_t index) = 0;
 
-  // Font.
-  virtual PP_Var GetFontFamilies(PP_Instance instance) = 0;
-
   // Fullscreen.
   virtual PP_Bool SetFullscreen(PP_Instance instance,
                                 PP_Bool fullscreen) = 0;
   virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) = 0;
 
-  // Flash (Deprecated for Flash_Functions).
-  virtual PPB_Flash_API* GetFlashAPI() = 0;
-  // Flash_Functions
-  virtual PPB_Flash_Functions_API* GetFlashFunctionsAPI(
-      PP_Instance instance) = 0;
-
-  // Flash_Clipboard.
-  virtual PPB_Flash_Clipboard_API* GetFlashClipboardAPI(
-      PP_Instance instance) = 0;
-
-  // Gamepad.
-  virtual PPB_Gamepad_API* GetGamepadAPI(PP_Instance instance) = 0;
+  // This is an implementation-only function which grabs an instance of a
+  // "singleton resource". These are used to implement instance interfaces
+  // (functions which are associated with the instance itself as opposed to a
+  // resource).
+  virtual Resource* GetSingletonResource(
+      PP_Instance instance, SingletonResourceID id) = 0;
 
   // InputEvent.
   virtual int32_t RequestInputEvents(PP_Instance instance,
@@ -110,8 +103,6 @@
                                               uint32_t event_classes) = 0;
   virtual void ClearInputEventRequest(PP_Instance instance,
                                       uint32_t event_classes) = 0;
-  virtual void ClosePendingUserGesture(PP_Instance instance,
-                                       PP_TimeTicks timestamp) = 0;
 
   // Messaging.
   virtual void PostMessage(PP_Instance instance, PP_Var message) = 0;
@@ -160,7 +151,7 @@
   virtual void KeyMessage(PP_Instance instance,
                           PP_Var key_system,
                           PP_Var session_id,
-                          PP_Resource message,
+                          PP_Var message,
                           PP_Var default_url) = 0;
   virtual void KeyError(PP_Instance instance,
                         PP_Var key_system,
diff --git a/ppapi/thunk/ppb_instance_private_thunk.cc b/ppapi/thunk/ppb_instance_private_thunk.cc
new file mode 100644
index 0000000..6205cd1
--- /dev/null
+++ b/ppapi/thunk/ppb_instance_private_thunk.cc
@@ -0,0 +1,56 @@
+// 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.
+
+// From private/ppb_instance_private.idl modified Thu Dec 27 10:36:33 2012.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_instance_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+struct PP_Var GetWindowObject(PP_Instance instance) {
+  EnterInstance enter(instance);
+  if (enter.failed())
+    return PP_MakeUndefined();
+  return enter.functions()->GetWindowObject(instance);
+}
+
+struct PP_Var GetOwnerElementObject(PP_Instance instance) {
+  EnterInstance enter(instance);
+  if (enter.failed())
+    return PP_MakeUndefined();
+  return enter.functions()->GetOwnerElementObject(instance);
+}
+
+struct PP_Var ExecuteScript(PP_Instance instance,
+                            struct PP_Var script,
+                            struct PP_Var* exception) {
+  EnterInstance enter(instance);
+  if (enter.failed())
+    return PP_MakeUndefined();
+  return enter.functions()->ExecuteScript(instance, script, exception);
+}
+
+const PPB_Instance_Private_0_1 g_ppb_instance_private_thunk_0_1 = {
+  &GetWindowObject,
+  &GetOwnerElementObject,
+  &ExecuteScript
+};
+
+}  // namespace
+
+const PPB_Instance_Private_0_1* GetPPB_Instance_Private_0_1_Thunk() {
+  return &g_ppb_instance_private_thunk_0_1;
+}
+
+}  // namespace thunk
+}  // namespace ppapi
diff --git a/ppapi/thunk/ppb_instance_thunk.cc b/ppapi/thunk/ppb_instance_thunk.cc
index d8117fa..cf4b782 100644
--- a/ppapi/thunk/ppb_instance_thunk.cc
+++ b/ppapi/thunk/ppb_instance_thunk.cc
@@ -2,35 +2,26 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "ppapi/thunk/thunk.h"
+// From ppb_instance.idl modified Thu Dec 27 10:36:33 2012.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_instance.h"
+#include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/ppb_instance_api.h"
 #include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
 namespace thunk {
 
 namespace {
 
-PP_Var GetWindowObject(PP_Instance instance) {
-  EnterInstance enter(instance);
-  if (enter.failed())
-    return PP_MakeUndefined();
-  return enter.functions()->GetWindowObject(instance);
-}
-
-PP_Var GetOwnerElementObject(PP_Instance instance) {
-  EnterInstance enter(instance);
-  if (enter.failed())
-    return PP_MakeUndefined();
-  return enter.functions()->GetOwnerElementObject(instance);
-}
-
-PP_Bool BindGraphics(PP_Instance instance, PP_Resource graphics_id) {
+PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) {
   EnterInstance enter(instance);
   if (enter.failed())
     return PP_FALSE;
-  return enter.functions()->BindGraphics(instance, graphics_id);
+  return enter.functions()->BindGraphics(instance, device);
 }
 
 PP_Bool IsFullFrame(PP_Instance instance) {
@@ -40,33 +31,15 @@
   return enter.functions()->IsFullFrame(instance);
 }
 
-PP_Var ExecuteScript(PP_Instance instance,
-                     PP_Var script,
-                     PP_Var* exception) {
-  EnterInstance enter(instance);
-  if (enter.failed())
-    return PP_MakeUndefined();
-  return enter.functions()->ExecuteScript(instance, script, exception);
-}
-
-const PPB_Instance g_ppb_instance_thunk = {
+const PPB_Instance_1_0 g_ppb_instance_thunk_1_0 = {
   &BindGraphics,
   &IsFullFrame
 };
 
-const PPB_Instance_Private g_ppb_instance_private_thunk = {
-  &GetWindowObject,
-  &GetOwnerElementObject,
-  &ExecuteScript
-};
-
 }  // namespace
 
 const PPB_Instance_1_0* GetPPB_Instance_1_0_Thunk() {
-  return &g_ppb_instance_thunk;
-}
-const PPB_Instance_Private_0_1* GetPPB_Instance_Private_0_1_Thunk() {
-  return &g_ppb_instance_private_thunk;
+  return &g_ppb_instance_thunk_1_0;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_messaging_thunk.cc b/ppapi/thunk/ppb_messaging_thunk.cc
index c3f464e..7f01c7c 100644
--- a/ppapi/thunk/ppb_messaging_thunk.cc
+++ b/ppapi/thunk/ppb_messaging_thunk.cc
@@ -2,30 +2,35 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+// From ppb_messaging.idl modified Mon Jan 14 14:09:38 2013.
+
+#include "ppapi/c/pp_errors.h"
 #include "ppapi/c/ppb_messaging.h"
+#include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/thunk.h"
 #include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
 namespace thunk {
 
 namespace {
 
-void PostMessage(PP_Instance instance, PP_Var message) {
+void PostMessage(PP_Instance instance, struct PP_Var message) {
   EnterInstance enter(instance);
   if (enter.succeeded())
     enter.functions()->PostMessage(instance, message);
 }
 
-const PPB_Messaging g_ppb_messaging_thunk = {
+const PPB_Messaging_1_0 g_ppb_messaging_thunk_1_0 = {
   &PostMessage
 };
 
 }  // namespace
 
 const PPB_Messaging_1_0* GetPPB_Messaging_1_0_Thunk() {
-  return &g_ppb_messaging_thunk;
+  return &g_ppb_messaging_thunk_1_0;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_mouse_cursor_thunk.cc b/ppapi/thunk/ppb_mouse_cursor_thunk.cc
index 1bf9f42..278e422 100644
--- a/ppapi/thunk/ppb_mouse_cursor_thunk.cc
+++ b/ppapi/thunk/ppb_mouse_cursor_thunk.cc
@@ -2,10 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+// From ppb_mouse_cursor.idl modified Mon Feb 25 16:10:34 2013.
+
+#include "ppapi/c/pp_errors.h"
 #include "ppapi/c/ppb_mouse_cursor.h"
-#include "ppapi/thunk/thunk.h"
+#include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
 namespace thunk {
@@ -13,23 +18,23 @@
 namespace {
 
 PP_Bool SetCursor(PP_Instance instance,
-                  PP_MouseCursor_Type type,
+                  enum PP_MouseCursor_Type type,
                   PP_Resource image,
-                  const PP_Point* hot_spot) {
+                  const struct PP_Point* hot_spot) {
   EnterInstance enter(instance);
   if (enter.failed())
     return PP_FALSE;
   return enter.functions()->SetCursor(instance, type, image, hot_spot);
 }
 
-const PPB_MouseCursor_1_0 g_ppb_mouse_cursor_thunk = {
+const PPB_MouseCursor_1_0 g_ppb_mousecursor_thunk_1_0 = {
   &SetCursor
 };
 
 }  // namespace
 
 const PPB_MouseCursor_1_0* GetPPB_MouseCursor_1_0_Thunk() {
-  return &g_ppb_mouse_cursor_thunk;
+  return &g_ppb_mousecursor_thunk_1_0;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_pdf_api.h b/ppapi/thunk/ppb_pdf_api.h
index b886929..93458ef 100644
--- a/ppapi/thunk/ppb_pdf_api.h
+++ b/ppapi/thunk/ppb_pdf_api.h
@@ -10,9 +10,35 @@
 namespace ppapi {
 namespace thunk {
 
-class PPB_PDFFont_API {
+class PPB_PDF_API {
  public:
-  virtual ~PPB_PDFFont_API() {}
+  virtual PP_Var GetLocalizedString(PP_Instance instance,
+                                    PP_ResourceString string_id) = 0;
+  virtual PP_Resource GetResourceImage(PP_Instance instance,
+                                       PP_ResourceImage image_id) = 0;
+  virtual void SearchString(PP_Instance instance,
+                            const unsigned short* input_string,
+                            const unsigned short* input_term,
+                            bool case_sensitive,
+                            PP_PrivateFindResult** results,
+                            int* count) = 0;
+  virtual void DidStartLoading(PP_Instance instance) = 0;
+  virtual void DidStopLoading(PP_Instance instance) = 0;
+  virtual void SetContentRestriction(PP_Instance instance,
+                                     int restrictions) = 0;
+  virtual void HistogramPDFPageCount(PP_Instance instance, int count) = 0;
+  virtual void UserMetricsRecordAction(PP_Instance instance,
+                                       const PP_Var& action) = 0;
+  virtual void HasUnsupportedFeature(PP_Instance instance) = 0;
+  virtual void SaveAs(PP_Instance instance) = 0;
+  virtual PP_Bool IsFeatureEnabled(PP_Instance instance,
+                                   PP_PDFFeature feature) = 0;
+  virtual void Print(PP_Instance instance) = 0;
+  virtual PP_Resource GetResourceImageForScale(PP_Instance instance,
+                                               PP_ResourceImage image_id,
+                                               int scale) = 0;
+
+  static const SingletonResourceID kSingletonResourceID = PDF_SINGLETON_ID;
 };
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_pdf_thunk.cc b/ppapi/thunk/ppb_pdf_thunk.cc
new file mode 100644
index 0000000..4216a2b
--- /dev/null
+++ b/ppapi/thunk/ppb_pdf_thunk.cc
@@ -0,0 +1,152 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/logging.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_pdf.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_pdf_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Var GetLocalizedString(PP_Instance instance, PP_ResourceString string_id) {
+  EnterInstanceAPI<PPB_PDF_API> enter(instance);
+  if (enter.failed())
+    return PP_MakeUndefined();
+  return enter.functions()->GetLocalizedString(instance, string_id);
+}
+
+PP_Resource GetResourceImage(PP_Instance instance,
+                             PP_ResourceImage image_id) {
+  EnterInstanceAPI<PPB_PDF_API> enter(instance);
+  if (enter.failed())
+    return 0;
+  return enter.functions()->GetResourceImage(instance, image_id);
+}
+
+PP_Resource GetFontFileWithFallback(
+    PP_Instance instance,
+    const PP_FontDescription_Dev* description,
+    PP_PrivateFontCharset charset) {
+  // Not implemented out-of-process.
+  NOTIMPLEMENTED();
+  return 0;
+}
+
+bool GetFontTableForPrivateFontFile(PP_Resource font_file,
+                                    uint32_t table,
+                                    void* output,
+                                    uint32_t* output_length) {
+  // Not implemented out-of-process.
+  NOTIMPLEMENTED();
+  return false;
+}
+
+void SearchString(PP_Instance instance,
+                  const unsigned short* string,
+                  const unsigned short* term,
+                  bool case_sensitive,
+                  PP_PrivateFindResult** results,
+                  int* count) {
+  EnterInstanceAPI<PPB_PDF_API> enter(instance);
+  if (enter.failed())
+    return;
+  enter.functions()->SearchString(instance, string, term, case_sensitive,
+                                  results, count);
+}
+
+void DidStartLoading(PP_Instance instance) {
+  EnterInstanceAPI<PPB_PDF_API> enter(instance);
+  if (enter.succeeded())
+    enter.functions()->DidStartLoading(instance);
+}
+
+void DidStopLoading(PP_Instance instance) {
+  EnterInstanceAPI<PPB_PDF_API> enter(instance);
+  if (enter.succeeded())
+    enter.functions()->DidStopLoading(instance);
+}
+
+void SetContentRestriction(PP_Instance instance, int restrictions) {
+  EnterInstanceAPI<PPB_PDF_API> enter(instance);
+  if (enter.succeeded())
+    enter.functions()->SetContentRestriction(instance, restrictions);
+}
+
+void HistogramPDFPageCount(PP_Instance instance, int count) {
+  EnterInstanceAPI<PPB_PDF_API> enter(instance);
+  if (enter.succeeded())
+    enter.functions()->HistogramPDFPageCount(instance, count);
+}
+
+void UserMetricsRecordAction(PP_Instance instance, PP_Var action) {
+  EnterInstanceAPI<PPB_PDF_API> enter(instance);
+  if (enter.succeeded())
+    enter.functions()->UserMetricsRecordAction(instance, action);
+}
+
+void HasUnsupportedFeature(PP_Instance instance) {
+  EnterInstanceAPI<PPB_PDF_API> enter(instance);
+  if (enter.succeeded())
+    enter.functions()->HasUnsupportedFeature(instance);
+}
+
+void SaveAs(PP_Instance instance) {
+  EnterInstanceAPI<PPB_PDF_API> enter(instance);
+  if (enter.succeeded())
+    enter.functions()->SaveAs(instance);
+}
+
+void Print(PP_Instance instance) {
+  EnterInstanceAPI<PPB_PDF_API> enter(instance);
+  if (enter.succeeded())
+    enter.functions()->Print(instance);
+}
+
+PP_Bool IsFeatureEnabled(PP_Instance instance, PP_PDFFeature feature) {
+  EnterInstanceAPI<PPB_PDF_API> enter(instance);
+  if (enter.failed())
+    return PP_FALSE;
+  return enter.functions()->IsFeatureEnabled(instance, feature);
+}
+
+PP_Resource GetResourceImageForScale(PP_Instance instance,
+                                     PP_ResourceImage image_id,
+                                     float scale) {
+  EnterInstanceAPI<PPB_PDF_API> enter(instance);
+  if (enter.failed())
+    return 0;
+  return enter.functions()->GetResourceImageForScale(instance, image_id, scale);
+}
+
+const PPB_PDF g_ppb_pdf_thunk = {
+  &GetLocalizedString,
+  &GetResourceImage,
+  &GetFontFileWithFallback,
+  &GetFontTableForPrivateFontFile,
+  &SearchString,
+  &DidStartLoading,
+  &DidStopLoading,
+  &SetContentRestriction,
+  &HistogramPDFPageCount,
+  &UserMetricsRecordAction,
+  &HasUnsupportedFeature,
+  &SaveAs,
+  &Print,
+  &IsFeatureEnabled,
+  &GetResourceImageForScale
+};
+
+}  // namespace
+
+const PPB_PDF* GetPPB_PDF_Thunk() {
+  return &g_ppb_pdf_thunk;
+}
+
+}  // namespace thunk
+}  // namespace ppapi
diff --git a/ppapi/thunk/ppb_resource_array_thunk.cc b/ppapi/thunk/ppb_resource_array_dev_thunk.cc
similarity index 68%
rename from ppapi/thunk/ppb_resource_array_thunk.cc
rename to ppapi/thunk/ppb_resource_array_dev_thunk.cc
index 03b7108..d9d5d48 100644
--- a/ppapi/thunk/ppb_resource_array_thunk.cc
+++ b/ppapi/thunk/ppb_resource_array_dev_thunk.cc
@@ -2,7 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+// From dev/ppb_resource_array_dev.idl modified Tue Dec  4 10:44:11 2012.
+
+#include "ppapi/c/dev/ppb_resource_array_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
 #include "ppapi/thunk/ppb_resource_array_api.h"
 #include "ppapi/thunk/resource_creation_api.h"
 #include "ppapi/thunk/thunk.h"
@@ -23,20 +29,24 @@
 
 PP_Bool IsResourceArray(PP_Resource resource) {
   EnterResource<PPB_ResourceArray_API> enter(resource, false);
-  return enter.succeeded() ? PP_TRUE : PP_FALSE;
+  return PP_FromBool(enter.succeeded());
 }
 
 uint32_t GetSize(PP_Resource resource_array) {
   EnterResource<PPB_ResourceArray_API> enter(resource_array, true);
-  return enter.succeeded() ? enter.object()->GetSize() : 0;
+  if (enter.failed())
+    return 0;
+  return enter.object()->GetSize();
 }
 
 PP_Resource GetAt(PP_Resource resource_array, uint32_t index) {
   EnterResource<PPB_ResourceArray_API> enter(resource_array, true);
-  return enter.succeeded() ? enter.object()->GetAt(index) : 0;
+  if (enter.failed())
+    return 0;
+  return enter.object()->GetAt(index);
 }
 
-const PPB_ResourceArray_Dev g_ppb_resource_array_thunk = {
+const PPB_ResourceArray_Dev_0_1 g_ppb_resourcearray_dev_thunk_0_1 = {
   &Create,
   &IsResourceArray,
   &GetSize,
@@ -46,7 +56,7 @@
 }  // namespace
 
 const PPB_ResourceArray_Dev_0_1* GetPPB_ResourceArray_Dev_0_1_Thunk() {
-  return &g_ppb_resource_array_thunk;
+  return &g_ppb_resourcearray_dev_thunk_0_1;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_tcp_socket_private_api.h b/ppapi/thunk/ppb_tcp_socket_private_api.h
index 1311a20..ebc8070 100644
--- a/ppapi/thunk/ppb_tcp_socket_private_api.h
+++ b/ppapi/thunk/ppb_tcp_socket_private_api.h
@@ -40,6 +40,9 @@
                         int32_t bytes_to_write,
                         scoped_refptr<TrackedCallback> callback) = 0;
   virtual void Disconnect() = 0;
+  virtual int32_t SetOption(PP_TCPSocketOption_Private name,
+                            const PP_Var& value,
+                            scoped_refptr<TrackedCallback> callback) = 0;
 };
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_tcp_socket_private_thunk.cc b/ppapi/thunk/ppb_tcp_socket_private_thunk.cc
index 425f5ad..928f073 100644
--- a/ppapi/thunk/ppb_tcp_socket_private_thunk.cc
+++ b/ppapi/thunk/ppb_tcp_socket_private_thunk.cc
@@ -121,6 +121,17 @@
     enter.object()->Disconnect();
 }
 
+int32_t SetOption(PP_Resource tcp_socket,
+                  PP_TCPSocketOption_Private name,
+                  PP_Var value,
+                  PP_CompletionCallback callback) {
+  EnterTCP enter(tcp_socket, callback, true);
+  if (enter.failed())
+    return enter.retval();
+  return enter.SetResult(
+      enter.object()->SetOption(name, value, enter.callback()));
+}
+
 const PPB_TCPSocket_Private_0_3 g_ppb_tcp_socket_thunk_0_3 = {
   &Create,
   &IsTCPSocket,
@@ -134,7 +145,7 @@
   &Disconnect
 };
 
-const PPB_TCPSocket_Private g_ppb_tcp_socket_thunk_0_4 = {
+const PPB_TCPSocket_Private_0_4 g_ppb_tcp_socket_thunk_0_4 = {
   &Create,
   &IsTCPSocket,
   &Connect,
@@ -149,6 +160,22 @@
   &Disconnect
 };
 
+const PPB_TCPSocket_Private_0_5 g_ppb_tcp_socket_thunk_0_5 = {
+  &Create,
+  &IsTCPSocket,
+  &Connect,
+  &ConnectWithNetAddress,
+  &GetLocalAddress,
+  &GetRemoteAddress,
+  &SSLHandshake,
+  &GetServerCertificate,
+  &AddChainBuildingCertificate,
+  &Read,
+  &Write,
+  &Disconnect,
+  &SetOption
+};
+
 }  // namespace
 
 const PPB_TCPSocket_Private_0_3* GetPPB_TCPSocket_Private_0_3_Thunk() {
@@ -159,5 +186,9 @@
   return &g_ppb_tcp_socket_thunk_0_4;
 }
 
+const PPB_TCPSocket_Private_0_5* GetPPB_TCPSocket_Private_0_5_Thunk() {
+  return &g_ppb_tcp_socket_thunk_0_5;
+}
+
 }  // namespace thunk
 }  // namespace ppapi
diff --git a/ppapi/thunk/ppb_truetype_font_api.h b/ppapi/thunk/ppb_truetype_font_api.h
new file mode 100644
index 0000000..9df6c98
--- /dev/null
+++ b/ppapi/thunk/ppb_truetype_font_api.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_THUNK_PPB_TRUETYPE_FONT_API_H_
+#define PPAPI_THUNK_PPB_TRUETYPE_FONT_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/dev/ppb_truetype_font_dev.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_TrueTypeFont_API {
+ public:
+  virtual ~PPB_TrueTypeFont_API() {}
+
+  virtual int32_t Describe(PP_TrueTypeFontDesc_Dev* desc,
+                           scoped_refptr<TrackedCallback> callback) = 0;
+  virtual int32_t GetTableTags(const PP_ArrayOutput& output,
+                               scoped_refptr<TrackedCallback> callback) = 0;
+  virtual int32_t GetTable(uint32_t table,
+                           int32_t offset,
+                           int32_t max_data_length,
+                           const PP_ArrayOutput& output,
+                           scoped_refptr<TrackedCallback> callback) = 0;
+};
+
+}  // namespace thunk
+}  // namespace ppapi
+
+#endif  // PPAPI_THUNK_PPB_TRUETYPE_FONT_API_H_
diff --git a/ppapi/thunk/ppb_truetype_font_singleton_api.h b/ppapi/thunk/ppb_truetype_font_singleton_api.h
new file mode 100644
index 0000000..514bab1
--- /dev/null
+++ b/ppapi/thunk/ppb_truetype_font_singleton_api.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_THUNK_PPB_TRUETYPE_FONT_SINGLETON_API_H_
+#define PPAPI_THUNK_PPB_TRUETYPE_FONT_SINGLETON_API_H_
+
+#include "ppapi/c/pp_array_output.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPB_TrueTypeFont_Singleton_API {
+ public:
+  virtual ~PPB_TrueTypeFont_Singleton_API() {}
+
+  virtual int32_t GetFontFamilies(
+      PP_Instance instance,
+      const PP_ArrayOutput& output,
+      const scoped_refptr<TrackedCallback>& callback) = 0;
+
+  static const SingletonResourceID kSingletonResourceID =
+      TRUETYPE_FONT_SINGLETON_ID;
+};
+
+}  // namespace thunk
+}  // namespace ppapi
+
+#endif  // PPAPI_THUNK_PPB_TRUETYPE_FONT_SINGLETON_API_H_
diff --git a/ppapi/thunk/ppb_truetype_font_thunk.cc b/ppapi/thunk/ppb_truetype_font_thunk.cc
new file mode 100644
index 0000000..b941c84
--- /dev/null
+++ b/ppapi/thunk/ppb_truetype_font_thunk.cc
@@ -0,0 +1,94 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/c/dev/ppb_truetype_font_dev.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_truetype_font_api.h"
+#include "ppapi/thunk/ppb_truetype_font_singleton_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+int32_t GetFontFamilies(PP_Instance instance,
+                        PP_ArrayOutput output,
+                        PP_CompletionCallback callback) {
+  EnterInstanceAPI<PPB_TrueTypeFont_Singleton_API> enter(instance, callback);
+  if (enter.failed())
+    return PP_ERROR_FAILED;
+  return enter.functions()->GetFontFamilies(instance, output, enter.callback());
+}
+
+PP_Resource Create(PP_Instance instance,
+                   const PP_TrueTypeFontDesc_Dev* desc) {
+  EnterResourceCreation enter(instance);
+  if (enter.failed())
+    return 0;
+  return enter.functions()->CreateTrueTypeFont(instance, *desc);
+}
+
+PP_Bool IsFont(PP_Resource resource) {
+  EnterResource<PPB_TrueTypeFont_API> enter(resource, false);
+  return PP_FromBool(enter.succeeded());
+}
+
+int32_t Describe(PP_Resource font,
+                 PP_TrueTypeFontDesc_Dev* desc,
+                 PP_CompletionCallback callback) {
+  EnterResource<PPB_TrueTypeFont_API> enter(font, callback, true);
+  if (enter.failed())
+    return enter.retval();
+  return enter.SetResult(enter.object()->Describe(desc, enter.callback()));
+}
+
+int32_t GetTableTags(PP_Resource font,
+                     PP_ArrayOutput output,
+                     PP_CompletionCallback callback) {
+  EnterResource<PPB_TrueTypeFont_API> enter(font, callback, true);
+  if (enter.failed())
+    return enter.retval();
+  return enter.SetResult(enter.object()->GetTableTags(output,
+                                                      enter.callback()));
+}
+
+int32_t GetTable(PP_Resource font,
+                 uint32_t table,
+                 int32_t offset,
+                 int32_t max_data_length,
+                 PP_ArrayOutput output,
+                 PP_CompletionCallback callback) {
+  EnterResource<PPB_TrueTypeFont_API> enter(font, callback, true);
+  if (enter.failed())
+    return enter.retval();
+  return enter.SetResult(enter.object()->GetTable(table,
+                                                  offset,
+                                                  max_data_length,
+                                                  output,
+                                                  enter.callback()));
+}
+
+const PPB_TrueTypeFont_Dev_0_1 g_ppb_truetypefont_thunk_0_1 = {
+  &GetFontFamilies,
+  &Create,
+  &IsFont,
+  &Describe,
+  &GetTableTags,
+  &GetTable
+};
+
+}  // namespace
+
+const PPB_TrueTypeFont_Dev_0_1* GetPPB_TrueTypeFont_Dev_0_1_Thunk() {
+  return &g_ppb_truetypefont_thunk_0_1;
+}
+
+}  // namespace thunk
+}  // namespace ppapi
diff --git a/ppapi/thunk/ppb_url_loader_api.h b/ppapi/thunk/ppb_url_loader_api.h
index ddcd20e..0fe8e04 100644
--- a/ppapi/thunk/ppb_url_loader_api.h
+++ b/ppapi/thunk/ppb_url_loader_api.h
@@ -13,6 +13,7 @@
 
 class TrackedCallback;
 struct URLRequestInfoData;
+struct URLResponseInfoData;
 
 namespace thunk {
 
@@ -47,6 +48,14 @@
   // Trusted API.
   virtual void GrantUniversalAccess() = 0;
   virtual void SetStatusCallback(PP_URLLoaderTrusted_StatusCallback cb) = 0;
+
+  // Internal function. This will fill in the given response info data and
+  // return true on sucesss. If the dowbload was to a file, there will be one
+  // plugin reference transferred to the caller. On failure, returns false.
+  //
+  // If body_as_file_ref is non-zero, this will transfer one plugin reference
+  // to that object to the caller.
+  virtual bool GetResponseInfoData(URLResponseInfoData* data) = 0;
 };
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_url_response_info_api.h b/ppapi/thunk/ppb_url_response_info_api.h
index e518a9a..b23847a 100644
--- a/ppapi/thunk/ppb_url_response_info_api.h
+++ b/ppapi/thunk/ppb_url_response_info_api.h
@@ -6,6 +6,7 @@
 #define PPAPI_THUNK_PPB_URL_RESPONSE_INFO_API_H_
 
 #include "ppapi/c/ppb_url_response_info.h"
+#include "ppapi/shared_impl/url_response_info_data.h"
 
 namespace ppapi {
 namespace thunk {
@@ -16,6 +17,11 @@
 
   virtual PP_Var GetProperty(PP_URLResponseProperty property) = 0;
   virtual PP_Resource GetBodyAsFileRef() = 0;
+
+  // Internal function to get the internal data. This passes one plugin
+  // reference to the caller for the file ref resource if body_as_file_ref is
+  // non-null (meaning we're downloading to a file).
+  virtual URLResponseInfoData GetData() = 0;
 };
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_var_array_thunk.cc b/ppapi/thunk/ppb_var_array_thunk.cc
new file mode 100644
index 0000000..7321424
--- /dev/null
+++ b/ppapi/thunk/ppb_var_array_thunk.cc
@@ -0,0 +1,74 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/c/dev/ppb_var_array_dev.h"
+#include "ppapi/shared_impl/array_var.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Var Create() {
+  ProxyAutoLock lock;
+
+  // Var tracker will hold a reference to this object.
+  ArrayVar* var = new ArrayVar();
+  return var->GetPPVar();
+}
+
+PP_Var Get(PP_Var array, uint32_t index) {
+  ProxyAutoLock lock;
+
+  ArrayVar* array_var = ArrayVar::FromPPVar(array);
+  if (!array_var)
+    return PP_MakeUndefined();
+  return array_var->Get(index);
+}
+
+PP_Bool Set(PP_Var array, uint32_t index, PP_Var value) {
+  ProxyAutoLock lock;
+
+  ArrayVar* array_var = ArrayVar::FromPPVar(array);
+  if (!array_var)
+    return PP_FALSE;
+  return array_var->Set(index, value);
+}
+
+uint32_t GetLength(PP_Var array) {
+  ProxyAutoLock lock;
+
+  ArrayVar* array_var = ArrayVar::FromPPVar(array);
+  if (!array_var)
+    return 0;
+  return array_var->GetLength();
+}
+
+PP_Bool SetLength(PP_Var array, uint32_t length) {
+  ProxyAutoLock lock;
+
+  ArrayVar* array_var = ArrayVar::FromPPVar(array);
+  if (!array_var)
+    return PP_FALSE;
+  return array_var->SetLength(length);
+}
+
+const PPB_VarArray_Dev_0_1 g_ppb_vararray_0_1_thunk = {
+  &Create,
+  &Get,
+  &Set,
+  &GetLength,
+  &SetLength
+};
+
+}  // namespace
+
+const PPB_VarArray_Dev_0_1* GetPPB_VarArray_Dev_0_1_Thunk() {
+  return &g_ppb_vararray_0_1_thunk;
+}
+
+}  // namespace thunk
+}  // namespace ppapi
diff --git a/ppapi/thunk/ppb_var_dictionary_thunk.cc b/ppapi/thunk/ppb_var_dictionary_thunk.cc
new file mode 100644
index 0000000..25a8224
--- /dev/null
+++ b/ppapi/thunk/ppb_var_dictionary_thunk.cc
@@ -0,0 +1,86 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/c/dev/ppb_var_dictionary_dev.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/dictionary_var.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Var Create() {
+  ProxyAutoLock lock;
+
+  // Var tracker will hold a reference to this object.
+  DictionaryVar* var = new DictionaryVar();
+  return var->GetPPVar();
+}
+
+PP_Var Get(PP_Var dict, PP_Var key) {
+  ProxyAutoLock lock;
+
+  DictionaryVar* dict_var = DictionaryVar::FromPPVar(dict);
+  if (!dict_var)
+    return PP_MakeUndefined();
+  return dict_var->Get(key);
+}
+
+PP_Bool Set(PP_Var dict, PP_Var key, PP_Var value) {
+  ProxyAutoLock lock;
+
+  DictionaryVar* dict_var = DictionaryVar::FromPPVar(dict);
+  if (!dict_var)
+    return PP_FALSE;
+
+  return dict_var->Set(key, value);
+}
+
+void Delete(PP_Var dict, PP_Var key) {
+  ProxyAutoLock lock;
+
+  DictionaryVar* dict_var = DictionaryVar::FromPPVar(dict);
+  if (dict_var)
+    dict_var->Delete(key);
+}
+
+PP_Bool HasKey(PP_Var dict, PP_Var key) {
+  ProxyAutoLock lock;
+
+  DictionaryVar* dict_var = DictionaryVar::FromPPVar(dict);
+  if (!dict_var)
+    return PP_FALSE;
+  return dict_var->HasKey(key);
+}
+
+PP_Var GetKeys(PP_Var dict) {
+  ProxyAutoLock lock;
+
+  DictionaryVar* dict_var = DictionaryVar::FromPPVar(dict);
+  if (!dict_var)
+    return PP_MakeNull();
+  return dict_var->GetKeys();
+}
+
+const PPB_VarDictionary_Dev_0_1 g_ppb_vardictionary_0_1_thunk = {
+  &Create,
+  &Get,
+  &Set,
+  &Delete,
+  &HasKey,
+  &GetKeys
+};
+
+}  // namespace
+
+const PPB_VarDictionary_Dev_0_1* GetPPB_VarDictionary_Dev_0_1_Thunk() {
+  return &g_ppb_vardictionary_0_1_thunk;
+}
+
+}  // namespace thunk
+}  // namespace ppapi
diff --git a/ppapi/thunk/ppb_video_capture_api.h b/ppapi/thunk/ppb_video_capture_api.h
index 117b495..baa7e00 100644
--- a/ppapi/thunk/ppb_video_capture_api.h
+++ b/ppapi/thunk/ppb_video_capture_api.h
@@ -10,10 +10,11 @@
 
 #include "base/memory/ref_counted.h"
 #include "ppapi/c/dev/ppb_video_capture_dev.h"
+#include "ppapi/c/pp_array_output.h"
+#include "ppapi/c/pp_resource.h"
 
 namespace ppapi {
 
-struct DeviceRefData;
 class TrackedCallback;
 
 namespace thunk {
@@ -22,8 +23,13 @@
  public:
   virtual ~PPB_VideoCapture_API() {}
 
-  virtual int32_t EnumerateDevices(PP_Resource* devices,
+  virtual int32_t EnumerateDevices0_2(
+      PP_Resource* devices,
+      scoped_refptr<TrackedCallback> callback) = 0;
+  virtual int32_t EnumerateDevices(const PP_ArrayOutput& output,
                                    scoped_refptr<TrackedCallback> callback) = 0;
+  virtual int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback,
+                                      void* user_data) = 0;
   virtual int32_t Open(const std::string& device_id,
                        const PP_VideoCaptureDeviceInfo_Dev& requested_info,
                        uint32_t buffer_count,
@@ -33,14 +39,9 @@
   virtual int32_t StopCapture() = 0;
   virtual void Close() = 0;
 
-  // For backward compatibility.
-  virtual int32_t StartCapture0_1(
-      const PP_VideoCaptureDeviceInfo_Dev& requested_info,
-      uint32_t buffer_count) = 0;
-
-  // This function is not exposed through the C API, but returns the internal
-  // data for easy proxying.
-  virtual const std::vector<DeviceRefData>& GetDeviceRefData() const = 0;
+  // This function is not exposed through the C API.  It is only used by flash
+  // to make synchronous device enumeration.
+  virtual int32_t EnumerateDevicesSync(const PP_ArrayOutput& devices) = 0;
 };
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_video_capture_thunk.cc b/ppapi/thunk/ppb_video_capture_thunk.cc
index 54cb68c..9d6571e 100644
--- a/ppapi/thunk/ppb_video_capture_thunk.cc
+++ b/ppapi/thunk/ppb_video_capture_thunk.cc
@@ -30,17 +30,37 @@
   return PP_FromBool(enter.succeeded());
 }
 
+int32_t EnumerateDevices0_2(PP_Resource video_capture,
+                            PP_Resource* devices,
+                            PP_CompletionCallback callback) {
+  EnterVideoCapture enter(video_capture, callback, true);
+  if (enter.failed())
+    return enter.retval();
+
+  return enter.SetResult(enter.object()->EnumerateDevices0_2(devices,
+                                                             enter.callback()));
+}
+
 int32_t EnumerateDevices(PP_Resource video_capture,
-                         PP_Resource* devices,
+                         PP_ArrayOutput output,
                          PP_CompletionCallback callback) {
   EnterVideoCapture enter(video_capture, callback, true);
   if (enter.failed())
     return enter.retval();
 
-  return enter.SetResult(enter.object()->EnumerateDevices(devices,
+  return enter.SetResult(enter.object()->EnumerateDevices(output,
                                                           enter.callback()));
 }
 
+int32_t MonitorDeviceChange(PP_Resource video_capture,
+                            PP_MonitorDeviceChangeCallback callback,
+                            void* user_data) {
+  EnterVideoCapture enter(video_capture, true);
+  if (enter.failed())
+    return enter.retval();
+  return enter.object()->MonitorDeviceChange(callback, user_data);
+}
+
 int32_t Open(PP_Resource video_capture,
              PP_Resource device_ref,
              const PP_VideoCaptureDeviceInfo_Dev* requested_info,
@@ -92,28 +112,22 @@
     enter.object()->Close();
 }
 
-int32_t StartCapture0_1(PP_Resource video_capture,
-                        const PP_VideoCaptureDeviceInfo_Dev* requested_info,
-                        uint32_t buffer_count) {
-  EnterVideoCapture enter(video_capture, true);
-  if (enter.failed())
-    return enter.retval();
-
-  return enter.object()->StartCapture0_1(*requested_info, buffer_count);
-}
-
-const PPB_VideoCapture_Dev_0_1 g_ppb_video_capture_0_1_thunk = {
-  &Create,
-  &IsVideoCapture,
-  &StartCapture0_1,
-  &ReuseBuffer,
-  &StopCapture
-};
-
 const PPB_VideoCapture_Dev_0_2 g_ppb_video_capture_0_2_thunk = {
   &Create,
   &IsVideoCapture,
+  &EnumerateDevices0_2,
+  &Open,
+  &StartCapture,
+  &ReuseBuffer,
+  &StopCapture,
+  &Close
+};
+
+const PPB_VideoCapture_Dev_0_3 g_ppb_video_capture_0_3_thunk = {
+  &Create,
+  &IsVideoCapture,
   &EnumerateDevices,
+  &MonitorDeviceChange,
   &Open,
   &StartCapture,
   &ReuseBuffer,
@@ -123,13 +137,13 @@
 
 }  // namespace
 
-const PPB_VideoCapture_Dev_0_1* GetPPB_VideoCapture_Dev_0_1_Thunk() {
-  return &g_ppb_video_capture_0_1_thunk;
-}
-
 const PPB_VideoCapture_Dev_0_2* GetPPB_VideoCapture_Dev_0_2_Thunk() {
   return &g_ppb_video_capture_0_2_thunk;
 }
 
+const PPB_VideoCapture_Dev_0_3* GetPPB_VideoCapture_Dev_0_3_Thunk() {
+  return &g_ppb_video_capture_0_3_thunk;
+}
+
 }  // namespace thunk
 }  // namespace ppapi
diff --git a/ppapi/thunk/ppb_view_api.h b/ppapi/thunk/ppb_view_api.h
index 50e256e..7561344 100644
--- a/ppapi/thunk/ppb_view_api.h
+++ b/ppapi/thunk/ppb_view_api.h
@@ -17,12 +17,16 @@
  public:
   virtual ~PPB_View_API() {}
 
-  // Returns the view data struct. We could have virtual functions here for
-  // each PPAPI function, but that would be more boilerplate for these simple
-  // getters so the logic is implemented in the thunk layer. If we start
-  // autogenerating the thunk layer and need this to be more regular, adding
-  // the API functions here should be fine.
+  // Returns the view data struct.
   virtual const ViewData& GetData() const = 0;
+
+  virtual PP_Bool GetRect(PP_Rect* viewport) const = 0;
+  virtual PP_Bool IsFullscreen() const = 0;
+  virtual PP_Bool IsVisible() const = 0;
+  virtual PP_Bool IsPageVisible() const = 0;
+  virtual PP_Bool GetClipRect(PP_Rect* clip) const = 0;
+  virtual float GetDeviceScale() const = 0;
+  virtual float GetCSSScale() const = 0;
 };
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_view_dev_thunk.cc b/ppapi/thunk/ppb_view_dev_thunk.cc
new file mode 100644
index 0000000..188c807
--- /dev/null
+++ b/ppapi/thunk/ppb_view_dev_thunk.cc
@@ -0,0 +1,47 @@
+// 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.
+
+// From dev/ppb_view_dev.idl modified Fri Feb  8 14:28:54 2013.
+
+#include "ppapi/c/dev/ppb_view_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_view_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+float GetDeviceScale(PP_Resource resource) {
+  EnterResource<PPB_View_API> enter(resource, true);
+  if (enter.failed())
+    return 0.0f;
+  return enter.object()->GetDeviceScale();
+}
+
+float GetCSSScale(PP_Resource resource) {
+  EnterResource<PPB_View_API> enter(resource, true);
+  if (enter.failed())
+    return 0.0f;
+  return enter.object()->GetCSSScale();
+}
+
+const PPB_View_Dev_0_1 g_ppb_view_dev_thunk_0_1 = {
+  &GetDeviceScale,
+  &GetCSSScale
+};
+
+}  // namespace
+
+const PPB_View_Dev_0_1* GetPPB_View_Dev_0_1_Thunk() {
+  return &g_ppb_view_dev_thunk_0_1;
+}
+
+}  // namespace thunk
+}  // namespace ppapi
diff --git a/ppapi/thunk/ppb_view_thunk.cc b/ppapi/thunk/ppb_view_thunk.cc
index c9a88b7..1aa16e6 100644
--- a/ppapi/thunk/ppb_view_thunk.cc
+++ b/ppapi/thunk/ppb_view_thunk.cc
@@ -2,11 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "ppapi/c/dev/ppb_view_dev.h"
+// From ppb_view.idl modified Fri Feb  8 14:28:54 2013.
+
+#include "ppapi/c/pp_errors.h"
 #include "ppapi/c/ppb_view.h"
-#include "ppapi/shared_impl/ppb_view_shared.h"
+#include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
 #include "ppapi/thunk/ppb_view_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
 #include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
@@ -14,91 +18,59 @@
 
 namespace {
 
-typedef EnterResource<PPB_View_API> EnterView;
-
-bool IsRectVisible(const PP_Rect& rect) {
-  return rect.size.width > 0 && rect.size.height > 0;
-}
-
 PP_Bool IsView(PP_Resource resource) {
-  EnterView enter(resource, false);
-  return enter.succeeded() ? PP_TRUE : PP_FALSE;
+  EnterResource<PPB_View_API> enter(resource, false);
+  return PP_FromBool(enter.succeeded());
 }
 
-PP_Bool GetRect(PP_Resource resource, PP_Rect* viewport) {
-  EnterView enter(resource, true);
-  if (enter.failed() || !viewport)
+PP_Bool GetRect(PP_Resource resource, struct PP_Rect* rect) {
+  EnterResource<PPB_View_API> enter(resource, true);
+  if (enter.failed())
     return PP_FALSE;
-  *viewport = enter.object()->GetData().rect;
-  return PP_TRUE;
+  return enter.object()->GetRect(rect);
 }
 
 PP_Bool IsFullscreen(PP_Resource resource) {
-  EnterView enter(resource, true);
+  EnterResource<PPB_View_API> enter(resource, true);
   if (enter.failed())
     return PP_FALSE;
-  return PP_FromBool(enter.object()->GetData().is_fullscreen);
+  return enter.object()->IsFullscreen();
 }
 
-PP_Bool IsUserVisible(PP_Resource resource) {
-  EnterView enter(resource, true);
+PP_Bool IsVisible(PP_Resource resource) {
+  EnterResource<PPB_View_API> enter(resource, true);
   if (enter.failed())
     return PP_FALSE;
-  return PP_FromBool(enter.object()->GetData().is_page_visible &&
-                     IsRectVisible(enter.object()->GetData().clip_rect));
+  return enter.object()->IsVisible();
 }
 
 PP_Bool IsPageVisible(PP_Resource resource) {
-  EnterView enter(resource, true);
+  EnterResource<PPB_View_API> enter(resource, true);
   if (enter.failed())
     return PP_FALSE;
-  return PP_FromBool(enter.object()->GetData().is_page_visible);
+  return enter.object()->IsPageVisible();
 }
 
-PP_Bool GetClipRect(PP_Resource resource, PP_Rect* clip) {
-  EnterView enter(resource, true);
-  if (enter.failed() || !clip)
+PP_Bool GetClipRect(PP_Resource resource, struct PP_Rect* clip) {
+  EnterResource<PPB_View_API> enter(resource, true);
+  if (enter.failed())
     return PP_FALSE;
-  *clip = enter.object()->GetData().clip_rect;
-  return PP_TRUE;
+  return enter.object()->GetClipRect(clip);
 }
 
-float GetDeviceScale(PP_Resource resource) {
-  EnterView enter(resource, true);
-  if (enter.failed())
-    return 0.0f;
-  return enter.object()->GetData().device_scale;
-}
-
-float GetCSSScale(PP_Resource resource) {
-  EnterView enter(resource, true);
-  if (enter.failed())
-    return 0.0f;
-  return enter.object()->GetData().css_scale;
-}
-
-const PPB_View g_ppb_view_thunk = {
+const PPB_View_1_0 g_ppb_view_thunk_1_0 = {
   &IsView,
   &GetRect,
   &IsFullscreen,
-  &IsUserVisible,
+  &IsVisible,
   &IsPageVisible,
   &GetClipRect
 };
 
-const PPB_View_Dev g_ppb_view_dev_thunk = {
-  &GetDeviceScale,
-  &GetCSSScale
-};
-
 }  // namespace
 
-const PPB_View* GetPPB_View_1_0_Thunk() {
-  return &g_ppb_view_thunk;
-}
-
-const PPB_View_Dev* GetPPB_View_Dev_0_1_Thunk() {
-  return &g_ppb_view_dev_thunk;
+const PPB_View_1_0* GetPPB_View_1_0_Thunk() {
+  return &g_ppb_view_thunk_1_0;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_websocket_thunk.cc b/ppapi/thunk/ppb_websocket_thunk.cc
index 3e127b8..527e143 100644
--- a/ppapi/thunk/ppb_websocket_thunk.cc
+++ b/ppapi/thunk/ppb_websocket_thunk.cc
@@ -2,21 +2,23 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+// From ppb_websocket.idl modified Thu Dec 27 10:36:33 2012.
+
+#include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_var.h"
+#include "ppapi/c/ppb_websocket.h"
 #include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/thunk/thunk.h"
 #include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
 #include "ppapi/thunk/ppb_websocket_api.h"
 #include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
 namespace thunk {
 
 namespace {
 
-typedef EnterResource<PPB_WebSocket_API> EnterWebSocket;
-
 PP_Resource Create(PP_Instance instance) {
   EnterResourceCreation enter(instance);
   if (enter.failed())
@@ -25,106 +27,108 @@
 }
 
 PP_Bool IsWebSocket(PP_Resource resource) {
-  EnterWebSocket enter(resource, false);
+  EnterResource<PPB_WebSocket_API> enter(resource, false);
   return PP_FromBool(enter.succeeded());
 }
 
-int32_t Connect(PP_Resource resource,
-                PP_Var url,
-                const PP_Var protocols[],
+int32_t Connect(PP_Resource web_socket,
+                struct PP_Var url,
+                const struct PP_Var protocols[],
                 uint32_t protocol_count,
-                PP_CompletionCallback callback) {
-  EnterWebSocket enter(resource, callback, false);
+                struct PP_CompletionCallback callback) {
+  EnterResource<PPB_WebSocket_API> enter(web_socket, callback, false);
   if (enter.failed())
     return enter.retval();
-  return enter.SetResult(enter.object()->Connect(
-      url, protocols, protocol_count, enter.callback()));
+  return enter.SetResult(enter.object()->Connect(url,
+                                                 protocols,
+                                                 protocol_count,
+                                                 enter.callback()));
 }
 
-int32_t Close(PP_Resource resource,
+int32_t Close(PP_Resource web_socket,
               uint16_t code,
-              PP_Var reason,
-              PP_CompletionCallback callback) {
-  EnterWebSocket enter(resource, callback, false);
+              struct PP_Var reason,
+              struct PP_CompletionCallback callback) {
+  EnterResource<PPB_WebSocket_API> enter(web_socket, callback, false);
   if (enter.failed())
     return enter.retval();
   return enter.SetResult(enter.object()->Close(code, reason, enter.callback()));
 }
 
-int32_t ReceiveMessage(PP_Resource resource,
-                       PP_Var* message,
-                       PP_CompletionCallback callback) {
-  EnterWebSocket enter(resource, callback, false);
+int32_t ReceiveMessage(PP_Resource web_socket,
+                       struct PP_Var* message,
+                       struct PP_CompletionCallback callback) {
+  EnterResource<PPB_WebSocket_API> enter(web_socket, callback, false);
   if (enter.failed())
     return enter.retval();
   return enter.SetResult(enter.object()->ReceiveMessage(message,
                                                         enter.callback()));
 }
 
-int32_t SendMessage(PP_Resource resource, PP_Var message) {
-  EnterWebSocket enter(resource, false);
+int32_t SendMessage(PP_Resource web_socket, struct PP_Var message) {
+  EnterResource<PPB_WebSocket_API> enter(web_socket, false);
   if (enter.failed())
     return enter.retval();
   return enter.object()->SendMessage(message);
 }
 
-uint64_t GetBufferedAmount(PP_Resource resource) {
-  EnterWebSocket enter(resource, false);
+uint64_t GetBufferedAmount(PP_Resource web_socket) {
+  EnterResource<PPB_WebSocket_API> enter(web_socket, false);
   if (enter.failed())
     return 0;
   return enter.object()->GetBufferedAmount();
 }
 
-uint16_t GetCloseCode(PP_Resource resource) {
-  EnterWebSocket enter(resource, false);
+uint16_t GetCloseCode(PP_Resource web_socket) {
+  EnterResource<PPB_WebSocket_API> enter(web_socket, false);
   if (enter.failed())
     return 0;
   return enter.object()->GetCloseCode();
 }
 
-PP_Var GetCloseReason(PP_Resource resource) {
-  EnterWebSocket enter(resource, false);
+struct PP_Var GetCloseReason(PP_Resource web_socket) {
+  EnterResource<PPB_WebSocket_API> enter(web_socket, false);
   if (enter.failed())
     return PP_MakeUndefined();
   return enter.object()->GetCloseReason();
 }
 
-PP_Bool GetCloseWasClean(PP_Resource resource) {
-  EnterWebSocket enter(resource, false);
+PP_Bool GetCloseWasClean(PP_Resource web_socket) {
+  EnterResource<PPB_WebSocket_API> enter(web_socket, false);
   if (enter.failed())
     return PP_FALSE;
   return enter.object()->GetCloseWasClean();
 }
 
-PP_Var GetExtensions(PP_Resource resource) {
-  EnterWebSocket enter(resource, false);
+struct PP_Var GetExtensions(PP_Resource web_socket) {
+  EnterResource<PPB_WebSocket_API> enter(web_socket, false);
   if (enter.failed())
     return PP_MakeUndefined();
   return enter.object()->GetExtensions();
 }
 
-PP_Var GetProtocol(PP_Resource resource) {
-  EnterWebSocket enter(resource, false);
+struct PP_Var GetProtocol(PP_Resource web_socket) {
+  EnterResource<PPB_WebSocket_API> enter(web_socket, false);
   if (enter.failed())
     return PP_MakeUndefined();
   return enter.object()->GetProtocol();
 }
 
-PP_WebSocketReadyState GetReadyState(PP_Resource resource) {
-  EnterWebSocket enter(resource, false);
+PP_WebSocketReadyState GetReadyState(PP_Resource web_socket) {
+  EnterResource<PPB_WebSocket_API> enter(web_socket, false);
   if (enter.failed())
     return PP_WEBSOCKETREADYSTATE_INVALID;
   return enter.object()->GetReadyState();
 }
 
-PP_Var GetURL(PP_Resource resource) {
-  EnterWebSocket enter(resource, false);
+struct PP_Var GetURL(PP_Resource web_socket) {
+  EnterResource<PPB_WebSocket_API> enter(web_socket, false);
   if (enter.failed())
     return PP_MakeUndefined();
   return enter.object()->GetURL();
 }
 
-const PPB_WebSocket_1_0 g_ppb_websocket_1_0_thunk = {
+const PPB_WebSocket_1_0 g_ppb_websocket_thunk_1_0 = {
   &Create,
   &IsWebSocket,
   &Connect,
@@ -144,7 +148,7 @@
 }  // namespace
 
 const PPB_WebSocket_1_0* GetPPB_WebSocket_1_0_Thunk() {
-  return &g_ppb_websocket_1_0_thunk;
+  return &g_ppb_websocket_thunk_1_0;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/ppb_widget_thunk.cc b/ppapi/thunk/ppb_widget_dev_thunk.cc
similarity index 63%
rename from ppapi/thunk/ppb_widget_thunk.cc
rename to ppapi/thunk/ppb_widget_dev_thunk.cc
index f00b48b..c3cf34b 100644
--- a/ppapi/thunk/ppb_widget_thunk.cc
+++ b/ppapi/thunk/ppb_widget_dev_thunk.cc
@@ -2,10 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "ppapi/thunk/thunk.h"
+// From dev/ppb_widget_dev.idl modified Wed Nov 28 12:14:51 2012.
+
+#include "ppapi/c/dev/ppb_widget_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
 #include "ppapi/thunk/ppb_widget_api.h"
 #include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
 
 namespace ppapi {
 namespace thunk {
@@ -17,28 +23,30 @@
   return PP_FromBool(enter.succeeded());
 }
 
-PP_Bool Paint(PP_Resource widget, const PP_Rect* rect, PP_Resource image_id) {
+PP_Bool Paint(PP_Resource widget,
+              const struct PP_Rect* rect,
+              PP_Resource image) {
   EnterResource<PPB_Widget_API> enter(widget, false);
   if (enter.failed())
     return PP_FALSE;
-  return enter.object()->Paint(rect, image_id);
+  return enter.object()->Paint(rect, image);
 }
 
-PP_Bool HandleEvent(PP_Resource widget, PP_Resource pp_input_event) {
+PP_Bool HandleEvent(PP_Resource widget, PP_Resource input_event) {
   EnterResource<PPB_Widget_API> enter(widget, false);
   if (enter.failed())
     return PP_FALSE;
-  return enter.object()->HandleEvent(pp_input_event);
+  return enter.object()->HandleEvent(input_event);
 }
 
-PP_Bool GetLocation(PP_Resource widget, PP_Rect* location) {
+PP_Bool GetLocation(PP_Resource widget, struct PP_Rect* location) {
   EnterResource<PPB_Widget_API> enter(widget, false);
   if (enter.failed())
     return PP_FALSE;
   return enter.object()->GetLocation(location);
 }
 
-void SetLocation(PP_Resource widget, const PP_Rect* location) {
+void SetLocation(PP_Resource widget, const struct PP_Rect* location) {
   EnterResource<PPB_Widget_API> enter(widget, false);
   if (enter.succeeded())
     enter.object()->SetLocation(location);
@@ -50,15 +58,15 @@
     enter.object()->SetScale(scale);
 }
 
-const PPB_Widget_Dev_0_3 g_ppb_widget_thunk_0_3 = {
+const PPB_Widget_Dev_0_3 g_ppb_widget_dev_thunk_0_3 = {
   &IsWidget,
   &Paint,
   &HandleEvent,
   &GetLocation,
-  &SetLocation,
+  &SetLocation
 };
 
-const PPB_Widget_Dev_0_4 g_ppb_widget_thunk_0_4 = {
+const PPB_Widget_Dev_0_4 g_ppb_widget_dev_thunk_0_4 = {
   &IsWidget,
   &Paint,
   &HandleEvent,
@@ -70,11 +78,11 @@
 }  // namespace
 
 const PPB_Widget_Dev_0_3* GetPPB_Widget_Dev_0_3_Thunk() {
-  return &g_ppb_widget_thunk_0_3;
+  return &g_ppb_widget_dev_thunk_0_3;
 }
 
 const PPB_Widget_Dev_0_4* GetPPB_Widget_Dev_0_4_Thunk() {
-  return &g_ppb_widget_thunk_0_4;
+  return &g_ppb_widget_dev_thunk_0_4;
 }
 
 }  // namespace thunk
diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h
index 4c20559..377424a 100644
--- a/ppapi/thunk/resource_creation_api.h
+++ b/ppapi/thunk/resource_creation_api.h
@@ -17,6 +17,7 @@
 #include "ppapi/c/ppb_input_event.h"
 #include "ppapi/c/ppb_websocket.h"
 #include "ppapi/c/dev/pp_video_dev.h"
+#include "ppapi/c/dev/ppb_truetype_font_dev.h"
 #include "ppapi/c/private/pp_private_font_charset.h"
 #include "ppapi/c/private/ppb_network_monitor_private.h"
 #include "ppapi/shared_impl/api_id.h"
@@ -29,6 +30,7 @@
 namespace ppapi {
 
 struct URLRequestInfoData;
+struct URLResponseInfoData;
 
 namespace thunk {
 
@@ -79,10 +81,22 @@
   virtual PP_Resource CreateResourceArray(PP_Instance instance,
                                           const PP_Resource elements[],
                                           uint32_t size) = 0;
+  virtual PP_Resource CreateTrueTypeFont(
+      PP_Instance instance,
+      const PP_TrueTypeFontDesc_Dev& desc) = 0;
   virtual PP_Resource CreateURLLoader(PP_Instance instance) = 0;
   virtual PP_Resource CreateURLRequestInfo(
       PP_Instance instance,
       const URLRequestInfoData& data) = 0;
+
+  // Passes a reference to the file_ref_resource, which is a process-local
+  // resource corresponding to the body_as_file_ref host resource in |data|,
+  // if there is one.
+  virtual PP_Resource CreateURLResponseInfo(
+      PP_Instance instance,
+      const URLResponseInfoData& data,
+      PP_Resource file_ref_resource) = 0;
+
   virtual PP_Resource CreateWheelInputEvent(
       PP_Instance instance,
       PP_TimeTicks time_stamp,
@@ -99,14 +113,9 @@
   virtual PP_Resource CreateAudioConfig(PP_Instance instance,
                                         PP_AudioSampleRate sample_rate,
                                         uint32_t sample_frame_count) = 0;
-  virtual PP_Resource CreateImageData(PP_Instance instance,
-                                      PP_ImageDataFormat format,
-                                      const PP_Size& size,
-                                      PP_Bool init_to_zero) = 0;
-  virtual PP_Resource CreateImageDataNaCl(PP_Instance instance,
-                                          PP_ImageDataFormat format,
-                                          const PP_Size& size,
-                                          PP_Bool init_to_zero) = 0;
+  virtual PP_Resource CreateFileChooser(PP_Instance instance,
+                                        PP_FileChooserMode_Dev mode,
+                                        const char* accept_types) = 0;
   virtual PP_Resource CreateGraphics2D(PP_Instance instance,
                                        const PP_Size& size,
                                        PP_Bool is_always_opaque) = 0;
@@ -117,10 +126,19 @@
                                           PP_Resource share_context,
                                           const int32_t* attrib_list) = 0;
   virtual PP_Resource CreateHostResolverPrivate(PP_Instance instance) = 0;
+  virtual PP_Resource CreateImageData(PP_Instance instance,
+                                      PP_ImageDataFormat format,
+                                      const PP_Size& size,
+                                      PP_Bool init_to_zero) = 0;
+  virtual PP_Resource CreateImageDataNaCl(PP_Instance instance,
+                                          PP_ImageDataFormat format,
+                                          const PP_Size& size,
+                                          PP_Bool init_to_zero) = 0;
   virtual PP_Resource CreateNetworkMonitor(
       PP_Instance instance,
       PPB_NetworkMonitor_Callback callback,
       void* user_data) = 0;
+  virtual PP_Resource CreatePrinting(PP_Instance instance) = 0;
   virtual PP_Resource CreateTCPServerSocketPrivate(PP_Instance instance) = 0;
   virtual PP_Resource CreateTCPSocketPrivate(PP_Instance instace) = 0;
   virtual PP_Resource CreateUDPSocketPrivate(PP_Instance instace) = 0;
@@ -133,20 +151,17 @@
       PP_Instance instance,
       const PP_BrowserFont_Trusted_Description* description) = 0;
   virtual PP_Resource CreateBuffer(PP_Instance instance, uint32_t size) = 0;
-  virtual PP_Resource CreateDirectoryReader(PP_Resource directory_ref) = 0;
-  virtual PP_Resource CreateFileChooser(
+  virtual PP_Resource CreateDirectoryReader(
       PP_Instance instance,
-      PP_FileChooserMode_Dev mode,
-      const char* accept_types) = 0;
+      PP_Resource directory_ref) = 0;
   virtual PP_Resource CreateFlashDeviceID(PP_Instance instance) = 0;
   virtual PP_Resource CreateFlashFontFile(
       PP_Instance instance,
-      const PP_FontDescription_Dev* description,
+      const PP_BrowserFont_Trusted_Description* description,
       PP_PrivateFontCharset charset) = 0;
   virtual PP_Resource CreateFlashMenu(PP_Instance instance,
                                       const PP_Flash_Menu* menu_data) = 0;
   virtual PP_Resource CreateFlashMessageLoop(PP_Instance instance) = 0;
-  virtual PP_Resource CreatePrinting(PP_Instance instance) = 0;
   virtual PP_Resource CreateScrollbar(PP_Instance instance,
                                       PP_Bool vertical) = 0;
   virtual PP_Resource CreateTalk(PP_Instance instance) = 0;
diff --git a/ppapi/thunk/thunk.h b/ppapi/thunk/thunk.h
index 3fbe665..2b074ff 100644
--- a/ppapi/thunk/thunk.h
+++ b/ppapi/thunk/thunk.h
@@ -5,20 +5,9 @@
 #ifndef PPAPI_THUNK_THUNK_H_
 #define PPAPI_THUNK_THUNK_H_
 
-#include "ppapi/c/ppb_graphics_3d.h"
-#include "ppapi/c/private/ppb_flash_clipboard.h"
-#include "ppapi/c/private/ppb_flash_menu.h"
-#include "ppapi/c/private/ppb_flash_message_loop.h"
-#include "ppapi/c/private/ppb_flash_fullscreen.h"
-#include "ppapi/c/private/ppb_host_resolver_private.h"
 #include "ppapi/c/private/ppb_instance_private.h"
-#include "ppapi/c/private/ppb_tcp_server_socket_private.h"
-#include "ppapi/c/private/ppb_tcp_socket_private.h"
-#include "ppapi/c/private/ppb_udp_socket_private.h"
 #include "ppapi/c/trusted/ppb_audio_trusted.h"
-#include "ppapi/c/trusted/ppb_broker_trusted.h"
 #include "ppapi/c/trusted/ppb_buffer_trusted.h"
-#include "ppapi/c/trusted/ppb_file_chooser_trusted.h"
 #include "ppapi/c/trusted/ppb_graphics_3d_trusted.h"
 #include "ppapi/c/trusted/ppb_image_data_trusted.h"
 #include "ppapi/c/trusted/ppb_url_loader_trusted.h"
@@ -53,29 +42,16 @@
 // yet been converted to the new system). Otherwise, add the declaration to
 // the appropriate interfaces_*.h file.
 PPAPI_THUNK_EXPORT const PPB_AudioTrusted_0_6* GetPPB_AudioTrusted_0_6_Thunk();
-PPAPI_THUNK_EXPORT const PPB_BrokerTrusted_0_2* GetPPB_Broker_0_2_Thunk();
 PPAPI_THUNK_EXPORT const PPB_BufferTrusted_0_1*
     GetPPB_BufferTrusted_0_1_Thunk();
-PPAPI_THUNK_EXPORT const PPB_FileChooserTrusted_0_5*
-    GetPPB_FileChooser_Trusted_0_5_Thunk();
 PPAPI_THUNK_EXPORT const PPB_Graphics3DTrusted_1_0*
     GetPPB_Graphics3DTrusted_1_0_Thunk();
-PPAPI_THUNK_EXPORT const PPB_HostResolver_Private_0_1*
-    GetPPB_HostResolver_Private_0_1_Thunk();
 PPAPI_THUNK_EXPORT const PPB_ImageDataTrusted_0_4*
     GetPPB_ImageDataTrusted_0_4_Thunk();
 PPAPI_THUNK_EXPORT const PPB_Instance_Private_0_1*
     GetPPB_Instance_Private_0_1_Thunk();
-PPAPI_THUNK_EXPORT const PPB_TCPServerSocket_Private_0_1*
-    GetPPB_TCPServerSocket_Private_0_1_Thunk();
-PPAPI_THUNK_EXPORT const PPB_TCPSocket_Private_0_3*
-    GetPPB_TCPSocket_Private_0_3_Thunk();
-PPAPI_THUNK_EXPORT const PPB_UDPSocket_Private_0_2*
-    GetPPB_UDPSocket_Private_0_2_Thunk();
 PPAPI_THUNK_EXPORT const PPB_URLLoaderTrusted_0_3*
     GetPPB_URLLoaderTrusted_0_3_Thunk();
-PPAPI_THUNK_EXPORT const PPB_WebSocket_1_0*
-    GetPPB_WebSocket_1_0_Thunk();
 
 }  // namespace thunk
 }  // namespace ppapi
diff --git a/ppapi/utility/threading/simple_thread.cc b/ppapi/utility/threading/simple_thread.cc
index f17c237..02bf49b 100644
--- a/ppapi/utility/threading/simple_thread.cc
+++ b/ppapi/utility/threading/simple_thread.cc
@@ -12,8 +12,16 @@
 
 namespace {
 
+// Use 2MB default stack size for Native Client, otherwise use system default.
+#if defined(__native_client__)
+const size_t kDefaultStackSize = 2 * 1024 * 1024;
+#else
+const size_t kDefaultStackSize = 0;
+#endif
+
+
 struct ThreadData {
-  MessageLoop_Dev message_loop;
+  MessageLoop message_loop;
 
   SimpleThread::ThreadFunc func;
   void* user_data;
@@ -41,6 +49,15 @@
 SimpleThread::SimpleThread(const InstanceHandle& instance)
     : instance_(instance),
       message_loop_(instance),
+      stacksize_(kDefaultStackSize),
+      thread_(0) {
+}
+
+SimpleThread::SimpleThread(const InstanceHandle& instance,
+                           size_t stacksize)
+    : instance_(instance),
+      message_loop_(instance),
+      stacksize_(stacksize),
       thread_(0) {
 }
 
@@ -82,10 +99,15 @@
   data->user_data = user_data;
 
 #ifdef WIN32
-  thread_ = CreateThread(NULL, 0, &RunThread, data, 0, NULL);
+  thread_ = CreateThread(NULL, stacksize_, &RunThread, data, 0, NULL);
   if (!thread_) {
 #else
-  if (pthread_create(&thread_, NULL, &RunThread, data) != 0) {
+  pthread_attr_t attr;
+  pthread_attr_init(&attr);
+  int setval = 0;
+  if (stacksize_ > 0)
+    setval = pthread_attr_setstacksize(&attr, stacksize_);
+  if (setval != 0 || pthread_create(&thread_, &attr, &RunThread, data) != 0) {
 #endif
     delete data;
     return false;
diff --git a/ppapi/utility/threading/simple_thread.h b/ppapi/utility/threading/simple_thread.h
index d60a43d..5410cf8 100644
--- a/ppapi/utility/threading/simple_thread.h
+++ b/ppapi/utility/threading/simple_thread.h
@@ -11,8 +11,8 @@
 #include <pthread.h>
 #endif
 
-#include "ppapi/cpp/dev/message_loop_dev.h"
 #include "ppapi/cpp/instance_handle.h"
+#include "ppapi/cpp/message_loop.h"
 
 namespace pp {
 
@@ -26,9 +26,10 @@
   typedef pthread_t ThreadHandle;
 #endif
 
-  typedef void (*ThreadFunc)(MessageLoop_Dev&, void* user_data);
+  typedef void (*ThreadFunc)(MessageLoop&, void* user_data);
 
   explicit SimpleThread(const InstanceHandle& instance);
+  explicit SimpleThread(const InstanceHandle& instance, size_t stacksize);
   ~SimpleThread();
 
   // Starts a thread and runs a message loop in it. If you need control over
@@ -46,17 +47,18 @@
   // is NULL, this acts the same as Start().
   bool StartWithFunction(ThreadFunc func, void* user_data);
 
-  MessageLoop_Dev& message_loop() { return message_loop_; }
+  MessageLoop& message_loop() { return message_loop_; }
   ThreadHandle thread() const { return thread_; }
 
  private:
   InstanceHandle instance_;
-  MessageLoop_Dev message_loop_;
-
+  MessageLoop message_loop_;
+  const size_t stacksize_;
   ThreadHandle thread_;
 
   // Disallow (not implemented).
   SimpleThread(const SimpleThread&);
+  SimpleThread(const SimpleThread&, size_t stacksize);
   SimpleThread& operator=(const SimpleThread&);
 };