Move the rest of the core files in chrome\browser to content\browser.

TBR=avi
Review URL: http://codereview.chromium.org/6538111

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75711 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/child_process_launcher.h b/chrome/browser/child_process_launcher.h
index f05d3b0..185595f 100644
--- a/chrome/browser/child_process_launcher.h
+++ b/chrome/browser/child_process_launcher.h
@@ -9,5 +9,4 @@
 // TODO(jam): remove this file when all files have been converted.
 #include "content/browser/child_process_launcher.h"
 
-
 #endif  // CHROME_BROWSER_CHILD_PROCESS_LAUNCHER_H_
diff --git a/chrome/browser/gpu_blacklist.h b/chrome/browser/gpu_blacklist.h
index 4fdf13a..f2335d33 100644
--- a/chrome/browser/gpu_blacklist.h
+++ b/chrome/browser/gpu_blacklist.h
@@ -6,223 +6,8 @@
 #define CHROME_BROWSER_GPU_BLACKLIST_H_
 #pragma once
 
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "chrome/common/gpu_feature_flags.h"
-
-class DictionaryValue;
-class GPUInfo;
-class Version;
-
-class GpuBlacklist {
- public:
-  enum OsType {
-    kOsLinux,
-    kOsMacosx,
-    kOsWin,
-    kOsAny,
-    kOsUnknown
-  };
-
-  GpuBlacklist();
-  ~GpuBlacklist();
-
-  // Loads blacklist information from a json file.
-  // current_os_only==true indicates all blacklist entries that don't belong to
-  // the current OS are discarded; current_os_only==false should only be used
-  // for testing purpose.
-  // If failed, the current GpuBlacklist is un-touched.
-  bool LoadGpuBlacklist(const std::string& json_context,
-                        bool current_os_only);
-
-  // Collects system information and combines them with gpu_info and blacklist
-  // information to determine gpu feature flags.
-  // If os is kOsAny, use the current OS; if os_version is null, use the
-  // current OS version.
-  GpuFeatureFlags DetermineGpuFeatureFlags(OsType os,
-                                           Version* os_version,
-                                           const GPUInfo& gpu_info);
-
-  // Collects the entries that set the "feature" flag from the last
-  // DetermineGpuFeatureFlags() call.  This tells which entries are responsible
-  // for raising a certain flag, i.e, for blacklisting a certain feature.
-  // Examples of "feature":
-  //   kGpuFeatureAll - any of the supported features;
-  //   kGpuFeatureWebgl - a single feature;
-  //   kGpuFeatureWebgl | kGpuFeatureAcceleratedCompositing - two features.
-  void GetGpuFeatureFlagEntries(GpuFeatureFlags::GpuFeatureType feature,
-                                std::vector<uint32>& entry_ids) const;
-
-  // Return the largest entry id.  This is used for histogramming.
-  uint32 max_entry_id() const;
-
-  // Collects the version of the current blacklist.  Returns false and sets
-  // major and minor to 0 on failure.
-  bool GetVersion(uint16* major, uint16* monir) const;
-
- private:
-  class VersionInfo {
-   public:
-    VersionInfo(const std::string& version_op,
-                const std::string& version_string,
-                const std::string& version_string2);
-    ~VersionInfo();
-
-    // Determines if a given version is included in the VersionInfo range.
-    bool Contains(const Version& version) const;
-
-    // Determines if the VersionInfo contains valid information.
-    bool IsValid() const;
-
-   private:
-    enum Op {
-      kBetween,  // <= * <=
-      kEQ,  // =
-      kLT,  // <
-      kLE,  // <=
-      kGT,  // >
-      kGE,  // >=
-      kAny,
-      kUnknown  // Indicates VersionInfo data is invalid.
-    };
-
-    // Maps string to Op; returns kUnknown if it's not a valid Op.
-    static Op StringToOp(const std::string& version_op);
-
-    Op op_;
-    scoped_ptr<Version> version_;
-    scoped_ptr<Version> version2_;
-  };
-
-  class OsInfo {
-   public:
-    OsInfo(const std::string& os,
-           const std::string& version_op,
-           const std::string& version_string,
-           const std::string& version_string2);
-    ~OsInfo();
-
-    // Determines if a given os/version is included in the OsInfo set.
-    bool Contains(OsType type, const Version& version) const;
-
-    // Determines if the VersionInfo contains valid information.
-    bool IsValid() const;
-
-    OsType type() const;
-
-    // Maps string to OsType; returns kOsUnknown if it's not a valid os.
-    static OsType StringToOsType(const std::string& os);
-
-   private:
-    OsType type_;
-    scoped_ptr<VersionInfo> version_info_;
-  };
-
-  class StringInfo {
-   public:
-    StringInfo(const std::string& string_op, const std::string& string_value);
-
-    // Determines if a given string is included in the StringInfo.
-    bool Contains(const std::string& value) const;
-
-    // Determines if the StringInfo contains valid information.
-    bool IsValid() const;
-
-   private:
-    enum Op {
-      kContains,
-      kBeginWith,
-      kEndWith,
-      kEQ,  // =
-      kUnknown  // Indicates StringInfo data is invalid.
-    };
-
-    // Maps string to Op; returns kUnknown if it's not a valid Op.
-    static Op StringToOp(const std::string& string_op);
-
-    Op op_;
-    std::string value_;
-  };
-
-  class GpuBlacklistEntry {
-   public:
-    // Constructs GpuBlacklistEntry from DictionaryValue loaded from json.
-    static GpuBlacklistEntry* GetGpuBlacklistEntryFromValue(
-        DictionaryValue* value);
-
-    // Determines if a given os/gc/driver is included in the Entry set.
-    bool Contains(OsType os_type,
-                  const Version& os_version,
-                  const GPUInfo& gpu_info) const;
-
-    // Returns the OsType.
-    OsType GetOsType() const;
-
-    // Returns the entry's unique id.  0 is reserved.
-    uint32 id() const;
-
-    // Returns the GpuFeatureFlags.
-    GpuFeatureFlags GetGpuFeatureFlags() const;
-
-    ~GpuBlacklistEntry();
-
-   private:
-    GpuBlacklistEntry();
-
-    bool SetId(const std::string& id_string);
-
-    bool SetOsInfo(const std::string& os,
-                   const std::string& version_op,
-                   const std::string& version_string,
-                   const std::string& version_string2);
-
-    bool SetVendorId(const std::string& vendor_id_string);
-
-    bool SetDeviceId(const std::string& device_id_string);
-
-    bool SetDriverVendorInfo(const std::string& vendor_op,
-                             const std::string& vendor_value);
-
-    bool SetDriverVersionInfo(const std::string& version_op,
-                              const std::string& version_string,
-                              const std::string& version_string2);
-
-    bool SetGLRendererInfo(const std::string& renderer_op,
-                           const std::string& renderer_value);
-
-    bool SetBlacklistedFeatures(
-        const std::vector<std::string>& blacklisted_features);
-
-    uint32 id_;
-    scoped_ptr<OsInfo> os_info_;
-    uint32 vendor_id_;
-    uint32 device_id_;
-    scoped_ptr<StringInfo> driver_vendor_info_;
-    scoped_ptr<VersionInfo> driver_version_info_;
-    scoped_ptr<StringInfo> gl_renderer_info_;
-    scoped_ptr<GpuFeatureFlags> feature_flags_;
-  };
-
-  // Gets the current OS type.
-  static OsType GetOsType();
-
-  void Clear();
-
-  scoped_ptr<Version> version_;
-  std::vector<GpuBlacklistEntry*> blacklist_;
-
-  // This records all the blacklist entries that are appliable to the current
-  // user machine.  It is updated everytime DetermineGpuFeatureFlags() is
-  // called and is used later by GetGpuFeatureFlagEntries().
-  std::vector<GpuBlacklistEntry*> active_entries_;
-
-  uint32 max_entry_id_;
-
-  DISALLOW_COPY_AND_ASSIGN(GpuBlacklist);
-};
+// TODO(jam): remove this file when all files have been converted.
+#include "content/browser/gpu_blacklist.h"
 
 #endif  // CHROME_BROWSER_GPU_BLACKLIST_H_
 
diff --git a/chrome/browser/gpu_process_host.h b/chrome/browser/gpu_process_host.h
index 851616aa..348a6d46 100644
--- a/chrome/browser/gpu_process_host.h
+++ b/chrome/browser/gpu_process_host.h
@@ -6,49 +6,7 @@
 #define CHROME_BROWSER_GPU_PROCESS_HOST_H_
 #pragma once
 
-#include "base/threading/non_thread_safe.h"
-#include "chrome/browser/browser_child_process_host.h"
-
-namespace IPC {
-class Message;
-}
-
-class GpuProcessHost : public BrowserChildProcessHost,
-                       public base::NonThreadSafe {
- public:
-
-  // Create a GpuProcessHost with the given ID. The object can be found using
-  // FromID with the same id.
-  static GpuProcessHost* Create(int host_id);
-
-  // Get the GPU process host for the GPU process with the given ID. Returns
-  // null if the process no longer exists.
-  static GpuProcessHost* FromID(int host_id);
-
-  virtual bool Send(IPC::Message* msg);
-
-  // IPC::Channel::Listener implementation.
-  virtual bool OnMessageReceived(const IPC::Message& message);
-
- private:
-  explicit GpuProcessHost(int host_id);
-  virtual ~GpuProcessHost();
-  bool Init();
-
-  // Post an IPC message to the UI shim's message handler on the UI thread.
-  void RouteOnUIThread(const IPC::Message& message);
-
-  virtual bool CanShutdown();
-  virtual void OnChildDied();
-  virtual void OnProcessCrashed(int exit_code);
-
-  bool CanLaunchGpuProcess() const;
-  bool LaunchGpuProcess();
-
-  // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair.
-  int host_id_;
-
-  DISALLOW_COPY_AND_ASSIGN(GpuProcessHost);
-};
+// TODO(jam): remove this file when all files have been converted.
+#include "content/browser/gpu_process_host.h"
 
 #endif  // CHROME_BROWSER_GPU_PROCESS_HOST_H_
diff --git a/chrome/browser/gpu_process_host_ui_shim.cc b/chrome/browser/gpu_process_host_ui_shim.cc
index 40b36bf..05a1a95 100644
--- a/chrome/browser/gpu_process_host_ui_shim.cc
+++ b/chrome/browser/gpu_process_host_ui_shim.cc
@@ -1,3 +1,6 @@
+// TODO(jam): move this file to src/content once we have an interface that the
+// embedder provides.  We can then use it to get the resource and resize the
+// window.
 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
diff --git a/chrome/browser/host_zoom_map.h b/chrome/browser/host_zoom_map.h
index 85e02ed..3ea83fb0 100644
--- a/chrome/browser/host_zoom_map.h
+++ b/chrome/browser/host_zoom_map.h
@@ -2,126 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// Maps hostnames to custom zoom levels.  Written on the UI thread and read on
-// any thread.  One instance per profile.
-
 #ifndef CHROME_BROWSER_HOST_ZOOM_MAP_H_
 #define CHROME_BROWSER_HOST_ZOOM_MAP_H_
 #pragma once
 
