Index: content/browser/plugin_loader.h |
diff --git a/content/browser/plugin_loader.h b/content/browser/plugin_loader.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..23caa10c03192677d4380ef73e1f885bc6ff6e71 |
--- /dev/null |
+++ b/content/browser/plugin_loader.h |
@@ -0,0 +1,58 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_PLUGIN_LOADER_H_ |
+#define CONTENT_BROWSER_PLUGIN_LOADER_H_ |
+ |
+#include <vector> |
+ |
+#include "base/memory/ref_counted.h" |
+#include "content/browser/plugin_service.h" |
+#include "content/browser/utility_process_host.h" |
+ |
+namespace base { |
+class MessageLoopProxy; |
+} |
+ |
+namespace webkit { |
+struct WebPluginInfo; |
+} |
+ |
+// Utility child process client that manages the IPC for loading plugins out of |
+// process. |
+class PluginLoader : public UtilityProcessHost::Client { |
+ public: |
+ PluginLoader(); |
+ virtual ~PluginLoader() OVERRIDE; |
+ |
+ // Meant to be called on the IO thread. Will invoke the callback on the target |
+ // loop when the plugins have been loaded. |
+ void LoadPlugins(base::MessageLoopProxy* target_loop, |
+ const PluginService::GetPluginsCallback& callback); |
+ |
+ // UtilityProcessHost::Client implementation: |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ virtual void OnProcessCrashed(int exit_code) OVERRIDE; |
+ |
+ private: |
+ struct PendingCallback { |
+ PendingCallback(scoped_refptr<base::MessageLoopProxy> loop, |
+ const PluginService::GetPluginsCallback& callback); |
+ ~PendingCallback(); |
+ |
+ scoped_refptr<base::MessageLoopProxy> target_loop; |
+ PluginService::GetPluginsCallback callback; |
+ }; |
+ |
+ void StartLoadingIfNecessary(); |
+ |
+ void OnGotPlugins(const std::vector<webkit::WebPluginInfo>& plugins); |
+ |
+ UtilityProcessHost* process_host_; |
+ std::vector<PendingCallback> callbacks_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(PluginLoader); |
+}; |
+ |
+#endif // CONTENT_BROWSER_PLUGIN_LOADER_H_ |