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_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ |
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | |
8 #include "base/process.h" | 9 #include "base/process.h" |
9 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "content/public/browser/browser_thread.h" | |
12 #include "content/public/browser/render_view_host.h" | |
13 #include "ppapi/c/pp_instance.h" | |
10 | 14 |
11 namespace ppapi { | 15 namespace ppapi { |
12 namespace host { | 16 namespace host { |
13 class PpapiHost; | 17 class PpapiHost; |
14 } | 18 } |
15 } | 19 } |
16 | 20 |
17 namespace content { | 21 namespace content { |
18 | 22 |
19 // Interface that allows components in the embedder app to talk to the | 23 // Interface that allows components in the embedder app to talk to the |
20 // PpapiHost in the browser process. | 24 // PpapiHost in the browser process. |
21 // | 25 // |
22 // There will be one of these objects in the browser per plugin process. It | 26 // There will be one of these objects in the browser per plugin process. It |
23 // lives entirely on the I/O thread. | 27 // lives entirely on the I/O thread. |
24 class CONTENT_EXPORT BrowserPpapiHost { | 28 class CONTENT_EXPORT BrowserPpapiHost { |
25 public: | 29 public: |
30 struct RenderViewIDs { | |
31 int process_id; | |
32 int view_id; | |
33 }; | |
34 | |
26 // Returns the PpapiHost object. | 35 // Returns the PpapiHost object. |
27 virtual ppapi::host::PpapiHost* GetPpapiHost() = 0; | 36 virtual ppapi::host::PpapiHost* GetPpapiHost() = 0; |
28 | 37 |
29 // Returns the handle to the plugin process. | 38 // Returns the handle to the plugin process. |
30 virtual base::ProcessHandle GetPluginProcessHandle() const = 0; | 39 virtual base::ProcessHandle GetPluginProcessHandle() const = 0; |
31 | 40 |
41 // Returns true if the given PP_Instance is valid. | |
42 virtual bool IsValidInstance(PP_Instance instance) const = 0; | |
43 | |
44 // Returns the process/view Ids associated with the RenderView containing the | |
45 // given instance. If the instance is invalid, the ids will be 0. | |
46 // | |
47 // When a resource is created, the PP_Instance should already have been | |
48 // validated, and the resource hosts will be deleted when the resource is | |
49 // destroyed. So it should not generally be necessary to check for errors | |
50 // from this function except as a last-minute sanity check if you conver the | |
yzshen1
2012/09/11 20:43:22
conver->convert
| |
51 // IDs to a RenderView/ProcessHost on the UI thread. | |
52 virtual RenderViewIDs GetRenderViewIDsForInstance( | |
53 PP_Instance instance) const = 0; | |
54 | |
32 protected: | 55 protected: |
33 virtual ~BrowserPpapiHost() {} | 56 virtual ~BrowserPpapiHost() {} |
34 }; | 57 }; |
35 | 58 |
36 } // namespace content | 59 } // namespace content |
37 | 60 |
38 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ | 61 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ |
OLD | NEW |