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

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 <string>
9 #include <queue> 10 #include <queue>
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 74
73 // IPC::Message::Sender implementation: 75 // IPC::Message::Sender implementation:
74 virtual bool Send(IPC::Message* message) OVERRIDE; 76 virtual bool Send(IPC::Message* message) OVERRIDE;
75 77
76 // 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
77 // channel is ready or if there's an error. 79 // channel is ready or if there's an error.
78 void OpenChannelToPlugin(Client* client); 80 void OpenChannelToPlugin(Client* client);
79 81
80 const FilePath& plugin_path() const { return plugin_path_; } 82 const FilePath& plugin_path() const { return plugin_path_; }
81 const FilePath& profile_data_directory() const { 83 const FilePath& profile_data_directory() const {
82 return profile_data_directory_; } 84 return profile_data_directory_;
85 }
83 86
84 // The client pointer must remain valid until its callback is issued. 87 // The client pointer must remain valid until its callback is issued.
85 88
86 private: 89 private:
87 class PluginNetworkObserver; 90 class PluginNetworkObserver;
88 91
89 // Constructors for plugin and broker process hosts, respectively. 92 // Constructors for plugin and broker process hosts, respectively.
90 // You must call Init before doing anything else. 93 // You must call Init before doing anything else.
91 PpapiPluginProcessHost(const FilePath& profile_data_directory, 94 PpapiPluginProcessHost(const std::string& plugin_name,
95 const FilePath& profile_data_directory,
92 net::HostResolver* host_resolver); 96 net::HostResolver* host_resolver);
93 PpapiPluginProcessHost(); 97 PpapiPluginProcessHost();
94 98
95 // Actually launches the process with the given plugin info. Returns true 99 // Actually launches the process with the given plugin info. Returns true
96 // on success (the process was spawned). 100 // on success (the process was spawned).
97 bool Init(const content::PepperPluginInfo& info); 101 bool Init(const content::PepperPluginInfo& info);
98 102
99 void RequestPluginChannel(Client* client); 103 void RequestPluginChannel(Client* client);
100 104
101 virtual void OnProcessLaunched() OVERRIDE; 105 virtual void OnProcessLaunched() OVERRIDE;
102 106
103 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 107 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
104 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 108 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
105 virtual void OnChannelError() OVERRIDE; 109 virtual void OnChannelError() OVERRIDE;
106 110
107 void CancelRequests(); 111 void CancelRequests();
108 112
109 // IPC message handlers. 113 // IPC message handlers.
110 void OnRendererPluginChannelCreated(const IPC::ChannelHandle& handle); 114 void OnRendererPluginChannelCreated(const IPC::ChannelHandle& handle);
111 115
112 // Handles most requests from the plugin. May be NULL. 116 // Handles most requests from the plugin. May be NULL.
113 scoped_refptr<PepperMessageFilter> filter_; 117 scoped_refptr<PepperMessageFilter> filter_;
114 118
119 // Handles filesystem requests from flash plugins. May be NULL.
120 scoped_refptr<PepperFileMessageFilter> file_filter_;
121
115 // Observes network changes. May be NULL. 122 // Observes network changes. May be NULL.
116 scoped_ptr<PluginNetworkObserver> network_observer_; 123 scoped_ptr<PluginNetworkObserver> network_observer_;
117 124
118 // 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
119 // the channel is opened. 126 // the channel is opened.
120 std::vector<Client*> pending_requests_; 127 std::vector<Client*> pending_requests_;
121 128
122 // 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
123 // haven't heard back about yet. 130 // haven't heard back about yet.
124 std::queue<Client*> sent_requests_; 131 std::queue<Client*> sent_requests_;
(...skipping 24 matching lines...) Expand all
149 : public content::BrowserChildProcessHostTypeIterator< 156 : public content::BrowserChildProcessHostTypeIterator<
150 PpapiPluginProcessHost> { 157 PpapiPluginProcessHost> {
151 public: 158 public:
152 PpapiBrokerProcessHostIterator() 159 PpapiBrokerProcessHostIterator()
153 : content::BrowserChildProcessHostTypeIterator< 160 : content::BrowserChildProcessHostTypeIterator<
154 PpapiPluginProcessHost>(content::PROCESS_TYPE_PPAPI_BROKER) {} 161 PpapiPluginProcessHost>(content::PROCESS_TYPE_PPAPI_BROKER) {}
155 }; 162 };
156 163
157 #endif // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ 164 #endif // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
158 165
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698