-#include <map>
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/ref_counted.h"
-#include "base/synchronization/lock.h"
-#include "chrome/browser/browser_thread.h"
-#include "chrome/browser/prefs/pref_change_registrar.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-class GURL;
-class PrefService;
-class Profile;
-
-// HostZoomMap needs to be deleted on the UI thread because it listens
-// to notifications on there (and holds a NotificationRegistrar).
-class HostZoomMap :
-    public NotificationObserver,
-    public base::RefCountedThreadSafe<HostZoomMap,
-                                      BrowserThread::DeleteOnUIThread> {
- public:
-  explicit HostZoomMap(Profile* profile);
-
-  static void RegisterUserPrefs(PrefService* prefs);
-
-  // Returns the zoom level for a given url. The zoom level is determined by
-  // the host portion of the URL, or (in the absence of a host) the complete
-  // spec of the URL. In most cases, there is no custom zoom level, and this
-  // returns the user's default zoom level.  Otherwise, returns the saved zoom
-  // level, which may be positive (to zoom in) or negative (to zoom out).
-  //
-  // This may be called on any thread.
-  double GetZoomLevel(const GURL& url) const;
-
-  // Sets the zoom level for a given url to |level|.  If the level matches the
-  // current default zoom level, the host is erased from the saved preferences;
-  // otherwise the new value is written out.
-  //
-  // This should only be called on the UI thread.
-  void SetZoomLevel(const GURL& url, double level);
-
-  // Returns the temporary zoom level that's only valid for the lifetime of
-  // the given tab (i.e. isn't saved and doesn't affect other tabs) if it
-  // exists, the default zoom level otherwise.
-  //
-  // This may be called on any thread.
-  double GetTemporaryZoomLevel(int render_process_id,
-                               int render_view_id) const;
-
-  // Sets the temporary zoom level that's only valid for the lifetime of this
-  // tab.
-  //
-  // This should only be called on the UI thread.
-  void SetTemporaryZoomLevel(int render_process_id,
-                             int render_view_id,
-                             double level);
-
-  // Resets all zoom levels.
-  //
-  // This should only be called on the UI thread.
-  void ResetToDefaults();
-
-  // NotificationObserver implementation.
-  virtual void Observe(NotificationType type,
-                       const NotificationSource& source,
-                       const NotificationDetails& details);
-
- private:
-  friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
-  friend class DeleteTask<HostZoomMap>;
-
-  typedef std::map<std::string, double> HostZoomLevels;
-
-  ~HostZoomMap();
-
-  // Reads the zoom levels from the preferences service.
-  void Load();
-
-  // Removes dependencies on the profile so we can live longer than
-  // the profile without crashing.
-  void Shutdown();
-
-  // The profile we're associated with.
-  Profile* profile_;
-
-  // Copy of the pref data, so that we can read it on the IO thread.
-  HostZoomLevels host_zoom_levels_;
-  double default_zoom_level_;
-
-  struct TemporaryZoomLevel {
-    int render_process_id;
-    int render_view_id;
-    double zoom_level;
-  };
-
-  // Don't expect more than a couple of tabs that are using a temporary zoom
-  // level, so vector is fine for now.
-  std::vector<TemporaryZoomLevel> temporary_zoom_levels_;
-
-  // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and
-  // |temporary_zoom_levels_| to guarantee thread safety.
-  mutable base::Lock lock_;
-
-  // Whether we are currently updating preferences, this is used to ignore
-  // notifications from the preference service that we triggered ourself.
-  bool updating_preferences_;
-
-  NotificationRegistrar registrar_;
-  PrefChangeRegistrar pref_change_registrar_;
-
-  DISALLOW_COPY_AND_ASSIGN(HostZoomMap);
-};
+// TODO(jam): remove this file when all files have been converted.
+#include "content/browser/host_zoom_map.h"
 
 #endif  // CHROME_BROWSER_HOST_ZOOM_MAP_H_
diff --git a/chrome/browser/mime_registry_message_filter.h b/chrome/browser/mime_registry_message_filter.h
index 71348e5..ef1fefb 100644
--- a/chrome/browser/mime_registry_message_filter.h
+++ b/chrome/browser/mime_registry_message_filter.h
@@ -5,27 +5,7 @@
 #ifndef CHROME_BROWSER_MIME_REGISTRY_MESSAGE_FILTER_H_
 #define CHROME_BROWSER_MIME_REGISTRY_MESSAGE_FILTER_H_
 
-#include "base/file_path.h"
-#include "chrome/browser/browser_message_filter.h"
-
-class MimeRegistryMessageFilter : public BrowserMessageFilter {
- public:
-  MimeRegistryMessageFilter();
-
-  virtual void OverrideThreadForMessage(const IPC::Message& message,
-                                        BrowserThread::ID* thread);
-  virtual bool OnMessageReceived(const IPC::Message& message,
-                                 bool* message_was_ok);
-
- private:
-  ~MimeRegistryMessageFilter();
-
-  void OnGetMimeTypeFromExtension(const FilePath::StringType& ext,
-                                  std::string* mime_type);
-  void OnGetMimeTypeFromFile(const FilePath& file_path,
-                             std::string* mime_type);
-  void OnGetPreferredExtensionForMimeType(const std::string& mime_type,
-                                          FilePath::StringType* extension);
-};
+// TODO(jam): remove this file when all files have been converted.
+#include "content/browser/mime_registry_message_filter.h"
 
 #endif  // CHROME_BROWSER_MIME_REGISTRY_MESSAGE_FILTER_H_
diff --git a/chrome/browser/modal_html_dialog_delegate.h b/chrome/browser/modal_html_dialog_delegate.h
index 822d337e..dcab1cf 100644
--- a/chrome/browser/modal_html_dialog_delegate.h
+++ b/chrome/browser/modal_html_dialog_delegate.h
@@ -6,63 +6,7 @@
 #define CHROME_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_
 #pragma once
 
-#include <vector>
-
-#include "chrome/browser/webui/html_dialog_ui.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-namespace gfx {
-class Size;
-}
-
-namespace IPC {
-class Message;
-}
-
-// This class can only be used on the UI thread.
-class ModalHtmlDialogDelegate
-    : public HtmlDialogUIDelegate,
-      public NotificationObserver {
- public:
-  ModalHtmlDialogDelegate(const GURL& url,
-                          int width, int height,
-                          const std::string& json_arguments,
-                          IPC::Message* sync_result,
-                          TabContents* contents);
-  ~ModalHtmlDialogDelegate();
-
-  // Notification service callback.
-  virtual void Observe(NotificationType type,
-                       const NotificationSource& source,
-                       const NotificationDetails& details);
-
-  // HTMLDialogUIDelegate implementation:
-  virtual bool IsDialogModal() const;
-  virtual std::wstring GetDialogTitle() const;
-  virtual GURL GetDialogContentURL() const;
-  virtual void GetWebUIMessageHandlers(
-      std::vector<WebUIMessageHandler*>* handlers) const { }
-  virtual void GetDialogSize(gfx::Size* size) const;
-  virtual std::string GetDialogArgs() const;
-  virtual void OnDialogClosed(const std::string& json_retval);
-  virtual void OnCloseContents(TabContents* source, bool* out_close_dialog) { }
-  virtual bool ShouldShowDialogTitle() const;
-
- private:
-  NotificationRegistrar registrar_;
-
-  // The TabContents that opened the dialog.
-  TabContents* contents_;
-
-  // The parameters needed to display a modal HTML dialog.
-  HtmlDialogUI::HtmlDialogParams params_;
-
-  // Once we get our reply in OnModalDialogResponse we'll need to respond to the
-  // plugin using this |sync_result| pointer so we store it between calls.
-  IPC::Message* sync_response_;
-
-  DISALLOW_COPY_AND_ASSIGN(ModalHtmlDialogDelegate);
-};
+// TODO(jam): remove this file when all files have been converted.
+#include "content/browser/modal_html_dialog_delegate.h"
 
 #endif  // CHROME_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_
diff --git a/chrome/browser/plugin_process_host.h b/chrome/browser/plugin_process_host.h
index 754768fa0..bc657bc 100644
--- a/chrome/browser/plugin_process_host.h
+++ b/chrome/browser/plugin_process_host.h
@@ -6,172 +6,7 @@
 #define CHROME_BROWSER_PLUGIN_PROCESS_HOST_H_
 #pragma once
 
-#include "build/build_config.h"
-
-#include <queue>
-#include <set>
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/ref_counted.h"
-#include "chrome/browser/browser_child_process_host.h"
-#include "chrome/browser/net/resolve_proxy_msg_helper.h"
-#include "ui/gfx/native_widget_types.h"
-#include "webkit/plugins/npapi/webplugininfo.h"
-
-namespace gfx {
-class Rect;
-}
-
-namespace IPC {
-struct ChannelHandle;
-}
-
-class GURL;
-
-// Represents the browser side of the browser <--> plugin communication
-// channel.  Different plugins run in their own process, but multiple instances
-// of the same plugin run in the same process.  There will be one
-// PluginProcessHost per plugin process, matched with a corresponding
-// PluginProcess running in the plugin process.  The browser is responsible for
-// starting the plugin process when a plugin is created that doesn't already
-// have a process.  After that, most of the communication is directly between
-// the renderer and plugin processes.
-class PluginProcessHost : public BrowserChildProcessHost,
-                          public ResolveProxyMsgHelper::Delegate {
- public:
-  class Client {
-   public:
-    // Returns a opaque unique identifier for the process requesting
-    // the channel.
-    virtual int ID() = 0;
-    virtual bool OffTheRecord() = 0;
-    virtual void SetPluginInfo(const webkit::npapi::WebPluginInfo& info) = 0;
-    // The client should delete itself when one of these methods is called.
-    virtual void OnChannelOpened(const IPC::ChannelHandle& handle) = 0;
-    virtual void OnError() = 0;
-
-   protected:
-    virtual ~Client() {}
-  };
-
-  PluginProcessHost();
-  virtual ~PluginProcessHost();
-
-  // Initialize the new plugin process, returning true on success. This must
-  // be called before the object can be used.
-  bool Init(const webkit::npapi::WebPluginInfo& info, const std::string& locale);
-
-  // Force the plugin process to shutdown (cleanly).
-  virtual void ForceShutdown();
-
-  virtual bool OnMessageReceived(const IPC::Message& msg);
-  virtual void OnChannelConnected(int32 peer_pid);
-  virtual void OnChannelError();
-
-  // ResolveProxyMsgHelper::Delegate implementation:
-  virtual void OnResolveProxyCompleted(IPC::Message* reply_msg,
-                                       int result,
-                                       const std::string& proxy_list);
-
-  // Tells the plugin process to create a new channel for communication with a
-  // renderer.  When the plugin process responds with the channel name,
-  // OnChannelOpened in the client is called.
-  void OpenChannelToPlugin(Client* client);
-
-  // This function is called on the IO thread once we receive a reply from the
-  // modal HTML dialog (in the form of a JSON string). This function forwards
-  // that reply back to the plugin that requested the dialog.
-  void OnModalDialogResponse(const std::string& json_retval,
-                             IPC::Message* sync_result);
-
-#if defined(OS_MACOSX)
-  // This function is called on the IO thread when the browser becomes the
-  // active application.
-  void OnAppActivation();
-#endif
-
-  const webkit::npapi::WebPluginInfo& info() const { return info_; }
-
-#if defined(OS_WIN)
-  // Tracks plugin parent windows created on the browser UI thread.
-  void AddWindow(HWND window);
-#endif
-
- private:
-  friend class PluginResolveProxyHelper;
-
-  // Sends a message to the plugin process to request creation of a new channel
-  // for the given mime type.
-  void RequestPluginChannel(Client* client);
-
-  virtual void OnProcessLaunched();
-
-  // Message handlers.
-  void OnChannelCreated(const IPC::ChannelHandle& channel_handle);
-  void OnGetPluginFinderUrl(std::string* plugin_finder_url);
-  void OnGetCookies(uint32 request_context, const GURL& url,
-                    std::string* cookies);
-  void OnAccessFiles(int renderer_id, const std::vector<std::string>& files,
-                     bool* allowed);
-  void OnResolveProxy(const GURL& url, IPC::Message* reply_msg);
-  void OnPluginMessage(const std::vector<uint8>& data);
-
-#if defined(OS_WIN)
-  void OnPluginWindowDestroyed(HWND window, HWND parent);
-  void OnDownloadUrl(const std::string& url, int source_child_unique_id,
-                     gfx::NativeWindow caller_window);
-#endif
-
-#if defined(USE_X11)
-  void OnMapNativeViewId(gfx::NativeViewId id, gfx::PluginWindowHandle* output);
-#endif
-
-#if defined(OS_MACOSX)
-  void OnPluginSelectWindow(uint32 window_id, gfx::Rect window_rect,
-                            bool modal);
-  void OnPluginShowWindow(uint32 window_id, gfx::Rect window_rect,
-                          bool modal);
-  void OnPluginHideWindow(uint32 window_id, gfx::Rect window_rect);
-  void OnPluginSetCursorVisibility(bool visible);
-#endif
-
-  virtual bool CanShutdown();
-
-  void CancelRequests();
-
-  // These are channel requests that we are waiting to send to the
-  // plugin process once the channel is opened.
-  std::vector<Client*> pending_requests_;
-
-  // These are the channel requests that we have already sent to
-  // the plugin process, but haven't heard back about yet.
-  std::queue<Client*> sent_requests_;
-
-  // Information about the plugin.
-  webkit::npapi::WebPluginInfo info_;
-
-  // Helper class for handling PluginProcessHost_ResolveProxy messages (manages
-  // the requests to the proxy service).
-  ResolveProxyMsgHelper resolve_proxy_msg_helper_;
-
-#if defined(OS_WIN)
-  // Tracks plugin parent windows created on the UI thread.
-  std::set<HWND> plugin_parent_windows_set_;
-#endif
-#if defined(OS_MACOSX)
-  // Tracks plugin windows currently visible.
-  std::set<uint32> plugin_visible_windows_set_;
-  // Tracks full screen windows currently visible.
-  std::set<uint32> plugin_fullscreen_windows_set_;
-  // Tracks modal windows currently visible.
-  std::set<uint32> plugin_modal_windows_set_;
-  // Tracks the current visibility of the cursor.
-  bool plugin_cursor_visible_;
-#endif
-
-  DISALLOW_COPY_AND_ASSIGN(PluginProcessHost);
-};
+// TODO(jam): remove this file when all files have been converted.
+#include "content/browser/plugin_process_host.h"
 
 #endif  // CHROME_BROWSER_PLUGIN_PROCESS_HOST_H_
