summaryrefslogtreecommitdiffstats
path: root/content/renderer/browser_plugin/old/browser_plugin_channel_manager.h
diff options
context:
space:
mode:
authorfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-18 17:15:57 +0000
committerfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-18 17:15:57 +0000
commit14cf0f1e4ecfa9e16b7976895ebbd7fabb4edaae (patch)
tree772d71728c4c3f47b2b8c51157d44f18e34542a9 /content/renderer/browser_plugin/old/browser_plugin_channel_manager.h
parent65f25967dc0907278eb3982aa73f1033df7a1c2b (diff)
downloadchromium_src-14cf0f1e4ecfa9e16b7976895ebbd7fabb4edaae.zip
chromium_src-14cf0f1e4ecfa9e16b7976895ebbd7fabb4edaae.tar.gz
chromium_src-14cf0f1e4ecfa9e16b7976895ebbd7fabb4edaae.tar.bz2
Browser Plugin: Move to old directories
A new implementation is coming but this current implementation is still in use. Moving the current implementation to old directories to make it easy to get rid of once the new implementation has been upstreamed. BUG=none TEST=manually, browser plugin continues to work. Review URL: https://chromiumcodereview.appspot.com/10555029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142743 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/browser_plugin/old/browser_plugin_channel_manager.h')
-rw-r--r--content/renderer/browser_plugin/old/browser_plugin_channel_manager.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/content/renderer/browser_plugin/old/browser_plugin_channel_manager.h b/content/renderer/browser_plugin/old/browser_plugin_channel_manager.h
new file mode 100644
index 0000000..4656139
--- /dev/null
+++ b/content/renderer/browser_plugin/old/browser_plugin_channel_manager.h
@@ -0,0 +1,82 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_BROWSER_PLUGIN_OLD_BROWSER_PLUGIN_CHANNEL_MANAGER_H_
+#define CONTENT_RENDERER_BROWSER_PLUGIN_OLD_BROWSER_PLUGIN_CHANNEL_MANAGER_H_
+#pragma once
+
+#include <set>
+
+#include "base/id_map.h"
+#include "content/public/renderer/render_process_observer.h"
+#include "content/renderer/browser_plugin/old/guest_to_embedder_channel.h"
+#include "content/renderer/render_view_impl.h"
+
+class GuestToEmbedderChannel;
+struct ViewMsg_New_Params;
+
+namespace content {
+
+// BrowserPluginChannelManager manages the lifetime of GuestToEmbedderChannels.
+// When a new RenderView is requested, it checks the embedder channel name
+// in ViewMsg_New_Params and decides whether to reuse an existing channel or
+// create a new channel. On the guest renderer process, it informs a
+// RenderView once a channel has been established with its embedder.
+// On the embedder side, it tells BrowserPlugin to load the guest
+// PluginInstance once a channel has been established.
+class BrowserPluginChannelManager
+ : public RenderProcessObserver {
+ public:
+ BrowserPluginChannelManager();
+
+ virtual ~BrowserPluginChannelManager();
+
+ void CreateRenderView(const ViewMsg_New_Params& params);
+
+ void ReportChannelToEmbedder(
+ RenderViewImpl* render_view,
+ const IPC::ChannelHandle& embedder_channel_handle,
+ const std::string& embedder_channel_name,
+ int embedder_container_id);
+
+ // Get the GuestToEmbedderChannel associated with the given
+ // embedder_channel_name.
+ GuestToEmbedderChannel* GetChannelByName(
+ const std::string& embedder_channel_name);
+
+ // Remove the pointer to the GuestToEmbedderChannel associated with the given
+ // routing_id.
+ void RemoveChannelByName(const std::string& embedder_channel_name);
+
+ void GuestReady(PP_Instance instance,
+ const std::string& embedder_channel_name,
+ int embedder_container_id);
+
+ private:
+ typedef std::map<std::string, scoped_refptr<GuestToEmbedderChannel> >
+ EmbedderChannelNameToChannelMap;
+
+ void OnLoadGuest(int instance_id,
+ int guest_renderer_id,
+ const IPC::ChannelHandle& channel_handle);
+ void OnAdvanceFocus(int instance_id, bool reverse);
+
+ // RenderProcessObserver override. Call on render thread.
+ virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
+
+ // Map from Host process ID to GuestToEmbedderChannel
+ EmbedderChannelNameToChannelMap embedder_channels_;
+
+ // Map from <embedder_channel_name, embedder_container_id> to RenderViewImpl
+ // that points to RenderViewImpl guests that have been constructed but don't
+ // have a PP_Instance and so they aren't yet ready to composite.
+ std::map<std::pair<std::string, int>,
+ base::WeakPtr<RenderViewImpl> > pending_guests_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserPluginChannelManager);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_CHANNEL_MANAGER_H_