| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROKER_PROCESS_HOST_H_ | 5 #ifndef CONTENT_BROWSER_PPAPI_BROKER_PROCESS_HOST_H_ |
| 6 #define CONTENT_BROWSER_PPAPI_BROKER_PROCESS_HOST_H_ | 6 #define CONTENT_BROWSER_PPAPI_BROKER_PROCESS_HOST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <queue> | 9 #include <queue> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "content/browser/browser_child_process_host.h" | 13 #include "content/browser/browser_child_process_host.h" |
| 14 | 14 |
| 15 struct PepperPluginInfo; | 15 namespace webkit { |
| 16 namespace ppapi { |
| 17 struct PluginInfo; |
| 18 } |
| 19 } |
| 16 | 20 |
| 17 // TODO(ddorwin): Consider merging this with PpapiPluginProcessHost after | 21 // TODO(ddorwin): Consider merging this with PpapiPluginProcessHost after |
| 18 // finishing broker implementation. | 22 // finishing broker implementation. |
| 19 class PpapiBrokerProcessHost : public BrowserChildProcessHost { | 23 class PpapiBrokerProcessHost : public BrowserChildProcessHost { |
| 20 public: | 24 public: |
| 21 class Client { | 25 class Client { |
| 22 public: | 26 public: |
| 23 // Gets the information about the renderer that's requesting the channel. | 27 // Gets the information about the renderer that's requesting the channel. |
| 24 virtual void GetChannelInfo(base::ProcessHandle* renderer_handle, | 28 virtual void GetChannelInfo(base::ProcessHandle* renderer_handle, |
| 25 int* renderer_id) = 0; | 29 int* renderer_id) = 0; |
| 26 | 30 |
| 27 // Called when the channel is asynchronously opened to the broker or on | 31 // Called when the channel is asynchronously opened to the broker or on |
| 28 // error. On error, the parameters should be: | 32 // error. On error, the parameters should be: |
| 29 // base::kNullProcessHandle | 33 // base::kNullProcessHandle |
| 30 // IPC::ChannelHandle() | 34 // IPC::ChannelHandle() |
| 31 virtual void OnChannelOpened(base::ProcessHandle broker_process_handle, | 35 virtual void OnChannelOpened(base::ProcessHandle broker_process_handle, |
| 32 const IPC::ChannelHandle& channel_handle) = 0; | 36 const IPC::ChannelHandle& channel_handle) = 0; |
| 33 }; | 37 }; |
| 34 | 38 |
| 35 // You must call Init before doing anything else. | 39 // You must call Init before doing anything else. |
| 36 PpapiBrokerProcessHost(); | 40 PpapiBrokerProcessHost(); |
| 37 virtual ~PpapiBrokerProcessHost(); | 41 virtual ~PpapiBrokerProcessHost(); |
| 38 | 42 |
| 39 // Actually launches the process with the given plugin info. Returns true | 43 // Actually launches the process with the given plugin info. Returns true |
| 40 // on success (the process was spawned). | 44 // on success (the process was spawned). |
| 41 bool Init(const PepperPluginInfo& info); | 45 bool Init(const webkit::ppapi::PluginInfo& info); |
| 42 | 46 |
| 43 // Opens a new channel to the plugin. The client will be notified when the | 47 // Opens a new channel to the plugin. The client will be notified when the |
| 44 // channel is ready or if there's an error. | 48 // channel is ready or if there's an error. |
| 45 void OpenChannelToPpapiBroker(Client* client); | 49 void OpenChannelToPpapiBroker(Client* client); |
| 46 | 50 |
| 47 const FilePath& broker_path() const { return broker_path_; } | 51 const FilePath& broker_path() const { return broker_path_; } |
| 48 | 52 |
| 49 // The client pointer must remain valid until its callback is issued. | 53 // The client pointer must remain valid until its callback is issued. |
| 50 | 54 |
| 51 private: | 55 private: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 72 // haven't heard back about yet. | 76 // haven't heard back about yet. |
| 73 std::queue<Client*> sent_requests_; | 77 std::queue<Client*> sent_requests_; |
| 74 | 78 |
| 75 // Path to the plugin library. | 79 // Path to the plugin library. |
| 76 FilePath broker_path_; | 80 FilePath broker_path_; |
| 77 | 81 |
| 78 DISALLOW_COPY_AND_ASSIGN(PpapiBrokerProcessHost); | 82 DISALLOW_COPY_AND_ASSIGN(PpapiBrokerProcessHost); |
| 79 }; | 83 }; |
| 80 | 84 |
| 81 #endif // CONTENT_BROWSER_PPAPI_BROKER_PROCESS_HOST_H_ | 85 #endif // CONTENT_BROWSER_PPAPI_BROKER_PROCESS_HOST_H_ |
| OLD | NEW |