diff --git a/chrome/browser/plugin_service.h b/chrome/browser/plugin_service.h
index 1c0af96..ce56cfb1 100644
--- a/chrome/browser/plugin_service.h
+++ b/chrome/browser/plugin_service.h
@@ -2,231 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// This class responds to requests from renderers for the list of plugins, and
-// also a proxy object for plugin instances.
-
 #ifndef CHROME_BROWSER_PLUGIN_SERVICE_H_
 #define CHROME_BROWSER_PLUGIN_SERVICE_H_
 #pragma once
 
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/file_path.h"
-#include "base/hash_tables.h"
-#include "base/scoped_vector.h"
-#include "base/singleton.h"
-#include "base/synchronization/lock.h"
-#include "base/synchronization/waitable_event_watcher.h"
-#include "build/build_config.h"
-#include "chrome/browser/plugin_process_host.h"
-#include "chrome/browser/ppapi_plugin_process_host.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "googleurl/src/gurl.h"
-#include "ipc/ipc_channel_handle.h"
-#include "webkit/plugins/npapi/webplugininfo.h"
-
-#if defined(OS_WIN)
-#include "base/scoped_ptr.h"
-#include "base/win/registry.h"
-#endif
-
-#if defined(OS_LINUX)
-#include "chrome/browser/file_path_watcher/file_path_watcher.h"
-#endif
-
-#if defined(OS_CHROMEOS)
-namespace chromeos {
-class PluginSelectionPolicy;
-}
-#endif
-
-namespace IPC {
-class Message;
-}
-
-class MessageLoop;
-struct PepperPluginInfo;
-class PluginDirWatcherDelegate;
-class Profile;
-class ResourceDispatcherHost;
-
-namespace net {
-class URLRequestContext;
-}  // namespace net
-
-// This must be created on the main thread but it's only called on the IO/file
-// thread.
-class PluginService
-    : public base::WaitableEventWatcher::Delegate,
-      public NotificationObserver {
- public:
-  struct OverriddenPlugin {
-    int render_process_id;
-    int render_view_id;
-    GURL url;
-    webkit::npapi::WebPluginInfo plugin;
-  };
-
-  // Initializes the global instance; should be called on startup from the main
-  // thread.
-  static void InitGlobalInstance(Profile* profile);
-
-  // Returns the PluginService singleton.
-  static PluginService* GetInstance();
-
-  // Load all the plugins that should be loaded for the lifetime of the browser
-  // (ie, with the LoadOnStartup flag set).
-  void LoadChromePlugins(ResourceDispatcherHost* resource_dispatcher_host);
-
-  // Sets/gets the data directory that Chrome plugins should use to store
-  // persistent data.
-  void SetChromePluginDataDir(const FilePath& data_dir);
-  const FilePath& GetChromePluginDataDir();
-
-  // Gets the browser's UI locale.
-  const std::string& GetUILocale();
-
-  // Returns the plugin process host corresponding to the plugin process that
-  // has been started by this service. Returns NULL if no process has been
-  // started.
-  PluginProcessHost* FindNpapiPluginProcess(const FilePath& plugin_path);
-  PpapiPluginProcessHost* FindPpapiPluginProcess(const FilePath& plugin_path);
-
-  // Returns the plugin process host corresponding to the plugin process that
-  // has been started by this service. This will start a process to host the
-  // 'plugin_path' if needed. If the process fails to start, the return value
-  // is NULL. Must be called on the IO thread.
-  PluginProcessHost* FindOrStartNpapiPluginProcess(
-      const FilePath& plugin_path);
-  PpapiPluginProcessHost* FindOrStartPpapiPluginProcess(
-      const FilePath& plugin_path);
-
-  // Opens a channel to a plugin process for the given mime type, starting
-  // a new plugin process if necessary.  This must be called on the IO thread
-  // or else a deadlock can occur.
-  void OpenChannelToNpapiPlugin(int render_process_id,
-                                int render_view_id,
-                                const GURL& url,
-                                const std::string& mime_type,
-                                PluginProcessHost::Client* client);
-  void OpenChannelToPpapiPlugin(const FilePath& path,
-                                PpapiPluginProcessHost::Client* client);
-
-  // Gets the first allowed plugin in the list of plugins that matches
-  // the given url and mime type.  Must be called on the FILE thread.
-  bool GetFirstAllowedPluginInfo(int render_process_id,
-                                 int render_view_id,
-                                 const GURL& url,
-                                 const std::string& mime_type,
-                                 webkit::npapi::WebPluginInfo* info,
-                                 std::string* actual_mime_type);
-
-  // Returns true if the given plugin is allowed to be used by a page with
-  // the given URL.
-  bool PrivatePluginAllowedForURL(const FilePath& plugin_path, const GURL& url);
-
-  // Safe to be called from any thread.
-  void OverridePluginForTab(OverriddenPlugin plugin);
-
-  // The UI thread's message loop
-  MessageLoop* main_message_loop() { return main_message_loop_; }
-
-  ResourceDispatcherHost* resource_dispatcher_host() const {
-    return resource_dispatcher_host_;
-  }
-
-  static void EnableChromePlugins(bool enable);
-
- private:
-  friend struct DefaultSingletonTraits<PluginService>;
-
-  // Creates the PluginService object, but doesn't actually build the plugin
-  // list yet.  It's generated lazily.
-  PluginService();
-  ~PluginService();
-
-  // base::WaitableEventWatcher::Delegate implementation.
-  virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event);
-
-  // NotificationObserver implementation
-  virtual void Observe(NotificationType type, const NotificationSource& source,
-                       const NotificationDetails& details);
-
-  void RegisterPepperPlugins();
-
-  // Helper so we can do the plugin lookup on the FILE thread.
-  void GetAllowedPluginForOpenChannelToPlugin(
-      int render_process_id,
-      int render_view_id,
-      const GURL& url,
-      const std::string& mime_type,
-      PluginProcessHost::Client* client);
-
-  // Helper so we can finish opening the channel after looking up the
-  // plugin.
-  void FinishOpenChannelToPlugin(
-      const FilePath& plugin_path,
-      PluginProcessHost::Client* client);
-
-#if defined(OS_LINUX)
-  // Registers a new FilePathWatcher for a given path.
-  static void RegisterFilePathWatcher(
-      FilePathWatcher* watcher,
-      const FilePath& path,
-      FilePathWatcher::Delegate* delegate);
-#endif
-
-  // The main thread's message loop.
-  MessageLoop* main_message_loop_;
-
-  // The IO thread's resource dispatcher host.
-  ResourceDispatcherHost* resource_dispatcher_host_;
-
-  // The data directory that Chrome plugins should use to store persistent data.
-  FilePath chrome_plugin_data_dir_;
-
-  // The browser's UI locale.
-  const std::string ui_locale_;
-
-  // Map of plugin paths to the origin they are restricted to.  Used for
-  // extension-only plugins.
-  typedef base::hash_map<FilePath, GURL> PrivatePluginMap;
-  PrivatePluginMap private_plugins_;
-
-  NotificationRegistrar registrar_;
-
-#if defined(OS_CHROMEOS)
-  scoped_refptr<chromeos::PluginSelectionPolicy> plugin_selection_policy_;
-#endif
-
-#if defined(OS_WIN)
-  // Registry keys for getting notifications when new plugins are installed.
-  base::win::RegKey hkcu_key_;
-  base::win::RegKey hklm_key_;
-  scoped_ptr<base::WaitableEvent> hkcu_event_;
-  scoped_ptr<base::WaitableEvent> hklm_event_;
-  base::WaitableEventWatcher hkcu_watcher_;
-  base::WaitableEventWatcher hklm_watcher_;
-#endif
-
-#if defined(OS_LINUX)
-  ScopedVector<FilePathWatcher> file_watchers_;
-  scoped_refptr<PluginDirWatcherDelegate> file_watcher_delegate_;
-#endif
-
-  std::vector<PepperPluginInfo> ppapi_plugins_;
-
-  // Set to true if chrome plugins are enabled. Defaults to true.
-  static bool enable_chrome_plugins_;
-
-  std::vector<OverriddenPlugin> overridden_plugins_;
-  base::Lock overridden_plugins_lock_;
-
-  DISALLOW_COPY_AND_ASSIGN(PluginService);
-};
-
-DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService);
-
+// TODO(jam): remove this file when all files have been converted.
+#include "content/browser/plugin_service.h"
 #endif  // CHROME_BROWSER_PLUGIN_SERVICE_H_
diff --git a/chrome/browser/ppapi_plugin_process_host.h b/chrome/browser/ppapi_plugin_process_host.h
index 945195d..2a75065 100644
--- a/chrome/browser/ppapi_plugin_process_host.h
+++ b/chrome/browser/ppapi_plugin_process_host.h
@@ -6,73 +6,8 @@
 #define CHROME_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
 #pragma once
 
-#include <queue>
-
-#include "base/basictypes.h"
-#include "base/file_path.h"
-#include "chrome/browser/browser_child_process_host.h"
-
-class PpapiPluginProcessHost : public BrowserChildProcessHost {
- public:
-  class Client {
-   public:
-    // Gets the information about the renderer that's requesting the channel.
-    virtual void GetChannelInfo(base::ProcessHandle* renderer_handle,
-                                int* renderer_id) = 0;
-
-    // Called when the channel is asynchronously opened to the plugin or on
-    // error. On error, the parameters should be:
-    //   base::kNullProcessHandle
-    //   IPC::ChannelHandle()
-    virtual void OnChannelOpened(base::ProcessHandle plugin_process_handle,
-                                 const IPC::ChannelHandle& channel_handle) = 0;
-  };
-
-  // You must call init before doing anything else.
-  explicit PpapiPluginProcessHost();
-  virtual ~PpapiPluginProcessHost();
-
-  // Actually launches the process with the given plugin path. Returns true
-  // on success (the process was spawned).
-  bool Init(const FilePath& path);
-
-  // Opens a new channel to the plugin. The client will be notified when the
-  // channel is ready or if there's an error.
-  void OpenChannelToPlugin(Client* client);
-
-  const FilePath& plugin_path() const { return plugin_path_; }
-
-  // The client pointer must remain valid until its callback is issued.
-
- private:
-
-  void RequestPluginChannel(Client* client);
-
-  virtual bool CanShutdown();
-  virtual void OnProcessLaunched();
-
-  virtual bool OnMessageReceived(const IPC::Message& msg);
-  virtual void OnChannelConnected(int32 peer_pid);
-  virtual void OnChannelError();
-
-  void CancelRequests();
-
-  // IPC message handlers.
-  void OnRendererPluginChannelCreated(const IPC::ChannelHandle& handle);
-
-  // Channel requests that we are waiting to send to the plugin process once
-  // the channel is opened.
-  std::vector<Client*> pending_requests_;
-
-  // Channel requests that we have already sent to the plugin process, but
-  // haven't heard back about yet.
-  std::queue<Client*> sent_requests_;
-
-  // Path to the plugin library.
-  FilePath plugin_path_;
-
-  DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost);
-};
+// TODO(jam): remove this file when all files have been converted.
+#include "content/browser/ppapi_plugin_process_host.h"
 
 #endif  // CHROME_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
 
diff --git a/chrome/browser/zygote_host_linux.h b/chrome/browser/zygote_host_linux.h
index bbc00dc..1ad9f0e 100644
--- a/chrome/browser/zygote_host_linux.h
+++ b/chrome/browser/zygote_host_linux.h
@@ -6,93 +6,7 @@
 #define CHROME_BROWSER_ZYGOTE_HOST_LINUX_H_
 #pragma once
 
