Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(731)

Unified Diff: content/browser/plugin_loader.h

Issue 8243010: Queue callbacks in PluginService::GetPlugins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/plugin_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « no previous file | content/browser/plugin_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698