Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_CHANNEL_MANAGER_H_ | |
| 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_CHANNEL_MANAGER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <set> | |
| 10 | |
| 11 #include "base/id_map.h" | |
| 12 #include "content/public/renderer/render_process_observer.h" | |
| 13 #include "content/renderer/browser_plugin/guest_to_embedder_channel.h" | |
| 14 #include "content/renderer/render_view_impl.h" | |
| 15 | |
| 16 class GuestToEmbedderChannel; | |
| 17 struct ViewMsg_New_Params; | |
| 18 | |
| 19 namespace content { | |
| 20 | |
| 21 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.
| |
| 22 : public RenderProcessObserver, | |
| 23 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.
| |
| 24 public: | |
| 25 BrowserPluginChannelManager(); | |
| 26 | |
| 27 ~BrowserPluginChannelManager() { } | |
| 28 | |
| 29 void CreateRenderView(const ViewMsg_New_Params& params); | |
| 30 | |
| 31 // Sends an IPC message to the browser process. | |
| 32 bool Send(IPC::Message* message); | |
| 33 | |
| 34 // Get the GuestToEmbedderChannel associated with the given | |
| 35 // embedder_channel_name. | |
| 36 GuestToEmbedderChannel* GetChannelByName( | |
| 37 const std::string& embedder_channel_name); | |
| 38 | |
| 39 // Remove the pointer to the GuestToEmbedderChannel associated with the given | |
| 40 // routing_id. | |
| 41 void RemoveChannelByName(const std::string& embedder_channel_name); | |
| 42 | |
| 43 private: | |
| 44 typedef std::map<std::string, scoped_refptr<GuestToEmbedderChannel> > | |
| 45 EmbedderChannelNameToChannelMap; | |
| 46 | |
| 47 void OnCompleteNavigation(int guest_routing_id, | |
| 48 PP_Instance instance); | |
| 49 | |
| 50 void OnLoadGuest(int instance_id, | |
| 51 int guest_renderer_id, | |
| 52 const IPC::ChannelHandle& channel_handle); | |
| 53 | |
| 54 // RenderProcessObserver override. Call on render thread. | |
| 55 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 56 | |
| 57 // Map from Host process ID to GuestToEmbedderChannel | |
| 58 EmbedderChannelNameToChannelMap embedder_channels_; | |
| 59 | |
| 60 std::map<int, base::WeakPtr<RenderViewImpl> > pending_navigations_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(BrowserPluginChannelManager); | |
| 63 }; | |
| 64 | |
| 65 } // namespace content | |
| 66 | |
| 67 #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.
| |
| OLD | NEW |