-#include <unistd.h>
-
-#include <string>
-#include <vector>
-
-#include "base/global_descriptors_posix.h"
-#include "base/process.h"
-#include "base/process_util.h"
-#include "base/synchronization/lock.h"
-
-template<typename Type>
-struct DefaultSingletonTraits;
-
-static const char kZygoteMagic[] = "ZYGOTE_OK";
-
-// http://code.google.com/p/chromium/wiki/LinuxZygote
-
-// The zygote host is the interface, in the browser process, to the zygote
-// process.
-class ZygoteHost {
- public:
-  // Returns the singleton instance.
-  static ZygoteHost* GetInstance();
-
-  void Init(const std::string& sandbox_cmd);
-
-  // Tries to start a renderer process.  Returns its pid on success, otherwise
-  // base::kNullProcessHandle;
-  pid_t ForkRenderer(const std::vector<std::string>& command_line,
-                     const base::GlobalDescriptors::Mapping& mapping);
-  void EnsureProcessTerminated(pid_t process);
-
-  // Get the termination status (and, optionally, the exit code) of
-  // the process. |exit_code| is set to the exit code of the child
-  // process. (|exit_code| may be NULL.)
-  base::TerminationStatus GetTerminationStatus(base::ProcessHandle handle,
-                                               int* exit_code);
-
-  // These are the command codes used on the wire between the browser and the
-  // zygote.
-  enum {
-    kCmdFork = 0,                  // Fork off a new renderer.
-    kCmdReap = 1,                  // Reap a renderer child.
-    kCmdGetTerminationStatus = 2,  // Check what happend to a child process.
-    kCmdGetSandboxStatus = 3,      // Read a bitmask of kSandbox*
-  };
-
-  // These form a bitmask which describes the conditions of the sandbox that
-  // the zygote finds itself in.
-  enum {
-    kSandboxSUID = 1 << 0,     // SUID sandbox active
-    kSandboxPIDNS = 1 << 1,    // SUID sandbox is using the PID namespace
-    kSandboxNetNS = 1 << 2,    // SUID sandbox is using the network namespace
-    kSandboxSeccomp = 1 << 3,  // seccomp sandbox active.
-  };
-
-  pid_t pid() const { return pid_; }
-
-  // Returns an int which is a bitmask of kSandbox* values. Only valid after
-  // the first render has been forked.
-  int sandbox_status() const {
-    if (have_read_sandbox_status_word_)
-      return sandbox_status_;
-    return 0;
-  }
-
-  // Adjust the OOM score of the given renderer's PID.
-  void AdjustRendererOOMScore(base::ProcessHandle process_handle, int score);
-
- private:
-  friend struct DefaultSingletonTraits<ZygoteHost>;
-  ZygoteHost();
-  ~ZygoteHost();
-
-  ssize_t ReadReply(void* buf, size_t buflen);
-
-  int control_fd_;  // the socket to the zygote
-  // A lock protecting all communication with the zygote. This lock must be
-  // acquired before sending a command and released after the result has been
-  // received.
-  base::Lock control_lock_;
-  pid_t pid_;
-  bool init_;
-  bool using_suid_sandbox_;
-  std::string sandbox_binary_;
-  bool have_read_sandbox_status_word_;
-  int sandbox_status_;
-};
+// TODO(jam): remove this file when all files have been converted.
+#include "content/browser/zygote_host_linux.h"
 
 #endif  // CHROME_BROWSER_ZYGOTE_HOST_LINUX_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index effb387..c06eef3 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1193,10 +1193,6 @@
         'browser/google/google_url_tracker.h',
         'browser/google/google_util.cc',
         'browser/google/google_util.h',
-        'browser/gpu_blacklist.cc',
-        'browser/gpu_blacklist.h',
-        'browser/gpu_process_host.cc',
-        'browser/gpu_process_host.h',
         'browser/gpu_process_host_ui_shim.cc',
         'browser/gpu_process_host_ui_shim.h',
         'browser/hang_monitor/hung_plugin_action.cc',
@@ -1262,8 +1258,6 @@
         'browser/history/visit_tracker.h',
         'browser/history/visitsegment_database.cc',
         'browser/history/visitsegment_database.h',
-        'browser/host_zoom_map.cc',
-        'browser/host_zoom_map.h',
         'browser/hung_renderer_dialog.h',
         'browser/icon_loader.cc',
         'browser/icon_loader.h',
@@ -1401,10 +1395,6 @@
         'browser/metrics/metrics_service.h',
         'browser/metrics/user_metrics.cc',
         'browser/metrics/user_metrics.h',
-        'browser/mime_registry_message_filter.cc',
-        'browser/mime_registry_message_filter.h',
-        'browser/modal_html_dialog_delegate.cc',
-        'browser/modal_html_dialog_delegate.h',
         'browser/nacl_host/nacl_broker_host_win.cc',
         'browser/nacl_host/nacl_broker_host_win.h',
         'browser/nacl_host/nacl_broker_service_win.cc',
@@ -1596,11 +1586,6 @@
         'browser/plugin_installer_infobar_delegate.h',
         'browser/plugin_observer.cc',
         'browser/plugin_observer.h',
-        'browser/plugin_process_host.cc',
-        'browser/plugin_process_host.h',
-        'browser/plugin_process_host_mac.cc',
-        'browser/plugin_service.cc',
-        'browser/plugin_service.h',
         'browser/plugin_updater.cc',
         'browser/plugin_updater.h',
         'browser/policy/asynchronous_policy_loader.cc',
@@ -1659,8 +1644,6 @@
         'browser/power_save_blocker_mac.cc',
         'browser/power_save_blocker_stub.cc',
         'browser/power_save_blocker_win.cc',
-        'browser/ppapi_plugin_process_host.cc',
-        'browser/ppapi_plugin_process_host.h',
         'browser/preferences_mac.cc',
         'browser/preferences_mac.h',
         'browser/prefs/browser_prefs.cc',
@@ -3488,8 +3471,6 @@
         'browser/worker_host/worker_process_host.h',
         'browser/worker_host/worker_service.cc',
         'browser/worker_host/worker_service.h',
-        'browser/zygote_host_linux.cc',
-        'browser/zygote_main_linux.cc',
 
         # These files are generated by GRIT.
         '<(grit_out_dir)/grit/component_extension_resources_map.cc',
@@ -3672,12 +3653,6 @@
             'browser/jankometer.cc',
             'browser/password_manager/login_database_posix.cc',
             'browser/power_save_blocker_stub.cc',
-            'browser/renderer_host/backing_store_proxy.cc',
-            'browser/renderer_host/backing_store_proxy.h',
-            'browser/renderer_host/gpu_view_host.cc',
-            'browser/renderer_host/gpu_view_host.h',
-            'browser/renderer_host/video_layer_proxy.cc',
-            'browser/renderer_host/video_layer_proxy.h',
             'browser/ui/browser_list_stub.cc',
             'browser/ui/crypto_module_password_dialog_nss.cc',
             'browser/ui/tabs/dock_info.cc',
