Index: content/renderer/browser_plugin/browser_plugin_channel_manager.h |
diff --git a/content/renderer/browser_plugin/browser_plugin_channel_manager.h b/content/renderer/browser_plugin/browser_plugin_channel_manager.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5c8a93147ddf85aeb669f878e64265020b234773 |
--- /dev/null |
+++ b/content/renderer/browser_plugin/browser_plugin_channel_manager.h |
@@ -0,0 +1,67 @@ |
+// Copyright (c) 2012 The Chromium 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_BROWSER_PLUGIN_CHANNEL_MANAGER_H_ |
+#define CONTENT_RENDERER_BROWSER_PLUGIN_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/guest_to_embedder_channel.h" |
+#include "content/renderer/render_view_impl.h" |
+ |
+class GuestToEmbedderChannel; |
+struct ViewMsg_New_Params; |
+ |
+namespace content { |
+ |
+class BrowserPluginChannelManager |
jam
2012/05/16 02:22:40
add a comment about the purpose of this class, so
Fady Samuel
2012/05/16 04:43:54
Done.
|
+ : public RenderProcessObserver, |
+ public base::RefCountedThreadSafe<BrowserPluginChannelManager> { |
jam
2012/05/16 02:22:40
why is this refcounted, and especially thread-safe
Fady Samuel
2012/05/16 04:43:54
It doesn't need to be. Fixed.
|
+ public: |
+ BrowserPluginChannelManager(); |
+ |
+ ~BrowserPluginChannelManager() { } |
+ |
+ void CreateRenderView(const ViewMsg_New_Params& params); |
+ |
+ // Sends an IPC message to the browser process. |
+ bool Send(IPC::Message* message); |
+ |
+ // 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); |
+ |
+ private: |
+ typedef std::map<std::string, scoped_refptr<GuestToEmbedderChannel> > |
+ EmbedderChannelNameToChannelMap; |
+ |
+ void OnCompleteNavigation(int guest_routing_id, |
+ PP_Instance instance); |
+ |
+ void OnLoadGuest(int instance_id, |
+ int guest_renderer_id, |
+ const IPC::ChannelHandle& channel_handle); |
+ |
+ // RenderProcessObserver override. Call on render thread. |
+ virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; |
+ |
+ // Map from Host process ID to GuestToEmbedderChannel |
+ EmbedderChannelNameToChannelMap embedder_channels_; |
+ |
+ std::map<int, base::WeakPtr<RenderViewImpl> > pending_navigations_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BrowserPluginChannelManager); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_CHANNEL_MANAGER_H_ |
jam
2012/05/16 02:22:40
nit: two spaces before comment
Fady Samuel
2012/05/16 04:43:54
Done.
|