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

Side by Side Diff: content/browser/ppapi_plugin_process_host.h

Issue 10387195: Open pepper files directly in browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 months 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_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 #pragma once 7 #pragma once
8 8
9 #include <queue> 9 #include <queue>
10 #include <string>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/ref_counted.h" 16 #include "content/browser/renderer_host/pepper_file_message_filter.h"
15 #include "content/browser/renderer_host/pepper_message_filter.h" 17 #include "content/browser/renderer_host/pepper_message_filter.h"
16 #include "content/public/browser/browser_child_process_host_delegate.h" 18 #include "content/public/browser/browser_child_process_host_delegate.h"
17 #include "content/public/browser/browser_child_process_host_iterator.h" 19 #include "content/public/browser/browser_child_process_host_iterator.h"
18 #include "ipc/ipc_message.h" 20 #include "ipc/ipc_message.h"
19 21
20 class BrowserChildProcessHostImpl; 22 class BrowserChildProcessHostImpl;
21 23
22 namespace content { 24 namespace content {
23 struct PepperPluginInfo; 25 struct PepperPluginInfo;
24 class ResourceContext; 26 class ResourceContext;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 virtual content::ResourceContext* GetResourceContext() = 0; 60 virtual content::ResourceContext* GetResourceContext() = 0;
59 }; 61 };
60 62
61 class BrokerClient : public Client { 63 class BrokerClient : public Client {
62 }; 64 };
63 65
64 virtual ~PpapiPluginProcessHost(); 66 virtual ~PpapiPluginProcessHost();
65 67
66 static PpapiPluginProcessHost* CreatePluginHost( 68 static PpapiPluginProcessHost* CreatePluginHost(
67 const content::PepperPluginInfo& info, 69 const content::PepperPluginInfo& info,
70 const FilePath& data_directory_path,
68 net::HostResolver* host_resolver); 71 net::HostResolver* host_resolver);
69 static PpapiPluginProcessHost* CreateBrokerHost( 72 static PpapiPluginProcessHost* CreateBrokerHost(
70 const content::PepperPluginInfo& info); 73 const content::PepperPluginInfo& info);
71 74
72 // IPC::Message::Sender implementation: 75 // IPC::Message::Sender implementation:
73 virtual bool Send(IPC::Message* message) OVERRIDE; 76 virtual bool Send(IPC::Message* message) OVERRIDE;
74 77
75 // Opens a new channel to the plugin. The client will be notified when the 78 // Opens a new channel to the plugin. The client will be notified when the
76 // channel is ready or if there's an error. 79 // channel is ready or if there's an error.
77 void OpenChannelToPlugin(Client* client); 80 void OpenChannelToPlugin(Client* client);
78 81
79 const FilePath& plugin_path() const { return plugin_path_; } 82 const FilePath& plugin_path() const { return plugin_path_; }
83 const FilePath& profile_data_directory() const {
84 return profile_data_directory_;
85 }
80 86
81 // The client pointer must remain valid until its callback is issued. 87 // The client pointer must remain valid until its callback is issued.
82 88
83 private: 89 private:
84 class PluginNetworkObserver; 90 class PluginNetworkObserver;
85 91
86 // Constructors for plugin and broker process hosts, respectively. 92 // Constructors for plugin and broker process hosts, respectively.
87 // You must call Init before doing anything else. 93 // You must call Init before doing anything else.
88 PpapiPluginProcessHost(net::HostResolver* host_resolver); 94 PpapiPluginProcessHost(const std::string& plugin_name,
95 const FilePath& profile_data_directory,
96 net::HostResolver* host_resolver);
89 PpapiPluginProcessHost(); 97 PpapiPluginProcessHost();
90 98
91 // Actually launches the process with the given plugin info. Returns true 99 // Actually launches the process with the given plugin info. Returns true
92 // on success (the process was spawned). 100 // on success (the process was spawned).
93 bool Init(const content::PepperPluginInfo& info); 101 bool Init(const content::PepperPluginInfo& info);
94 102
95 void RequestPluginChannel(Client* client); 103 void RequestPluginChannel(Client* client);
96 104
97 virtual void OnProcessLaunched() OVERRIDE; 105 virtual void OnProcessLaunched() OVERRIDE;
98 106
99 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 107 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
100 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 108 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
101 virtual void OnChannelError() OVERRIDE; 109 virtual void OnChannelError() OVERRIDE;
102 110
103 void CancelRequests(); 111 void CancelRequests();
104 112
105 // IPC message handlers. 113 // IPC message handlers.
106 void OnRendererPluginChannelCreated(const IPC::ChannelHandle& handle); 114 void OnRendererPluginChannelCreated(const IPC::ChannelHandle& handle);
107 115
108 // Handles most requests from the plugin. May be NULL. 116 // Handles most requests from the plugin. May be NULL.
109 scoped_refptr<PepperMessageFilter> filter_; 117 scoped_refptr<PepperMessageFilter> filter_;
110 118
119 // Handles filesystem requests from flash plugins. May be NULL.
120 scoped_refptr<PepperFileMessageFilter> file_filter_;
121
111 // Observes network changes. May be NULL. 122 // Observes network changes. May be NULL.
112 scoped_ptr<PluginNetworkObserver> network_observer_; 123 scoped_ptr<PluginNetworkObserver> network_observer_;
113 124
114 // Channel requests that we are waiting to send to the plugin process once 125 // Channel requests that we are waiting to send to the plugin process once
115 // the channel is opened. 126 // the channel is opened.
116 std::vector<Client*> pending_requests_; 127 std::vector<Client*> pending_requests_;
117 128
118 // Channel requests that we have already sent to the plugin process, but 129 // Channel requests that we have already sent to the plugin process, but
119 // haven't heard back about yet. 130 // haven't heard back about yet.
120 std::queue<Client*> sent_requests_; 131 std::queue<Client*> sent_requests_;
121 132
122 // Path to the plugin library. 133 // Path to the plugin library.
123 FilePath plugin_path_; 134 FilePath plugin_path_;
124 135
136 // Path to the per-profile data directory.
137 FilePath profile_data_directory_;
138
125 const bool is_broker_; 139 const bool is_broker_;
126 140
127 scoped_ptr<BrowserChildProcessHostImpl> process_; 141 scoped_ptr<BrowserChildProcessHostImpl> process_;
128 142
129 DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost); 143 DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost);
130 }; 144 };
131 145
132 class PpapiPluginProcessHostIterator 146 class PpapiPluginProcessHostIterator
133 : public content::BrowserChildProcessHostTypeIterator< 147 : public content::BrowserChildProcessHostTypeIterator<
134 PpapiPluginProcessHost> { 148 PpapiPluginProcessHost> {
135 public: 149 public:
136 PpapiPluginProcessHostIterator() 150 PpapiPluginProcessHostIterator()
137 : content::BrowserChildProcessHostTypeIterator< 151 : content::BrowserChildProcessHostTypeIterator<
138 PpapiPluginProcessHost>(content::PROCESS_TYPE_PPAPI_PLUGIN) {} 152 PpapiPluginProcessHost>(content::PROCESS_TYPE_PPAPI_PLUGIN) {}
139 }; 153 };
140 154
141 class PpapiBrokerProcessHostIterator 155 class PpapiBrokerProcessHostIterator
142 : public content::BrowserChildProcessHostTypeIterator< 156 : public content::BrowserChildProcessHostTypeIterator<
143 PpapiPluginProcessHost> { 157 PpapiPluginProcessHost> {
144 public: 158 public:
145 PpapiBrokerProcessHostIterator() 159 PpapiBrokerProcessHostIterator()
146 : content::BrowserChildProcessHostTypeIterator< 160 : content::BrowserChildProcessHostTypeIterator<
147 PpapiPluginProcessHost>(content::PROCESS_TYPE_PPAPI_BROKER) {} 161 PpapiPluginProcessHost>(content::PROCESS_TYPE_PPAPI_BROKER) {}
148 }; 162 };
149 163
150 #endif // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ 164 #endif // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
151 165
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698