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/callback_forward.h" |
9 #include "base/process/process.h" | 9 #include "base/process/process.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "content/public/browser/render_view_host.h" | 11 #include "content/public/browser/render_view_host.h" |
12 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 namespace IPC { | 15 namespace IPC { |
16 class ChannelProxy; | 16 class ChannelProxy; |
17 struct ChannelHandle; | 17 struct ChannelHandle; |
18 class Sender; | 18 class Sender; |
19 } | 19 } |
20 | 20 |
21 namespace ppapi { | 21 namespace ppapi { |
22 class PpapiPermissions; | 22 class PpapiPermissions; |
23 namespace host { | 23 namespace host { |
24 class PpapiHost; | 24 class PpapiHost; |
25 } | 25 } |
26 } | 26 } |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 | 29 |
30 struct PepperRendererInstanceData; | |
31 | |
30 // Interface that allows components in the embedder app to talk to the | 32 // Interface that allows components in the embedder app to talk to the |
31 // PpapiHost in the browser process. | 33 // PpapiHost in the browser process. |
32 // | 34 // |
33 // There will be one of these objects in the browser per plugin process. It | 35 // There will be one of these objects in the browser per plugin process. It |
34 // lives entirely on the I/O thread. | 36 // lives entirely on the I/O thread. |
35 class CONTENT_EXPORT BrowserPpapiHost { | 37 class CONTENT_EXPORT BrowserPpapiHost : |
38 public base::RefCountedThreadSafe<BrowserPpapiHost> { | |
36 public: | 39 public: |
40 class Delegate { | |
dmichael (off chromium)
2013/11/06 22:39:21
How about instead having something like this on Br
scheib
2013/11/15 01:22:17
Done.
| |
41 public: | |
42 virtual ~Delegate() {} | |
43 | |
44 // Called to handle a plugin instance transitioning in or out of idle state. | |
45 virtual void OnIdleState(bool idle, | |
46 const base::FilePath& profile_data_directory, | |
47 const RenderViewHost* render_view_host, | |
48 const GURL& document_url) = 0; | |
49 }; | |
50 | |
37 // Creates a browser host and sets up an out-of-process proxy for an external | 51 // Creates a browser host and sets up an out-of-process proxy for an external |
38 // pepper plugin process. | 52 // pepper plugin process. |
39 static BrowserPpapiHost* CreateExternalPluginProcess( | 53 // |delegate| will be owned by the BrowserPpapiHost, is optional and may be |
54 // NULL, and is used only for OnIdleState for NaCl extensions. | |
55 static scoped_refptr<BrowserPpapiHost> CreateExternalPluginProcess( | |
56 Delegate* delegate, | |
40 IPC::Sender* sender, | 57 IPC::Sender* sender, |
41 ppapi::PpapiPermissions permissions, | 58 ppapi::PpapiPermissions permissions, |
42 base::ProcessHandle plugin_child_process, | 59 base::ProcessHandle plugin_child_process, |
43 IPC::ChannelProxy* channel, | 60 IPC::ChannelProxy* channel, |
44 int render_process_id, | 61 int render_process_id, |
45 int render_view_id, | 62 int render_view_id, |
46 const base::FilePath& profile_directory); | 63 const base::FilePath& profile_directory); |
47 | 64 |
48 virtual ~BrowserPpapiHost() {} | 65 virtual ~BrowserPpapiHost() {} |
49 | 66 |
(...skipping 29 matching lines...) Expand all Loading... | |
79 virtual const base::FilePath& GetProfileDataDirectory() = 0; | 96 virtual const base::FilePath& GetProfileDataDirectory() = 0; |
80 | 97 |
81 // Get the Document/Plugin URLs for the given PP_Instance. | 98 // Get the Document/Plugin URLs for the given PP_Instance. |
82 virtual GURL GetDocumentURLForInstance(PP_Instance instance) = 0; | 99 virtual GURL GetDocumentURLForInstance(PP_Instance instance) = 0; |
83 virtual GURL GetPluginURLForInstance(PP_Instance instance) = 0; | 100 virtual GURL GetPluginURLForInstance(PP_Instance instance) = 0; |
84 }; | 101 }; |
85 | 102 |
86 } // namespace content | 103 } // namespace content |
87 | 104 |
88 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ | 105 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ |
OLD | NEW |