@@ -3746,10 +3721,8 @@
               '$(SDKROOT)/System/Library/Frameworks/SecurityInterface.framework',
             ],
             'mac_bundle_resources': [
-              'browser/gpu.sb',
               'browser/nacl_loader.sb',
               'browser/utility.sb',
-              'browser/worker.sb',
             ],
           },
           'actions': [
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 67160b10..73342fc 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1318,7 +1318,6 @@
         'browser/global_keyboard_shortcuts_mac_unittest.mm',
         'browser/google/google_update_settings_unittest.cc',
         'browser/google/google_url_tracker_unittest.cc',
-        'browser/gpu_blacklist_unittest.cc',
         'browser/ui/gtk/accessibility_event_router_gtk_unittest.cc',
         'browser/ui/gtk/bookmark_bar_gtk_unittest.cc',
         'browser/ui/gtk/bookmark_editor_gtk_unittest.cc',
@@ -1349,7 +1348,6 @@
         'browser/history/url_database_unittest.cc',
         'browser/history/visit_database_unittest.cc',
         'browser/history/visit_tracker_unittest.cc',
-        'browser/host_zoom_map_unittest.cc',
         'browser/importer/firefox_importer_unittest.cc',
         'browser/importer/firefox_importer_unittest_messages_internal.h',
         'browser/importer/firefox_importer_unittest_utils.h',
@@ -1401,7 +1399,6 @@
         'browser/password_manager/password_store_mac_unittest.cc',
         'browser/password_manager/password_store_win_unittest.cc',
         'browser/plugin_exceptions_table_model_unittest.cc',
-        'browser/plugin_service_unittest.cc',
         'browser/policy/asynchronous_policy_loader_unittest.cc',
         'browser/policy/asynchronous_policy_provider_unittest.cc',
         'browser/policy/asynchronous_policy_test_base.cc',
@@ -1851,6 +1848,9 @@
         'tools/convert_dict/convert_dict_unittest.cc',
         '../content/browser/browser_thread_unittest.cc',
         '../content/browser/child_process_security_policy_unittest.cc',
+        '../content/browser/gpu_blacklist_unittest.cc',
+        '../content/browser/host_zoom_map_unittest.cc',
+        '../content/browser/plugin_service_unittest.cc',
         '../content/browser/renderer_host/audio_renderer_host_unittest.cc',
         '../content/browser/renderer_host/render_widget_host_unittest.cc',
         '../content/browser/renderer_host/resource_dispatcher_host_unittest.cc',
@@ -2262,7 +2262,6 @@
         'browser/net/cookie_policy_browsertest.cc',
         'browser/net/ftp_browsertest.cc',
         'browser/plugin_data_remover_browsertest.cc',
-        'browser/plugin_service_browsertest.cc',
         'browser/policy/device_management_backend_mock.cc',
         'browser/policy/device_management_backend_mock.h',
         'browser/policy/device_management_service_browsertest.cc',
@@ -2325,6 +2324,7 @@
         'test/render_view_test.cc',
         'test/render_view_test.h',
         '../content/browser/child_process_security_policy_browsertest.cc',
+        '../content/browser/plugin_service_browsertest.cc',
       ],
       'conditions': [
         ['chromeos==0', {
diff --git a/content/DEPS b/content/DEPS
index bd39303..ffab3e2 100644
--- a/content/DEPS
+++ b/content/DEPS
@@ -13,6 +13,7 @@
   "+net",
   "+ppapi",
   "+printing",
+  "+sandbox",
   "+skia",
 
   # Don't allow inclusion of these other libs we shouldn't be calling directly.
diff --git a/chrome/browser/gpu.sb b/content/browser/gpu.sb
similarity index 100%
rename from chrome/browser/gpu.sb
rename to content/browser/gpu.sb
diff --git a/chrome/browser/gpu_blacklist.cc b/content/browser/gpu_blacklist.cc
similarity index 99%
rename from chrome/browser/gpu_blacklist.cc
rename to content/browser/gpu_blacklist.cc
index a09b807..544a656 100644
--- a/chrome/browser/gpu_blacklist.cc
+++ b/content/browser/gpu_blacklist.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 "chrome/browser/gpu_blacklist.h"
+#include "content/browser/gpu_blacklist.h"
 
 #include "base/json/json_reader.h"
 #include "base/logging.h"
diff --git a/content/browser/gpu_blacklist.h b/content/browser/gpu_blacklist.h
new file mode 100644
index 0000000..f732af9
--- /dev/null
+++ b/content/browser/gpu_blacklist.h
@@ -0,0 +1,227 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_GPU_BLACKLIST_H_
+#define CONTENT_BROWSER_GPU_BLACKLIST_H_
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "chrome/common/gpu_feature_flags.h"
+
+class DictionaryValue;
+class GPUInfo;
+class Version;
+
+class GpuBlacklist {
+ public:
+  enum OsType {
+    kOsLinux,
+    kOsMacosx,
+    kOsWin,
+    kOsAny,
+    kOsUnknown
+  };
+
+  GpuBlacklist();
+  ~GpuBlacklist();
+
+  // Loads blacklist information from a json file.
+  // current_os_only==true indicates all blacklist entries that don't belong to
+  // the current OS are discarded; current_os_only==false should only be used
+  // for testing purpose.
+  // If failed, the current GpuBlacklist is un-touched.
+  bool LoadGpuBlacklist(const std::string& json_context,
+                        bool current_os_only);
+
+  // Collects system information and combines them with gpu_info and blacklist
+  // information to determine gpu feature flags.
+  // If os is kOsAny, use the current OS; if os_version is null, use the
+  // current OS version.
+  GpuFeatureFlags DetermineGpuFeatureFlags(OsType os,
+                                           Version* os_version,
+                                           const GPUInfo& gpu_info);
+
+  // Collects the entries that set the "feature" flag from the last
+  // DetermineGpuFeatureFlags() call.  This tells which entries are responsible
+  // for raising a certain flag, i.e, for blacklisting a certain feature.
+  // Examples of "feature":
+  //   kGpuFeatureAll - any of the supported features;
+  //   kGpuFeatureWebgl - a single feature;
+  //   kGpuFeatureWebgl | kGpuFeatureAcceleratedCompositing - two features.
+  void GetGpuFeatureFlagEntries(GpuFeatureFlags::GpuFeatureType feature,
+                                std::vector<uint32>& entry_ids) const;
+
+  // Return the largest entry id.  This is used for histogramming.
+  uint32 max_entry_id() const;
+
+  // Collects the version of the current blacklist.  Returns false and sets
+  // major and minor to 0 on failure.
+  bool GetVersion(uint16* major, uint16* monir) const;
+
+ private:
+  class VersionInfo {
+   public:
+    VersionInfo(const std::string& version_op,
+                const std::string& version_string,
+                const std::string& version_string2);
+    ~VersionInfo();
+
+    // Determines if a given version is included in the VersionInfo range.
+    bool Contains(const Version& version) const;
+
+    // Determines if the VersionInfo contains valid information.
+    bool IsValid() const;
+
+   private:
+    enum Op {
+      kBetween,  // <= * <=
+      kEQ,  // =
+      kLT,  // <
+      kLE,  // <=
+      kGT,  // >
+      kGE,  // >=
+      kAny,
+      kUnknown  // Indicates VersionInfo data is invalid.
+    };
+
+    // Maps string to Op; returns kUnknown if it's not a valid Op.
+    static Op StringToOp(const std::string& version_op);
+
+    Op op_;
+    scoped_ptr<Version> version_;
+    scoped_ptr<Version> version2_;
+  };
+
+  class OsInfo {
+   public:
+    OsInfo(const std::string& os,
+           const std::string& version_op,
+           const std::string& version_string,
+           const std::string& version_string2);
+    ~OsInfo();
+
+    // Determines if a given os/version is included in the OsInfo set.
+    bool Contains(OsType type, const Version& version) const;
+
+    // Determines if the VersionInfo contains valid information.
+    bool IsValid() const;
+
+    OsType type() const;
+
+    // Maps string to OsType; returns kOsUnknown if it's not a valid os.
+    static OsType StringToOsType(const std::string& os);
+
+   private:
+    OsType type_;
+    scoped_ptr<VersionInfo> version_info_;
+  };
+
+  class StringInfo {
+   public:
+    StringInfo(const std::string& string_op, const std::string& string_value);
+
+    // Determines if a given string is included in the StringInfo.
+    bool Contains(const std::string& value) const;
+
+    // Determines if the StringInfo contains valid information.
+    bool IsValid() const;
+
+   private:
+    enum Op {
+      kContains,
+      kBeginWith,
+      kEndWith,
+      kEQ,  // =
+      kUnknown  // Indicates StringInfo data is invalid.
+    };
+
+    // Maps string to Op; returns kUnknown if it's not a valid Op.
+    static Op StringToOp(const std::string& string_op);
+
+    Op op_;
+    std::string value_;
+  };
+
+  class GpuBlacklistEntry {
+   public:
+    // Constructs GpuBlacklistEntry from DictionaryValue loaded from json.
+    static GpuBlacklistEntry* GetGpuBlacklistEntryFromValue(
+        DictionaryValue* value);
+
+    // Determines if a given os/gc/driver is included in the Entry set.
+    bool Contains(OsType os_type,
+                  const Version& os_version,
+                  const GPUInfo& gpu_info) const;
+
+    // Returns the OsType.
+    OsType GetOsType() const;
+
+    // Returns the entry's unique id.  0 is reserved.
+    uint32 id() const;
+
+    // Returns the GpuFeatureFlags.
+    GpuFeatureFlags GetGpuFeatureFlags() const;
+
+    ~GpuBlacklistEntry();
+
+   private:
+    GpuBlacklistEntry();
+
+    bool SetId(const std::string& id_string);
+
+    bool SetOsInfo(const std::string& os,
+                   const std::string& version_op,
+                   const std::string& version_string,
+                   const std::string& version_string2);
+
+    bool SetVendorId(const std::string& vendor_id_string);
+
+    bool SetDeviceId(const std::string& device_id_string);
+
+    bool SetDriverVendorInfo(const std::string& vendor_op,
+                             const std::string& vendor_value);
+
+    bool SetDriverVersionInfo(const std::string& version_op,
+                              const std::string& version_string,
+                              const std::string& version_string2);
+
+    bool SetGLRendererInfo(const std::string& renderer_op,
+                           const std::string& renderer_value);
+
+    bool SetBlacklistedFeatures(
+        const std::vector<std::string>& blacklisted_features);
+
+    uint32 id_;
+    scoped_ptr<OsInfo> os_info_;
+    uint32 vendor_id_;
+    uint32 device_id_;
+    scoped_ptr<StringInfo> driver_vendor_info_;
+    scoped_ptr<VersionInfo> driver_version_info_;
+    scoped_ptr<StringInfo> gl_renderer_info_;
+    scoped_ptr<GpuFeatureFlags> feature_flags_;
+  };
+
+  // Gets the current OS type.
+  static OsType GetOsType();
+
+  void Clear();
+
+  scoped_ptr<Version> version_;
+  std::vector<GpuBlacklistEntry*> blacklist_;
+
+  // This records all the blacklist entries that are appliable to the current
+  // user machine.  It is updated everytime DetermineGpuFeatureFlags() is
+  // called and is used later by GetGpuFeatureFlagEntries().
+  std::vector<GpuBlacklistEntry*> active_entries_;
+
+  uint32 max_entry_id_;
+
+  DISALLOW_COPY_AND_ASSIGN(GpuBlacklist);
+};
+
+#endif  // CONTENT_BROWSER_GPU_BLACKLIST_H_
diff --git a/chrome/browser/gpu_blacklist_unittest.cc b/content/browser/gpu_blacklist_unittest.cc
similarity index 98%
rename from chrome/browser/gpu_blacklist_unittest.cc
rename to content/browser/gpu_blacklist_unittest.cc
index a61cd28..e2b496d 100644
--- a/chrome/browser/gpu_blacklist_unittest.cc
+++ b/content/browser/gpu_blacklist_unittest.cc
@@ -5,8 +5,8 @@
 #include <vector>
 
 #include "base/version.h"
-#include "chrome/browser/gpu_blacklist.h"
 #include "chrome/common/gpu_info.h"
+#include "content/browser/gpu_blacklist.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 TEST(GpuBlacklistTest, BlacklistLogic) {
diff --git a/chrome/browser/gpu_process_host.cc b/content/browser/gpu_process_host.cc
similarity index 96%
rename from chrome/browser/gpu_process_host.cc
rename to content/browser/gpu_process_host.cc
index ab6ec14..4ef366af 100644
--- a/chrome/browser/gpu_process_host.cc
+++ b/content/browser/gpu_process_host.cc
@@ -2,17 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "chrome/browser/gpu_process_host.h"
+#include "content/browser/gpu_process_host.h"
 
 #include "app/app_switches.h"
 #include "base/metrics/histogram.h"
 #include "base/ref_counted.h"
 #include "base/string_piece.h"
 #include "base/threading/thread.h"
-#include "chrome/browser/browser_thread.h"
 #include "chrome/browser/gpu_process_host_ui_shim.h"
-#include "chrome/browser/renderer_host/render_widget_host.h"
-#include "chrome/browser/renderer_host/render_widget_host_view.h"
 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/gpu_feature_flags.h"
@@ -20,6 +17,9 @@
 #include "chrome/common/gpu_messages.h"
 #include "chrome/common/render_messages.h"
 #include "chrome/gpu/gpu_thread.h"
+#include "content/browser/browser_thread.h"
+#include "content/browser/renderer_host/render_widget_host.h"
+#include "content/browser/renderer_host/render_widget_host_view.h"
 #include "ipc/ipc_channel_handle.h"
 #include "ipc/ipc_switches.h"
 #include "media/base/media_switches.h"
diff --git a/content/browser/gpu_process_host.h b/content/browser/gpu_process_host.h
new file mode 100644
index 0000000..9881bee
--- /dev/null
+++ b/content/browser/gpu_process_host.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_GPU_PROCESS_HOST_H_
+#define CONTENT_BROWSER_GPU_PROCESS_HOST_H_
+#pragma once
+
+#include "base/threading/non_thread_safe.h"
+#include "content/browser/browser_child_process_host.h"
+
+namespace IPC {
+class Message;
+}
+
+class GpuProcessHost : public BrowserChildProcessHost,
+                       public base::NonThreadSafe {
+ public:
+
+  // Create a GpuProcessHost with the given ID. The object can be found using
+  // FromID with the same id.
+  static GpuProcessHost* Create(int host_id);
+
+  // Get the GPU process host for the GPU process with the given ID. Returns
+  // null if the process no longer exists.
+  static GpuProcessHost* FromID(int host_id);
+
+  virtual bool Send(IPC::Message* msg);
+
+  // IPC::Channel::Listener implementation.
+  virtual bool OnMessageReceived(const IPC::Message& message);
+
+ private:
+  explicit GpuProcessHost(int host_id);
+  virtual ~GpuProcessHost();
+  bool Init();
+
+  // Post an IPC message to the UI shim's message handler on the UI thread.
+  void RouteOnUIThread(const IPC::Message& message);
+
+  virtual bool CanShutdown();
+  virtual void OnChildDied();
+  virtual void OnProcessCrashed(int exit_code);
+
+  bool CanLaunchGpuProcess() const;
+  bool LaunchGpuProcess();
+
+  // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair.
+  int host_id_;
+
+  DISALLOW_COPY_AND_ASSIGN(GpuProcessHost);
+};
+
+#endif  // CONTENT_BROWSER_GPU_PROCESS_HOST_H_
diff --git a/chrome/browser/host_zoom_map.cc b/content/browser/host_zoom_map.cc
similarity index 97%
rename from chrome/browser/host_zoom_map.cc
rename to content/browser/host_zoom_map.cc
index 3dc257b..0581036 100644
--- a/chrome/browser/host_zoom_map.cc
+++ b/content/browser/host_zoom_map.cc
@@ -4,7 +4,7 @@
 
 #include <cmath>
 
-#include "chrome/browser/host_zoom_map.h"
+#include "content/browser/host_zoom_map.h"
 
 #include "base/string_piece.h"
 #include "base/utf_string_conversions.h"
@@ -12,13 +12,13 @@
 #include "chrome/browser/prefs/pref_service.h"
 #include "chrome/browser/prefs/scoped_pref_update.h"
 #include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/renderer_host/render_process_host.h"
-#include "chrome/browser/renderer_host/render_view_host.h"
 #include "chrome/common/notification_details.h"
 #include "chrome/common/notification_service.h"
 #include "chrome/common/notification_source.h"
 #include "chrome/common/notification_type.h"
 #include "chrome/common/pref_names.h"
+#include "content/browser/renderer_host/render_process_host.h"
+#include "content/browser/renderer_host/render_view_host.h"
 #include "googleurl/src/gurl.h"
 #include "net/base/net_util.h"
 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
diff --git a/content/browser/host_zoom_map.h b/content/browser/host_zoom_map.h
new file mode 100644
index 0000000..4951995
--- /dev/null
+++ b/content/browser/host_zoom_map.h
@@ -0,0 +1,127 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Maps hostnames to custom zoom levels.  Written on the UI thread and read on
+// any thread.  One instance per profile.
+
+#ifndef CONTENT_BROWSER_HOST_ZOOM_MAP_H_
+#define CONTENT_BROWSER_HOST_ZOOM_MAP_H_
+#pragma once
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/ref_counted.h"
+#include "base/synchronization/lock.h"
+#include "chrome/browser/prefs/pref_change_registrar.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "content/browser/browser_thread.h"
+
+class GURL;
+class PrefService;
+class Profile;
+
+// HostZoomMap needs to be deleted on the UI thread because it listens
+// to notifications on there (and holds a NotificationRegistrar).
+class HostZoomMap :
+    public NotificationObserver,
+    public base::RefCountedThreadSafe<HostZoomMap,
+                                      BrowserThread::DeleteOnUIThread> {
+ public:
+  explicit HostZoomMap(Profile* profile);
+
+  static void RegisterUserPrefs(PrefService* prefs);
+
+  // Returns the zoom level for a given url. The zoom level is determined by
+  // the host portion of the URL, or (in the absence of a host) the complete
+  // spec of the URL. In most cases, there is no custom zoom level, and this
+  // returns the user's default zoom level.  Otherwise, returns the saved zoom
+  // level, which may be positive (to zoom in) or negative (to zoom out).
+  //
+  // This may be called on any thread.
+  double GetZoomLevel(const GURL& url) const;
+
+  // Sets the zoom level for a given url to |level|.  If the level matches the
+  // current default zoom level, the host is erased from the saved preferences;
+  // otherwise the new value is written out.
+  //
+  // This should only be called on the UI thread.
+  void SetZoomLevel(const GURL& url, double level);
+
+  // Returns the temporary zoom level that's only valid for the lifetime of
+  // the given tab (i.e. isn't saved and doesn't affect other tabs) if it
+  // exists, the default zoom level otherwise.
+  //
+  // This may be called on any thread.
+  double GetTemporaryZoomLevel(int render_process_id,
+                               int render_view_id) const;
+
+  // Sets the temporary zoom level that's only valid for the lifetime of this
+  // tab.
+  //
+  // This should only be called on the UI thread.
+  void SetTemporaryZoomLevel(int render_process_id,
+                             int render_view_id,
+                             double level);
+
+  // Resets all zoom levels.
+  //
+  // This should only be called on the UI thread.
+  void ResetToDefaults();
+
+  // NotificationObserver implementation.
+  virtual void Observe(NotificationType type,
+                       const NotificationSource& source,
+                       const NotificationDetails& details);
+
+ private:
+  friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
+  friend class DeleteTask<HostZoomMap>;
+
+  typedef std::map<std::string, double> HostZoomLevels;
+
+  ~HostZoomMap();
+
+  // Reads the zoom levels from the preferences service.
+  void Load();
+
+  // Removes dependencies on the profile so we can live longer than
+  // the profile without crashing.
+  void Shutdown();
+
+  // The profile we're associated with.
+  Profile* profile_;
+
+  // Copy of the pref data, so that we can read it on the IO thread.
+  HostZoomLevels host_zoom_levels_;
+  double default_zoom_level_;
+
+  struct TemporaryZoomLevel {
+    int render_process_id;
+    int render_view_id;
+    double zoom_level;
+  };
+
+  // Don't expect more than a couple of tabs that are using a temporary zoom
+  // level, so vector is fine for now.
+  std::vector<TemporaryZoomLevel> temporary_zoom_levels_;
+
+  // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and
+  // |temporary_zoom_levels_| to guarantee thread safety.
+  mutable base::Lock lock_;
+
+  // Whether we are currently updating preferences, this is used to ignore
+  // notifications from the preference service that we triggered ourself.
+  bool updating_preferences_;
+
+  NotificationRegistrar registrar_;
+  PrefChangeRegistrar pref_change_registrar_;
+
+  DISALLOW_COPY_AND_ASSIGN(HostZoomMap);
+};
+
+#endif  // CONTENT_BROWSER_HOST_ZOOM_MAP_H_
diff --git a/chrome/browser/host_zoom_map_unittest.cc b/content/browser/host_zoom_map_unittest.cc
similarity index 100%
rename from chrome/browser/host_zoom_map_unittest.cc
rename to content/browser/host_zoom_map_unittest.cc
diff --git a/chrome/browser/mime_registry_message_filter.cc b/content/browser/mime_registry_message_filter.cc
similarity index 96%
rename from chrome/browser/mime_registry_message_filter.cc
rename to content/browser/mime_registry_message_filter.cc
index c57cad37..3268b84 100644
--- a/chrome/browser/mime_registry_message_filter.cc
+++ b/content/browser/mime_registry_message_filter.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 "chrome/browser/mime_registry_message_filter.h"
+#include "content/browser/mime_registry_message_filter.h"
 
 #include "chrome/common/mime_registry_messages.h"
 #include "net/base/mime_util.h"
diff --git a/content/browser/mime_registry_message_filter.h b/content/browser/mime_registry_message_filter.h
new file mode 100644
index 0000000..87b5b24d
--- /dev/null
+++ b/content/browser/mime_registry_message_filter.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_MIME_REGISTRY_MESSAGE_FILTER_H_
+#define CONTENT_BROWSER_MIME_REGISTRY_MESSAGE_FILTER_H_
+
+#include "base/file_path.h"
+#include "chrome/browser/browser_message_filter.h"
+
+class MimeRegistryMessageFilter : public BrowserMessageFilter {
+ public:
+  MimeRegistryMessageFilter();
+
+  virtual void OverrideThreadForMessage(const IPC::Message& message,
+                                        BrowserThread::ID* thread);
+  virtual bool OnMessageReceived(const IPC::Message& message,
+                                 bool* message_was_ok);
+
+ private:
+  ~MimeRegistryMessageFilter();
+
+  void OnGetMimeTypeFromExtension(const FilePath::StringType& ext,
+                                  std::string* mime_type);
+  void OnGetMimeTypeFromFile(const FilePath& file_path,
+                             std::string* mime_type);
+  void OnGetPreferredExtensionForMimeType(const std::string& mime_type,
+                                          FilePath::StringType* extension);
+};
+
+#endif  // CONTENT_BROWSER_MIME_REGISTRY_MESSAGE_FILTER_H_
diff --git a/chrome/browser/modal_html_dialog_delegate.cc b/content/browser/modal_html_dialog_delegate.cc
similarity index 92%
rename from chrome/browser/modal_html_dialog_delegate.cc
rename to content/browser/modal_html_dialog_delegate.cc
index 5999d3d4b..0f2ca4d 100644
--- a/chrome/browser/modal_html_dialog_delegate.cc
+++ b/content/browser/modal_html_dialog_delegate.cc
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "chrome/browser/modal_html_dialog_delegate.h"
+#include "content/browser/modal_html_dialog_delegate.h"
 
 #include <string>
 
 #include "chrome/browser/browser_list.h"
-#include "chrome/browser/renderer_host/render_view_host.h"
-#include "chrome/browser/tab_contents/tab_contents.h"
 #include "chrome/common/notification_source.h"
+#include "content/browser/renderer_host/render_view_host.h"
+#include "content/browser/tab_contents/tab_contents.h"
 #include "ui/gfx/size.h"
 
 ModalHtmlDialogDelegate::ModalHtmlDialogDelegate(
diff --git a/content/browser/modal_html_dialog_delegate.h b/content/browser/modal_html_dialog_delegate.h
new file mode 100644
index 0000000..642acd8
--- /dev/null
+++ b/content/browser/modal_html_dialog_delegate.h
@@ -0,0 +1,68 @@
+// 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 CONTENT_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_
+#define CONTENT_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_
+#pragma once
+
+#include <vector>
+
+#include "chrome/browser/webui/html_dialog_ui.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+
+namespace gfx {
+class Size;
+}
+
+namespace IPC {
+class Message;
+}
+
+// This class can only be used on the UI thread.
+class ModalHtmlDialogDelegate
+    : public HtmlDialogUIDelegate,
+      public NotificationObserver {
+ public:
+  ModalHtmlDialogDelegate(const GURL& url,
+                          int width, int height,
+                          const std::string& json_arguments,
+                          IPC::Message* sync_result,
+                          TabContents* contents);
+  ~ModalHtmlDialogDelegate();
+
+  // Notification service callback.
+  virtual void Observe(NotificationType type,
+                       const NotificationSource& source,
+                       const NotificationDetails& details);
+
+  // HTMLDialogUIDelegate implementation:
+  virtual bool IsDialogModal() const;
+  virtual std::wstring GetDialogTitle() const;
+  virtual GURL GetDialogContentURL() const;
+  virtual void GetWebUIMessageHandlers(
+      std::vector<WebUIMessageHandler*>* handlers) const { }
+  virtual void GetDialogSize(gfx::Size* size) const;
+  virtual std::string GetDialogArgs() const;
+  virtual void OnDialogClosed(const std::string& json_retval);
+  virtual void OnCloseContents(TabContents* source, bool* out_close_dialog) { }
+  virtual bool ShouldShowDialogTitle() const;
+
+ private:
+  NotificationRegistrar registrar_;
+
+  // The TabContents that opened the dialog.
+  TabContents* contents_;
+
+  // The parameters needed to display a modal HTML dialog.
+  HtmlDialogUI::HtmlDialogParams params_;
+
+  // Once we get our reply in OnModalDialogResponse we'll need to respond to the
+  // plugin using this |sync_result| pointer so we store it between calls.
+  IPC::Message* sync_response_;
+
+  DISALLOW_COPY_AND_ASSIGN(ModalHtmlDialogDelegate);
+};
+
+#endif  // CONTENT_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_
diff --git a/chrome/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc
similarity index 97%
rename from chrome/browser/plugin_process_host.cc
rename to content/browser/plugin_process_host.cc
index c15b030f..215f653 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/content/browser/plugin_process_host.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 "chrome/browser/plugin_process_host.h"
+#include "content/browser/plugin_process_host.h"
 
 #if defined(OS_WIN)
 #include <windows.h>
@@ -20,15 +20,11 @@
 #include "base/path_service.h"
 #include "base/string_util.h"
 #include "base/utf_string_conversions.h"
-#include "chrome/browser/browser_thread.h"
-#include "chrome/browser/child_process_security_policy.h"
 #include "chrome/browser/chrome_plugin_browsing_context.h"
 #include "chrome/browser/net/url_request_tracking.h"
 #include "chrome/browser/plugin_download_helper.h"
 #include "chrome/browser/plugin_service.h"
 #include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
-#include "chrome/browser/renderer_host/resource_message_filter.h"
 #include "chrome/common/chrome_paths.h"
 #include "chrome/common/chrome_plugin_lib.h"
 #include "chrome/common/chrome_switches.h"
@@ -37,6 +33,10 @@
 #include "chrome/common/plugin_messages.h"
 #include "chrome/common/render_messages.h"
 #include "chrome/common/render_messages_params.h"
+#include "content/browser/browser_thread.h"
+#include "content/browser/child_process_security_policy.h"
+#include "content/browser/renderer_host/resource_dispatcher_host.h"
+#include "content/browser/renderer_host/resource_message_filter.h"
 #include "ipc/ipc_switches.h"
 #include "net/base/cookie_store.h"
 #include "net/base/io_buffer.h"
diff --git a/content/browser/plugin_process_host.h b/content/browser/plugin_process_host.h
new file mode 100644
index 0000000..ad44aae
--- /dev/null
+++ b/content/browser/plugin_process_host.h
@@ -0,0 +1,177 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_PLUGIN_PROCESS_HOST_H_
+#define CONTENT_BROWSER_PLUGIN_PROCESS_HOST_H_
+#pragma once
+
+#include "build/build_config.h"
+
+#include <queue>
+#include <set>
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/ref_counted.h"
+#include "chrome/browser/net/resolve_proxy_msg_helper.h"
+#include "content/browser/browser_child_process_host.h"
+#include "ui/gfx/native_widget_types.h"
+#include "webkit/plugins/npapi/webplugininfo.h"
+
+namespace gfx {
+class Rect;
+}
+
+namespace IPC {
+struct ChannelHandle;
+}
+
+class GURL;
+
+// Represents the browser side of the browser <--> plugin communication
+// channel.  Different plugins run in their own process, but multiple instances
+// of the same plugin run in the same process.  There will be one
+// PluginProcessHost per plugin process, matched with a corresponding
+// PluginProcess running in the plugin process.  The browser is responsible for
+// starting the plugin process when a plugin is created that doesn't already
+// have a process.  After that, most of the communication is directly between
+// the renderer and plugin processes.
+class PluginProcessHost : public BrowserChildProcessHost,
+                          public ResolveProxyMsgHelper::Delegate {
+ public:
+  class Client {
+   public:
+    // Returns a opaque unique identifier for the process requesting
+    // the channel.
+    virtual int ID() = 0;
+    virtual bool OffTheRecord() = 0;
+    virtual void SetPluginInfo(const webkit::npapi::WebPluginInfo& info) = 0;
+    // The client should delete itself when one of these methods is called.
+    virtual void OnChannelOpened(const IPC::ChannelHandle& handle) = 0;
+    virtual void OnError() = 0;
+
+   protected:
+    virtual ~Client() {}
+  };
+
+  PluginProcessHost();
+  virtual ~PluginProcessHost();
+
+  // Initialize the new plugin process, returning true on success. This must
+  // be called before the object can be used.
+  bool Init(const webkit::npapi::WebPluginInfo& info, const std::string& locale);
+
+  // Force the plugin process to shutdown (cleanly).
+  virtual void ForceShutdown();
+
+  virtual bool OnMessageReceived(const IPC::Message& msg);
+  virtual void OnChannelConnected(int32 peer_pid);
+  virtual void OnChannelError();
+
+  // ResolveProxyMsgHelper::Delegate implementation:
+  virtual void OnResolveProxyCompleted(IPC::Message* reply_msg,
+                                       int result,
+                                       const std::string& proxy_list);
+
+  // Tells the plugin process to create a new channel for communication with a
+  // renderer.  When the plugin process responds with the channel name,
+  // OnChannelOpened in the client is called.
+  void OpenChannelToPlugin(Client* client);
+
+  // This function is called on the IO thread once we receive a reply from the
+  // modal HTML dialog (in the form of a JSON string). This function forwards
+  // that reply back to the plugin that requested the dialog.
+  void OnModalDialogResponse(const std::string& json_retval,
+                             IPC::Message* sync_result);
+
+#if defined(OS_MACOSX)
+  // This function is called on the IO thread when the browser becomes the
+  // active application.
+  void OnAppActivation();
+#endif
+
+  const webkit::npapi::WebPluginInfo& info() const { return info_; }
+
+#if defined(OS_WIN)
+  // Tracks plugin parent windows created on the browser UI thread.
+  void AddWindow(HWND window);
+#endif
+
+ private:
+  friend class PluginResolveProxyHelper;
+
+  // Sends a message to the plugin process to request creation of a new channel
+  // for the given mime type.
+  void RequestPluginChannel(Client* client);
+
+  virtual void OnProcessLaunched();
+
+  // Message handlers.
+  void OnChannelCreated(const IPC::ChannelHandle& channel_handle);
+  void OnGetPluginFinderUrl(std::string* plugin_finder_url);
+  void OnGetCookies(uint32 request_context, const GURL& url,
+                    std::string* cookies);
+  void OnAccessFiles(int renderer_id, const std::vector<std::string>& files,
+                     bool* allowed);
+  void OnResolveProxy(const GURL& url, IPC::Message* reply_msg);
+  void OnPluginMessage(const std::vector<uint8>& data);
+
+#if defined(OS_WIN)
+  void OnPluginWindowDestroyed(HWND window, HWND parent);
+  void OnDownloadUrl(const std::string& url, int source_child_unique_id,
+                     gfx::NativeWindow caller_window);
+#endif
+
+#if defined(USE_X11)
+  void OnMapNativeViewId(gfx::NativeViewId id, gfx::PluginWindowHandle* output);
+#endif
+
+#if defined(OS_MACOSX)
+  void OnPluginSelectWindow(uint32 window_id, gfx::Rect window_rect,
+                            bool modal);
+  void OnPluginShowWindow(uint32 window_id, gfx::Rect window_rect,
+                          bool modal);
+  void OnPluginHideWindow(uint32 window_id, gfx::Rect window_rect);
+  void OnPluginSetCursorVisibility(bool visible);
+#endif
+
+  virtual bool CanShutdown();
+
+  void CancelRequests();
+
+  // These are channel requests that we are waiting to send to the
+  // plugin process once the channel is opened.
+  std::vector<Client*> pending_requests_;
+
+  // These are the channel requests that we have already sent to
+  // the plugin process, but haven't heard back about yet.
+  std::queue<Client*> sent_requests_;
+
+  // Information about the plugin.
+  webkit::npapi::WebPluginInfo info_;
+
+  // Helper class for handling PluginProcessHost_ResolveProxy messages (manages
+  // the requests to the proxy service).
+  ResolveProxyMsgHelper resolve_proxy_msg_helper_;
+
+#if defined(OS_WIN)
+  // Tracks plugin parent windows created on the UI thread.
+  std::set<HWND> plugin_parent_windows_set_;
+#endif
+#if defined(OS_MACOSX)
+  // Tracks plugin windows currently visible.
+  std::set<uint32> plugin_visible_windows_set_;
+  // Tracks full screen windows currently visible.
+  std::set<uint32> plugin_fullscreen_windows_set_;
+  // Tracks modal windows currently visible.
+  std::set<uint32> plugin_modal_windows_set_;
+  // Tracks the current visibility of the cursor.
+  bool plugin_cursor_visible_;
+#endif
+
+  DISALLOW_COPY_AND_ASSIGN(PluginProcessHost);
+};
+
+#endif  // CONTENT_BROWSER_PLUGIN_PROCESS_HOST_H_
diff --git a/chrome/browser/plugin_process_host_mac.cc b/content/browser/plugin_process_host_mac.cc
similarity index 97%
rename from chrome/browser/plugin_process_host_mac.cc
rename to content/browser/plugin_process_host_mac.cc
index 18616fd..b329f2b 100644
--- a/chrome/browser/plugin_process_host_mac.cc
+++ b/content/browser/plugin_process_host_mac.cc
@@ -10,9 +10,9 @@
 
 #include "base/logging.h"
 #include "base/mac/mac_util.h"
-#include "chrome/browser/browser_thread.h"
-#include "chrome/browser/plugin_process_host.h"
 #include "chrome/common/plugin_messages.h"
+#include "content/browser/browser_thread.h"
+#include "content/browser/plugin_process_host.h"
 #include "ui/gfx/rect.h"
 
 void PluginProcessHost::OnPluginSelectWindow(uint32 window_id,
diff --git a/chrome/browser/plugin_service.cc b/content/browser/plugin_service.cc
similarity index 98%
rename from chrome/browser/plugin_service.cc
rename to content/browser/plugin_service.cc
index 8abeee6..756dbac 100644
--- a/chrome/browser/plugin_service.cc
+++ b/content/browser/plugin_service.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 "chrome/browser/plugin_service.h"
+#include "content/browser/plugin_service.h"
 
 #include <vector>
 
@@ -14,14 +14,11 @@
 #include "base/values.h"
 #include "base/synchronization/waitable_event.h"
 #include "chrome/browser/browser_process.h"
-#include "chrome/browser/browser_thread.h"
 #include "chrome/browser/chrome_plugin_host.h"
 #include "chrome/browser/extensions/extension_service.h"
 #include "chrome/browser/plugin_updater.h"
 #include "chrome/browser/ppapi_plugin_process_host.h"
 #include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/renderer_host/render_process_host.h"
-#include "chrome/browser/renderer_host/render_view_host.h"
 #include "chrome/common/chrome_plugin_lib.h"
 #include "chrome/common/chrome_paths.h"
 #include "chrome/common/chrome_switches.h"
@@ -34,6 +31,9 @@
 #include "chrome/common/pepper_plugin_registry.h"
 #include "chrome/common/plugin_messages.h"
 #include "chrome/common/render_messages.h"
+#include "content/browser/browser_thread.h"
+#include "content/browser/renderer_host/render_process_host.h"
+#include "content/browser/renderer_host/render_view_host.h"
 #include "webkit/plugins/npapi/plugin_constants_win.h"
 #include "webkit/plugins/npapi/plugin_list.h"
 #include "webkit/plugins/npapi/webplugininfo.h"
diff --git a/content/browser/plugin_service.h b/content/browser/plugin_service.h
new file mode 100644
index 0000000..f9bc49cd
--- /dev/null
+++ b/content/browser/plugin_service.h
@@ -0,0 +1,232 @@
+// 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 class responds to requests from renderers for the list of plugins, and
+// also a proxy object for plugin instances.
+
+#ifndef CONTENT_BROWSER_PLUGIN_SERVICE_H_
+#define CONTENT_BROWSER_PLUGIN_SERVICE_H_
+#pragma once
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/file_path.h"
+#include "base/hash_tables.h"
+#include "base/scoped_vector.h"
+#include "base/singleton.h"
+#include "base/synchronization/lock.h"
+#include "base/synchronization/waitable_event_watcher.h"
+#include "build/build_config.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "content/browser/plugin_process_host.h"
+#include "content/browser/ppapi_plugin_process_host.h"
+#include "googleurl/src/gurl.h"
+#include "ipc/ipc_channel_handle.h"
+#include "webkit/plugins/npapi/webplugininfo.h"
+
+#if defined(OS_WIN)
+#include "base/scoped_ptr.h"
+#include "base/win/registry.h"
+#endif
+
+#if defined(OS_LINUX)
+#include "chrome/browser/file_path_watcher/file_path_watcher.h"
+#endif
+
+#if defined(OS_CHROMEOS)
+namespace chromeos {
+class PluginSelectionPolicy;
+}
+#endif
+
+namespace IPC {
+class Message;
+}
+
+class MessageLoop;
+struct PepperPluginInfo;
+class PluginDirWatcherDelegate;
+class Profile;
+class ResourceDispatcherHost;
+
+namespace net {
+class URLRequestContext;
+}  // namespace net
+
+// This must be created on the main thread but it's only called on the IO/file
+// thread.
+class PluginService
+    : public base::WaitableEventWatcher::Delegate,
+      public NotificationObserver {
+ public:
+  struct OverriddenPlugin {
+    int render_process_id;
+    int render_view_id;
+    GURL url;
+    webkit::npapi::WebPluginInfo plugin;
+  };
+
+  // Initializes the global instance; should be called on startup from the main
+  // thread.
+  static void InitGlobalInstance(Profile* profile);
+
+  // Returns the PluginService singleton.
+  static PluginService* GetInstance();
+
+  // Load all the plugins that should be loaded for the lifetime of the browser
+  // (ie, with the LoadOnStartup flag set).
+  void LoadChromePlugins(ResourceDispatcherHost* resource_dispatcher_host);
+
+  // Sets/gets the data directory that Chrome plugins should use to store
+  // persistent data.
+  void SetChromePluginDataDir(const FilePath& data_dir);
+  const FilePath& GetChromePluginDataDir();
+
+  // Gets the browser's UI locale.
+  const std::string& GetUILocale();
+
+  // Returns the plugin process host corresponding to the plugin process that
+  // has been started by this service. Returns NULL if no process has been
+  // started.
+  PluginProcessHost* FindNpapiPluginProcess(const FilePath& plugin_path);
+  PpapiPluginProcessHost* FindPpapiPluginProcess(const FilePath& plugin_path);
+
+  // Returns the plugin process host corresponding to the plugin process that
+  // has been started by this service. This will start a process to host the
+  // 'plugin_path' if needed. If the process fails to start, the return value
+  // is NULL. Must be called on the IO thread.
+  PluginProcessHost* FindOrStartNpapiPluginProcess(
+      const FilePath& plugin_path);
+  PpapiPluginProcessHost* FindOrStartPpapiPluginProcess(
+      const FilePath& plugin_path);
+
+  // Opens a channel to a plugin process for the given mime type, starting
+  // a new plugin process if necessary.  This must be called on the IO thread
+  // or else a deadlock can occur.
+  void OpenChannelToNpapiPlugin(int render_process_id,
+                                int render_view_id,
+                                const GURL& url,
+                                const std::string& mime_type,
+                                PluginProcessHost::Client* client);
+  void OpenChannelToPpapiPlugin(const FilePath& path,
+                                PpapiPluginProcessHost::Client* client);
+
+  // Gets the first allowed plugin in the list of plugins that matches
+  // the given url and mime type.  Must be called on the FILE thread.
+  bool GetFirstAllowedPluginInfo(int render_process_id,
+                                 int render_view_id,
+                                 const GURL& url,
+                                 const std::string& mime_type,
+                                 webkit::npapi::WebPluginInfo* info,
+                                 std::string* actual_mime_type);
+
+  // Returns true if the given plugin is allowed to be used by a page with
+  // the given URL.
+  bool PrivatePluginAllowedForURL(const FilePath& plugin_path, const GURL& url);
+
+  // Safe to be called from any thread.
+  void OverridePluginForTab(OverriddenPlugin plugin);
+
+  // The UI thread's message loop
+  MessageLoop* main_message_loop() { return main_message_loop_; }
+
+  ResourceDispatcherHost* resource_dispatcher_host() const {
+    return resource_dispatcher_host_;
+  }
+
+  static void EnableChromePlugins(bool enable);
+
+ private:
+  friend struct DefaultSingletonTraits<PluginService>;
+
+  // Creates the PluginService object, but doesn't actually build the plugin
+  // list yet.  It's generated lazily.
+  PluginService();
+  ~PluginService();
+
+  // base::WaitableEventWatcher::Delegate implementation.
+  virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event);
+
+  // NotificationObserver implementation
+  virtual void Observe(NotificationType type, const NotificationSource& source,
+                       const NotificationDetails& details);
+
+  void RegisterPepperPlugins();
+
+  // Helper so we can do the plugin lookup on the FILE thread.
+  void GetAllowedPluginForOpenChannelToPlugin(
+      int render_process_id,
+      int render_view_id,
+      const GURL& url,
+      const std::string& mime_type,
+      PluginProcessHost::Client* client);
+
+  // Helper so we can finish opening the channel after looking up the
+  // plugin.
+  void FinishOpenChannelToPlugin(
+      const FilePath& plugin_path,
+      PluginProcessHost::Client* client);
+
+#if defined(OS_LINUX)
+  // Registers a new FilePathWatcher for a given path.
+  static void RegisterFilePathWatcher(
+      FilePathWatcher* watcher,
+      const FilePath& path,
+      FilePathWatcher::Delegate* delegate);
+#endif
+
+  // The main thread's message loop.
+  MessageLoop* main_message_loop_;
+
+  // The IO thread's resource dispatcher host.
+  ResourceDispatcherHost* resource_dispatcher_host_;
+
+  // The data directory that Chrome plugins should use to store persistent data.
+  FilePath chrome_plugin_data_dir_;
+
+  // The browser's UI locale.
+  const std::string ui_locale_;
+
+  // Map of plugin paths to the origin they are restricted to.  Used for
+  // extension-only plugins.
+  typedef base::hash_map<FilePath, GURL> PrivatePluginMap;
+  PrivatePluginMap private_plugins_;
+
+  NotificationRegistrar registrar_;
+
+#if defined(OS_CHROMEOS)
+  scoped_refptr<chromeos::PluginSelectionPolicy> plugin_selection_policy_;
+#endif
+
+#if defined(OS_WIN)
+  // Registry keys for getting notifications when new plugins are installed.
+  base::win::RegKey hkcu_key_;
+  base::win::RegKey hklm_key_;
+  scoped_ptr<base::WaitableEvent> hkcu_event_;
+  scoped_ptr<base::WaitableEvent> hklm_event_;
+  base::WaitableEventWatcher hkcu_watcher_;
+  base::WaitableEventWatcher hklm_watcher_;
+#endif
+
+#if defined(OS_LINUX)
+  ScopedVector<FilePathWatcher> file_watchers_;
+  scoped_refptr<PluginDirWatcherDelegate> file_watcher_delegate_;
+#endif
+
+  std::vector<PepperPluginInfo> ppapi_plugins_;
+
+  // Set to true if chrome plugins are enabled. Defaults to true.
+  static bool enable_chrome_plugins_;
+
+  std::vector<OverriddenPlugin> overridden_plugins_;
+  base::Lock overridden_plugins_lock_;
+
+  DISALLOW_COPY_AND_ASSIGN(PluginService);
+};
+
+DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService);
+
+#endif  // CONTENT_BROWSER_PLUGIN_SERVICE_H_
diff --git a/chrome/browser/plugin_service_browsertest.cc b/content/browser/plugin_service_browsertest.cc
similarity index 97%
rename from chrome/browser/plugin_service_browsertest.cc
rename to content/browser/plugin_service_browsertest.cc
index ee1be0c..2a0edb5 100644
--- a/chrome/browser/plugin_service_browsertest.cc
+++ b/content/browser/plugin_service_browsertest.cc
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "chrome/browser/plugin_service.h"
+#include "content/browser/plugin_service.h"
 
 #include "base/auto_reset.h"
 #include "base/command_line.h"
-#include "chrome/browser/browser_thread.h"
 #include "chrome/test/in_process_browser_test.h"
 #include "chrome/test/testing_profile.h"
+#include "content/browser/browser_thread.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "webkit/plugins/npapi/plugin_list.h"
diff --git a/chrome/browser/plugin_service_unittest.cc b/content/browser/plugin_service_unittest.cc
similarity index 95%
rename from chrome/browser/plugin_service_unittest.cc
rename to content/browser/plugin_service_unittest.cc
index 6950d2a..0fbde87 100644
--- a/chrome/browser/plugin_service_unittest.cc
+++ b/content/browser/plugin_service_unittest.cc
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "chrome/browser/plugin_service.h"
+#include "content/browser/plugin_service.h"
 
 #include "base/auto_reset.h"
 #include "base/command_line.h"
-#include "chrome/browser/browser_thread.h"
 #include "chrome/test/testing_profile.h"
+#include "content/browser/browser_thread.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace {
diff --git a/chrome/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc
similarity index 97%
rename from chrome/browser/ppapi_plugin_process_host.cc
rename to content/browser/ppapi_plugin_process_host.cc
index c319dd07..def01b7d 100644
--- a/chrome/browser/ppapi_plugin_process_host.cc
+++ b/content/browser/ppapi_plugin_process_host.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "chrome/browser/ppapi_plugin_process_host.h"
+#include "content/browser/ppapi_plugin_process_host.h"
 
 #include "base/command_line.h"
 #include "base/file_path.h"
 #include "base/process_util.h"
-#include "chrome/browser/plugin_service.h"
-#include "chrome/browser/renderer_host/render_message_filter.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/render_messages.h"
+#include "content/browser/plugin_service.h"
+#include "content/browser/renderer_host/render_message_filter.h"
 #include "ipc/ipc_switches.h"
 #include "ppapi/proxy/ppapi_messages.h"
 
diff --git a/content/browser/ppapi_plugin_process_host.h b/content/browser/ppapi_plugin_process_host.h
new file mode 100644
index 0000000..baeaf3b
--- /dev/null
+++ b/content/browser/ppapi_plugin_process_host.h
@@ -0,0 +1,78 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
+#define CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
+#pragma once
+
+#include <queue>
+
+#include "base/basictypes.h"
+#include "base/file_path.h"
+#include "content/browser/browser_child_process_host.h"
+
+class PpapiPluginProcessHost : public BrowserChildProcessHost {
+ public:
+  class Client {
+   public:
+    // Gets the information about the renderer that's requesting the channel.
+    virtual void GetChannelInfo(base::ProcessHandle* renderer_handle,
+                                int* renderer_id) = 0;
+
+    // Called when the channel is asynchronously opened to the plugin or on
+    // error. On error, the parameters should be:
+    //   base::kNullProcessHandle
+    //   IPC::ChannelHandle()
+    virtual void OnChannelOpened(base::ProcessHandle plugin_process_handle,
+                                 const IPC::ChannelHandle& channel_handle) = 0;
+  };
+
+  // You must call init before doing anything else.
+  explicit PpapiPluginProcessHost();
+  virtual ~PpapiPluginProcessHost();
+
+  // Actually launches the process with the given plugin path. Returns true
+  // on success (the process was spawned).
+  bool Init(const FilePath& path);
+
+  // Opens a new channel to the plugin. The client will be notified when the
+  // channel is ready or if there's an error.
+  void OpenChannelToPlugin(Client* client);
+
+  const FilePath& plugin_path() const { return plugin_path_; }
+
+  // The client pointer must remain valid until its callback is issued.
+
+ private:
+
+  void RequestPluginChannel(Client* client);
+
+  virtual bool CanShutdown();
+  virtual void OnProcessLaunched();
+
+  virtual bool OnMessageReceived(const IPC::Message& msg);
+  virtual void OnChannelConnected(int32 peer_pid);
+  virtual void OnChannelError();
+
+  void CancelRequests();
+
+  // IPC message handlers.
+  void OnRendererPluginChannelCreated(const IPC::ChannelHandle& handle);
+
+  // Channel requests that we are waiting to send to the plugin process once
+  // the channel is opened.
+  std::vector<Client*> pending_requests_;
+
+  // Channel requests that we have already sent to the plugin process, but
+  // haven't heard back about yet.
+  std::queue<Client*> sent_requests_;
+
+  // Path to the plugin library.
+  FilePath plugin_path_;
+
+  DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost);
+};
+
+#endif  // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
+
diff --git a/chrome/browser/worker.sb b/content/browser/worker.sb
similarity index 100%
rename from chrome/browser/worker.sb
rename to content/browser/worker.sb
diff --git a/chrome/browser/zygote_host_linux.cc b/content/browser/zygote_host_linux.cc
similarity index 98%
rename from chrome/browser/zygote_host_linux.cc
rename to content/browser/zygote_host_linux.cc
index ad6b0726..3b6f1fb 100644
--- a/chrome/browser/zygote_host_linux.cc
+++ b/content/browser/zygote_host_linux.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "chrome/browser/zygote_host_linux.h"
+#include "content/browser/zygote_host_linux.h"
 
 #include <sys/socket.h>
 #include <sys/stat.h>
@@ -21,12 +21,12 @@
 #include "base/string_util.h"
 #include "base/scoped_ptr.h"
 #include "base/utf_string_conversions.h"
-#include "chrome/browser/renderer_host/render_sandbox_host_linux.h"
 #include "chrome/common/chrome_constants.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/process_watcher.h"
 #include "chrome/common/result_codes.h"
 #include "chrome/common/unix_domain_socket_posix.h"
+#include "content/browser/renderer_host/render_sandbox_host_linux.h"
 #include "sandbox/linux/suid/suid_unsafe_environment_variables.h"
 
 static void SaveSUIDUnsafeEnvironmentVariables() {
diff --git a/content/browser/zygote_host_linux.h b/content/browser/zygote_host_linux.h
new file mode 100644
index 0000000..5ead5f59
--- /dev/null
+++ b/content/browser/zygote_host_linux.h
@@ -0,0 +1,98 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_
+#define CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_
+#pragma once
+
+#include <unistd.h>
+
+#include <string>
+#include <vector>
+
+#include "base/global_descriptors_posix.h"
+#include "base/process.h"
+#include "base/process_util.h"
+#include "base/synchronization/lock.h"
+
+template<typename Type>
+struct DefaultSingletonTraits;
+
+static const char kZygoteMagic[] = "ZYGOTE_OK";
+
+// http://code.google.com/p/chromium/wiki/LinuxZygote
+
+// The zygote host is the interface, in the browser process, to the zygote
+// process.
+class ZygoteHost {
+ public:
+  // Returns the singleton instance.
+  static ZygoteHost* GetInstance();
+
+  void Init(const std::string& sandbox_cmd);
+
+  // Tries to start a renderer process.  Returns its pid on success, otherwise
+  // base::kNullProcessHandle;
+  pid_t ForkRenderer(const std::vector<std::string>& command_line,
+                     const base::GlobalDescriptors::Mapping& mapping);
+  void EnsureProcessTerminated(pid_t process);
+
+  // Get the termination status (and, optionally, the exit code) of
+  // the process. |exit_code| is set to the exit code of the child
+  // process. (|exit_code| may be NULL.)
+  base::TerminationStatus GetTerminationStatus(base::ProcessHandle handle,
+                                               int* exit_code);
+
+  // These are the command codes used on the wire between the browser and the
+  // zygote.
+  enum {
+    kCmdFork = 0,                  // Fork off a new renderer.
+    kCmdReap = 1,                  // Reap a renderer child.
+    kCmdGetTerminationStatus = 2,  // Check what happend to a child process.
+    kCmdGetSandboxStatus = 3,      // Read a bitmask of kSandbox*
+  };
+
+  // These form a bitmask which describes the conditions of the sandbox that
+  // the zygote finds itself in.
+  enum {
+    kSandboxSUID = 1 << 0,     // SUID sandbox active
+    kSandboxPIDNS = 1 << 1,    // SUID sandbox is using the PID namespace
+    kSandboxNetNS = 1 << 2,    // SUID sandbox is using the network namespace
+    kSandboxSeccomp = 1 << 3,  // seccomp sandbox active.
+  };
+
+  pid_t pid() const { return pid_; }
+
+  // Returns an int which is a bitmask of kSandbox* values. Only valid after
+  // the first render has been forked.
+  int sandbox_status() const {
+    if (have_read_sandbox_status_word_)
+      return sandbox_status_;
+    return 0;
+  }
+
+  // Adjust the OOM score of the given renderer's PID.
+  void AdjustRendererOOMScore(base::ProcessHandle process_handle, int score);
+
+ private:
+  friend struct DefaultSingletonTraits<ZygoteHost>;
+  ZygoteHost();
+  ~ZygoteHost();
+
+  ssize_t ReadReply(void* buf, size_t buflen);
+
+  int control_fd_;  // the socket to the zygote
+  // A lock protecting all communication with the zygote. This lock must be
+  // acquired before sending a command and released after the result has been
+  // received.
+  base::Lock control_lock_;
+  pid_t pid_;
+  bool init_;
+  bool using_suid_sandbox_;
+  std::string sandbox_binary_;
+  bool have_read_sandbox_status_word_;
+  int sandbox_status_;
+};
+
+#endif  // CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_
diff --git a/chrome/browser/zygote_main_linux.cc b/content/browser/zygote_main_linux.cc
similarity index 99%
rename from chrome/browser/zygote_main_linux.cc
rename to content/browser/zygote_main_linux.cc
index b03e59c..188ad34 100644
--- a/chrome/browser/zygote_main_linux.cc
+++ b/content/browser/zygote_main_linux.cc
@@ -19,6 +19,8 @@
 #include <selinux/context.h>
 #endif
 
+#include "content/browser/zygote_host_linux.h"
+
 #include "base/basictypes.h"
 #include "base/command_line.h"
 #include "base/eintr_wrapper.h"
@@ -33,7 +35,6 @@
 #include "base/scoped_ptr.h"
 #include "base/sys_info.h"
 #include "build/build_config.h"
-#include "chrome/browser/zygote_host_linux.h"
 #include "chrome/common/chrome_descriptors.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/font_config_ipc_linux.h"
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 4a5a09a..f497bf5 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -46,6 +46,23 @@
         'browser/cross_site_request_manager.h',
         'browser/disposition_utils.cc',
         'browser/disposition_utils.h',
+        'browser/gpu_blacklist.cc',
+        'browser/gpu_blacklist.h',
+        'browser/gpu_process_host.cc',
+        'browser/gpu_process_host.h',
+        'browser/host_zoom_map.cc',
+        'browser/host_zoom_map.h',
+        'browser/mime_registry_message_filter.cc',
+        'browser/mime_registry_message_filter.h',
+        'browser/modal_html_dialog_delegate.cc',
+        'browser/modal_html_dialog_delegate.h',
+        'browser/ppapi_plugin_process_host.cc',
+        'browser/ppapi_plugin_process_host.h',
+        'browser/plugin_process_host.cc',
+        'browser/plugin_process_host.h',
+        'browser/plugin_process_host_mac.cc',
+        'browser/plugin_service.cc',
+        'browser/plugin_service.h',
         'browser/renderer_host/accelerated_surface_container_mac.cc',
         'browser/renderer_host/accelerated_surface_container_mac.h',
         'browser/renderer_host/accelerated_surface_container_manager_mac.cc',
@@ -156,6 +173,9 @@
         'browser/tab_contents/tab_contents_observer.h',
         'browser/tab_contents/tab_contents_view.cc',
         'browser/tab_contents/tab_contents_view.h',
+        'browser/zygote_host_linux.cc',
+        'browser/zygote_host_linux.h',
+        'browser/zygote_main_linux.cc',
       ],
       'conditions': [
         ['OS=="win"', {
@@ -177,6 +197,14 @@
             'browser/certificate_manager_model.h',
           ],
         }],
+        ['OS=="mac"', {
+          'link_settings': {
+            'mac_bundle_resources': [
+              'browser/gpu.sb',
+              'browser/worker.sb',
+            ],
+          },
+        }],
       ],
     },
   ],