| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ | 5 #ifndef CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ |
| 6 #define CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ | 6 #define CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 class BrokerClient : public Client { | 70 class BrokerClient : public Client { |
| 71 protected: | 71 protected: |
| 72 virtual ~BrokerClient() {} | 72 virtual ~BrokerClient() {} |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 virtual ~PpapiPluginProcessHost(); | 75 virtual ~PpapiPluginProcessHost(); |
| 76 | 76 |
| 77 static PpapiPluginProcessHost* CreatePluginHost( | 77 static PpapiPluginProcessHost* CreatePluginHost( |
| 78 const PepperPluginInfo& info, | 78 const PepperPluginInfo& info, |
| 79 const FilePath& profile_data_directory, | 79 const base::FilePath& profile_data_directory, |
| 80 net::HostResolver* host_resolver); | 80 net::HostResolver* host_resolver); |
| 81 static PpapiPluginProcessHost* CreateBrokerHost( | 81 static PpapiPluginProcessHost* CreateBrokerHost( |
| 82 const PepperPluginInfo& info); | 82 const PepperPluginInfo& info); |
| 83 | 83 |
| 84 // Notification that a PP_Instance has been created and the associated | 84 // Notification that a PP_Instance has been created and the associated |
| 85 // renderer related data including the RenderView/Process pair for the given | 85 // renderer related data including the RenderView/Process pair for the given |
| 86 // plugin. This is necessary so that when the plugin calls us with a | 86 // plugin. This is necessary so that when the plugin calls us with a |
| 87 // PP_Instance we can find the RenderView associated with it without trusting | 87 // PP_Instance we can find the RenderView associated with it without trusting |
| 88 // the plugin. | 88 // the plugin. |
| 89 static void DidCreateOutOfProcessInstance( | 89 static void DidCreateOutOfProcessInstance( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 100 static void FindByName(const string16& name, | 100 static void FindByName(const string16& name, |
| 101 std::vector<PpapiPluginProcessHost*>* hosts); | 101 std::vector<PpapiPluginProcessHost*>* hosts); |
| 102 | 102 |
| 103 // IPC::Sender implementation: | 103 // IPC::Sender implementation: |
| 104 virtual bool Send(IPC::Message* message) OVERRIDE; | 104 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 105 | 105 |
| 106 // Opens a new channel to the plugin. The client will be notified when the | 106 // Opens a new channel to the plugin. The client will be notified when the |
| 107 // channel is ready or if there's an error. | 107 // channel is ready or if there's an error. |
| 108 void OpenChannelToPlugin(Client* client); | 108 void OpenChannelToPlugin(Client* client); |
| 109 | 109 |
| 110 const FilePath& plugin_path() const { return plugin_path_; } | 110 const base::FilePath& plugin_path() const { return plugin_path_; } |
| 111 const FilePath& profile_data_directory() const { | 111 const base::FilePath& profile_data_directory() const { |
| 112 return profile_data_directory_; | 112 return profile_data_directory_; |
| 113 } | 113 } |
| 114 | 114 |
| 115 // The client pointer must remain valid until its callback is issued. | 115 // The client pointer must remain valid until its callback is issued. |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 class PluginNetworkObserver; | 118 class PluginNetworkObserver; |
| 119 | 119 |
| 120 // Constructors for plugin and broker process hosts, respectively. | 120 // Constructors for plugin and broker process hosts, respectively. |
| 121 // You must call Init before doing anything else. | 121 // You must call Init before doing anything else. |
| 122 PpapiPluginProcessHost(const PepperPluginInfo& info, | 122 PpapiPluginProcessHost(const PepperPluginInfo& info, |
| 123 const FilePath& profile_data_directory, | 123 const base::FilePath& profile_data_directory, |
| 124 net::HostResolver* host_resolver); | 124 net::HostResolver* host_resolver); |
| 125 PpapiPluginProcessHost(); | 125 PpapiPluginProcessHost(); |
| 126 | 126 |
| 127 // Actually launches the process with the given plugin info. Returns true | 127 // Actually launches the process with the given plugin info. Returns true |
| 128 // on success (the process was spawned). | 128 // on success (the process was spawned). |
| 129 bool Init(const PepperPluginInfo& info); | 129 bool Init(const PepperPluginInfo& info); |
| 130 | 130 |
| 131 void RequestPluginChannel(Client* client); | 131 void RequestPluginChannel(Client* client); |
| 132 | 132 |
| 133 virtual void OnProcessLaunched() OVERRIDE; | 133 virtual void OnProcessLaunched() OVERRIDE; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 153 | 153 |
| 154 // Channel requests that we are waiting to send to the plugin process once | 154 // Channel requests that we are waiting to send to the plugin process once |
| 155 // the channel is opened. | 155 // the channel is opened. |
| 156 std::vector<Client*> pending_requests_; | 156 std::vector<Client*> pending_requests_; |
| 157 | 157 |
| 158 // Channel requests that we have already sent to the plugin process, but | 158 // Channel requests that we have already sent to the plugin process, but |
| 159 // haven't heard back about yet. | 159 // haven't heard back about yet. |
| 160 std::queue<Client*> sent_requests_; | 160 std::queue<Client*> sent_requests_; |
| 161 | 161 |
| 162 // Path to the plugin library. | 162 // Path to the plugin library. |
| 163 FilePath plugin_path_; | 163 base::FilePath plugin_path_; |
| 164 | 164 |
| 165 // Path to the top-level plugin data directory (differs based upon profile). | 165 // Path to the top-level plugin data directory (differs based upon profile). |
| 166 FilePath profile_data_directory_; | 166 base::FilePath profile_data_directory_; |
| 167 | 167 |
| 168 const bool is_broker_; | 168 const bool is_broker_; |
| 169 | 169 |
| 170 scoped_ptr<BrowserChildProcessHostImpl> process_; | 170 scoped_ptr<BrowserChildProcessHostImpl> process_; |
| 171 | 171 |
| 172 DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost); | 172 DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost); |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 class PpapiPluginProcessHostIterator | 175 class PpapiPluginProcessHostIterator |
| 176 : public BrowserChildProcessHostTypeIterator< | 176 : public BrowserChildProcessHostTypeIterator< |
| (...skipping 10 matching lines...) Expand all Loading... |
| 187 public: | 187 public: |
| 188 PpapiBrokerProcessHostIterator() | 188 PpapiBrokerProcessHostIterator() |
| 189 : BrowserChildProcessHostTypeIterator< | 189 : BrowserChildProcessHostTypeIterator< |
| 190 PpapiPluginProcessHost>(PROCESS_TYPE_PPAPI_BROKER) {} | 190 PpapiPluginProcessHost>(PROCESS_TYPE_PPAPI_BROKER) {} |
| 191 }; | 191 }; |
| 192 | 192 |
| 193 } // namespace content | 193 } // namespace content |
| 194 | 194 |
| 195 #endif // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ | 195 #endif // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ |
| 196 | 196 |
| OLD | NEW |