Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: content/public/browser/browser_ppapi_host.h

Issue 61063003: Keep NaCl plugins used in app background pages alive when active. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix ref counted compile warning Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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;
yzshen1 2013/11/06 22:43:15 It is not needed here.
scheib 2013/11/15 01:22:17 Done.
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> {
yzshen1 2013/11/06 22:43:15 If possible, please don't make it a ref-counted ob
scheib 2013/11/15 01:22:17 Done.
36 public: 39 public:
40 class Delegate {
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.
yzshen1 2013/11/06 22:43:15 A general rule is not to mention "NaCl" in content
scheib 2013/11/15 01:22:17 Done.
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() {}
49
50 // Returns the PpapiHost object. 65 // Returns the PpapiHost object.
51 virtual ppapi::host::PpapiHost* GetPpapiHost() = 0; 66 virtual ppapi::host::PpapiHost* GetPpapiHost() = 0;
52 67
53 // Returns the handle to the plugin process. 68 // Returns the handle to the plugin process.
54 virtual base::ProcessHandle GetPluginProcessHandle() const = 0; 69 virtual base::ProcessHandle GetPluginProcessHandle() const = 0;
55 70
56 // Returns true if the given PP_Instance is valid. 71 // Returns true if the given PP_Instance is valid.
57 virtual bool IsValidInstance(PP_Instance instance) const = 0; 72 virtual bool IsValidInstance(PP_Instance instance) const = 0;
58 73
59 // Retrieves the process/view Ids associated with the RenderView containing 74 // Retrieves the process/view Ids associated with the RenderView containing
(...skipping 14 matching lines...) Expand all
74 89
75 // Returns the path of the plugin. 90 // Returns the path of the plugin.
76 virtual const base::FilePath& GetPluginPath() = 0; 91 virtual const base::FilePath& GetPluginPath() = 0;
77 92
78 // Returns the user's profile data directory. 93 // Returns the user's profile data directory.
79 virtual const base::FilePath& GetProfileDataDirectory() = 0; 94 virtual const base::FilePath& GetProfileDataDirectory() = 0;
80 95
81 // Get the Document/Plugin URLs for the given PP_Instance. 96 // Get the Document/Plugin URLs for the given PP_Instance.
82 virtual GURL GetDocumentURLForInstance(PP_Instance instance) = 0; 97 virtual GURL GetDocumentURLForInstance(PP_Instance instance) = 0;
83 virtual GURL GetPluginURLForInstance(PP_Instance instance) = 0; 98 virtual GURL GetPluginURLForInstance(PP_Instance instance) = 0;
99
100 protected:
101 virtual ~BrowserPpapiHost() {}
102
103 private:
104 friend class base::RefCountedThreadSafe<BrowserPpapiHost>;
84 }; 105 };
85 106
86 } // namespace content 107 } // namespace content
87 108
88 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ 109 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698