Merge lp:~justinmcp/oxide/pepper-flash into lp:~oxide-developers/oxide/oxide.trunk

Proposed by Justin McPherson on 2014-09-10
Status: Merged
Merged at revision: 1213
Proposed branch: lp:~justinmcp/oxide/pepper-flash
Merge into: lp:~oxide-developers/oxide/oxide.trunk
Diff against target: 1584 lines (+1235/-119)
27 files modified
qt/examples/oxide-test-browser/index.html (+4/-0)
qt/examples/oxide-test-browser/oxide-test-browser.qml (+1/-1)
shared/browser/oxide_browser_process_main.cc (+4/-0)
shared/browser/oxide_content_browser_client.cc (+2/-1)
shared/browser/oxide_pepper_host_factory_browser.cc (+0/-64)
shared/browser/oxide_pepper_host_factory_browser.h (+0/-50)
shared/browser/pepper/oxide_pepper_flash_browser_host.cc (+137/-0)
shared/browser/pepper/oxide_pepper_flash_browser_host.h (+59/-0)
shared/browser/pepper/oxide_pepper_host_factory_browser.cc (+77/-0)
shared/browser/pepper/oxide_pepper_host_factory_browser.h (+50/-0)
shared/common/oxide_constants.cc (+1/-0)
shared/common/oxide_constants.h (+1/-0)
shared/common/oxide_content_client.cc (+41/-1)
shared/common/oxide_paths.cc (+30/-0)
shared/common/oxide_paths.h (+3/-0)
shared/renderer/oxide_content_renderer_client.cc (+7/-0)
shared/renderer/pepper/oxide_pepper_flash_menu_host.cc (+213/-0)
shared/renderer/pepper/oxide_pepper_flash_menu_host.h (+79/-0)
shared/renderer/pepper/oxide_pepper_flash_renderer_host.cc (+119/-0)
shared/renderer/pepper/oxide_pepper_flash_renderer_host.h (+72/-0)
shared/renderer/pepper/oxide_pepper_render_frame_observer.cc (+45/-0)
shared/renderer/pepper/oxide_pepper_render_frame_observer.h (+46/-0)
shared/renderer/pepper/oxide_pepper_renderer_host_factory.cc (+66/-0)
shared/renderer/pepper/oxide_pepper_renderer_host_factory.h (+44/-0)
shared/renderer/pepper/oxide_pepper_shared_memory_message_filter.cc (+72/-0)
shared/renderer/pepper/oxide_pepper_shared_memory_message_filter.h (+48/-0)
shared/shared.gyp (+14/-2)
To merge this branch: bzr merge lp:~justinmcp/oxide/pepper-flash
Reviewer Review Type Date Requested Status
Chris Coulson 2014-09-10 Approve on 2015-10-06
Review via email: mp+234058@code.launchpad.net

Commit Message

Basic support for Pepper Flash plugin

To post a comment you must log in.
Justin McPherson (justinmcp) wrote :

Heads up; this one is still in need of review.

lp:~justinmcp/oxide/pepper-flash updated on 2014-11-05
684. By Justin McPherson <justin@phablet-dev> on 2014-11-05

Merge from trunk.

Chris Coulson (chrisccoulson) wrote :

We talked about this branch during the meeting today. Once the dust has settled with the Arale bring-up, and the handful of other bugs that are critical for the device are done, I shall finally give this a proper review. It would be nice to get this one done (and for me to finish the support for the GTalk plugin too).

I haven't forgotten about it :)

Justin McPherson (justinmcp) wrote :

NP. I'll bring it up to trunk ASAP.

lp:~justinmcp/oxide/pepper-flash updated on 2015-06-25
685. By Justin McPherson <justin@phablet-dev> on 2015-03-13

Merge from trunk.

686. By Justin McPherson <justin@phablet-dev> on 2015-05-05

Merge from trunk.

687. By Justin McPherson <justin@phablet-dev> on 2015-05-06

Fixups and changes to match trunk.

688. By Justin McPherson <justin@phablet-dev> on 2015-06-19

Merge from trunk.

689. By Justin McPherson <justin@phablet-dev> on 2015-06-25

WIP

Chris Coulson (chrisccoulson) wrote :

Ok, I've added a few comments for stuff in shared/browser and shared/common - nothing too major so far, although I've not finished reviewing shared/renderer yet.

As a general comment, it would be worth creating shared/browser/pepper and shared/renderer/pepper subfolders and putting all new and existing oxide_pepper_* files in there

review: Needs Fixing
lp:~justinmcp/oxide/pepper-flash updated on 2015-07-03
690. By Justin McPherson <justin@phablet-dev> on 2015-07-03

WIP

Chris Coulson (chrisccoulson) wrote :

I've basically done reviewing this now, I think.

In addition to the comments, there's a few minor nits in various places:

- When implementing virtual methods in sub-classes, you don't need to use both the "virtual" and "override" keywords. Just "override" will do.
- I'm not entirely sure what to do with license headers in files that contain a lot of copy/paste code. In other places, I've done something like this: http://bazaar.launchpad.net/~oxide-developers/oxide/oxide.trunk/view/head:/shared/browser/oxide_gpu_info_collector_linux.cc#L1
- If you're implementing interfaces that are only called from Chromium, you can put the implementation in the private: section of the class.
- There's quite a lot of places in shared/renderer that don't have braces around if statements.

Other than that, it's mostly minor comments

review: Needs Fixing
lp:~justinmcp/oxide/pepper-flash updated on 2015-09-01
691. By Justin McPherson on 2015-08-31

WIP

692. By Justin McPherson on 2015-08-31

Merge from trunk.

Chris Coulson (chrisccoulson) wrote :

Let's get this one in. I created https://blueprints.launchpad.net/oxide/+spec/pepper-flash-support a few weeks ago to group together the missing bits for Flash support, and given that it's off by default, we can just report bugs for issues as we find them

review: Approve
lp:~justinmcp/oxide/pepper-flash updated on 2015-10-08
693. By Justin McPherson on 2015-10-07

Merge from trunk.

694. By Justin McPherson on 2015-10-08

Merge from trunk.

695. By Justin McPherson on 2015-10-08

Change to match new function signature

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qt/examples/oxide-test-browser/index.html'
2--- qt/examples/oxide-test-browser/index.html 2014-02-14 19:30:54 +0000
3+++ qt/examples/oxide-test-browser/index.html 2015-10-08 02:28:09 +0000
4@@ -16,6 +16,10 @@
5 <li><a href="http://peacekeeper.futuremark.com/">Peacekeeper</a></li>
6 <li><a href="http://webglsamples.googlecode.com/hg/aquarium/aquarium.html">http://webglsamples.googlecode.com/hg/aquarium/aquarium.html</a></li>
7 <li><a href="http://chrome.angrybirds.com/">http://chrome.angrybirds.com/</a></li>
8+ <li><a href="http://www.youtube.com/">http://www.youtube.com/</a></li>
9+ <li><a href="http://www.sjgames.com/ourgames/flash.html">SJ Games</a></li>
10+ <li><a href="http://armorgames.com/play/1716/gemcraft">GemCraft</a></li>
11+ <li><a href="http://24hoursofhappy.com">Happy</a></li>
12 </ul>
13 </body>
14 </html>
15
16=== modified file 'qt/examples/oxide-test-browser/oxide-test-browser.qml'
17--- qt/examples/oxide-test-browser/oxide-test-browser.qml 2014-02-14 20:05:24 +0000
18+++ qt/examples/oxide-test-browser/oxide-test-browser.qml 2015-10-08 02:28:09 +0000
19@@ -1,6 +1,6 @@
20 import QtQuick 2.0
21 import Ubuntu.Components 0.1
22-import com.canonical.Oxide 0.1
23+import com.canonical.Oxide 1.7
24
25 MainView {
26 objectName: "mainView"
27
28=== modified file 'shared/browser/oxide_browser_process_main.cc'
29--- shared/browser/oxide_browser_process_main.cc 2015-09-23 18:25:36 +0000
30+++ shared/browser/oxide_browser_process_main.cc 2015-10-08 02:28:09 +0000
31@@ -303,6 +303,10 @@
32 command_line->AppendSwitch(switches::kAllowSandboxDebugging);
33 }
34
35+ if (IsEnvironmentOptionEnabled("ENABLE_PEPPER_FLASH_PLUGIN")) {
36+ command_line->AppendSwitch(switches::kEnablePepperFlashPlugin);
37+ }
38+
39 if (IsEnvironmentOptionEnabled("ENABLE_MEDIA_HUB_AUDIO")) {
40 command_line->AppendSwitch(switches::kEnableMediaHubAudio);
41 }
42
43=== modified file 'shared/browser/oxide_content_browser_client.cc'
44--- shared/browser/oxide_content_browser_client.cc 2015-09-28 16:44:05 +0000
45+++ shared/browser/oxide_content_browser_client.cc 2015-10-08 02:28:09 +0000
46@@ -58,7 +58,7 @@
47 #include "content/public/browser/browser_ppapi_host.h"
48 #include "ppapi/host/ppapi_host.h"
49
50-#include "oxide_pepper_host_factory_browser.h"
51+#include "pepper/oxide_pepper_host_factory_browser.h"
52 #endif
53
54 namespace oxide {
55@@ -106,6 +106,7 @@
56 // This can be called on the UI or IO thread
57 static const char* const kSwitchNames[] = {
58 switches::kEnableGoogleTalkPlugin,
59+ switches::kEnablePepperFlashPlugin,
60 switches::kEnableMediaHubAudio,
61 switches::kFormFactor,
62 switches::kMediaHubFixedSessionDomains
63
64=== removed file 'shared/browser/oxide_pepper_host_factory_browser.cc'
65--- shared/browser/oxide_pepper_host_factory_browser.cc 2015-04-20 18:50:54 +0000
66+++ shared/browser/oxide_pepper_host_factory_browser.cc 1970-01-01 00:00:00 +0000
67@@ -1,64 +0,0 @@
68-// vim:expandtab:shiftwidth=2:tabstop=2:
69-// Copyright (C) 2014 Canonical Ltd.
70-
71-// This library is free software; you can redistribute it and/or
72-// modify it under the terms of the GNU Lesser General Public
73-// License as published by the Free Software Foundation; either
74-// version 2.1 of the License, or (at your option) any later version.
75-
76-// This library is distributed in the hope that it will be useful,
77-// but WITHOUT ANY WARRANTY; without even the implied warranty of
78-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
79-// Lesser General Public License for more details.
80-
81-// You should have received a copy of the GNU Lesser General Public
82-// License along with this library; if not, write to the Free Software
83-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
84-
85-#include "oxide_pepper_host_factory_browser.h"
86-
87-#include "base/logging.h"
88-#include "base/memory/scoped_ptr.h"
89-#include "content/public/browser/browser_ppapi_host.h"
90-#include "ppapi/host/ppapi_host.h"
91-#include "ppapi/host/resource_host.h"
92-#include "ppapi/proxy/ppapi_messages.h"
93-#include "ppapi/shared_impl/ppapi_permissions.h"
94-
95-namespace oxide {
96-
97-PepperHostFactoryBrowser::PepperHostFactoryBrowser(
98- content::BrowserPpapiHost* host) :
99- host_(host) {}
100-
101-PepperHostFactoryBrowser::~PepperHostFactoryBrowser() {}
102-
103-scoped_ptr<ppapi::host::ResourceHost>
104-PepperHostFactoryBrowser::CreateResourceHost(ppapi::host::PpapiHost* host,
105- PP_Resource resource,
106- PP_Instance instance,
107- const IPC::Message& message) {
108- DCHECK(host == host_->GetPpapiHost());
109-
110- if (!host_->IsValidInstance(instance)) {
111- return nullptr;
112- }
113-
114- // Dev interfaces:
115- // TODO:
116- // PpapiHostMsg_ExtensionsCommon_Create
117-
118- // Private interfaces:
119- // TODO:
120- // PpapiHostMsg_Broker_Create
121-
122- // Flash interfaces:
123- // TODO:
124- // PpapiHostMsg_Flash_Create
125- // PpapiHostMsg_FlashClipboard_Create
126- // PpapiHostMsg_FlashDRM_Create
127-
128- return nullptr;
129-}
130-
131-} // namespace oxide
132
133=== removed file 'shared/browser/oxide_pepper_host_factory_browser.h'
134--- shared/browser/oxide_pepper_host_factory_browser.h 2014-11-21 23:28:35 +0000
135+++ shared/browser/oxide_pepper_host_factory_browser.h 1970-01-01 00:00:00 +0000
136@@ -1,50 +0,0 @@
137-// vim:expandtab:shiftwidth=2:tabstop=2:
138-// Copyright (C) 2014 Canonical Ltd.
139-
140-// This library is free software; you can redistribute it and/or
141-// modify it under the terms of the GNU Lesser General Public
142-// License as published by the Free Software Foundation; either
143-// version 2.1 of the License, or (at your option) any later version.
144-
145-// This library is distributed in the hope that it will be useful,
146-// but WITHOUT ANY WARRANTY; without even the implied warranty of
147-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
148-// Lesser General Public License for more details.
149-
150-// You should have received a copy of the GNU Lesser General Public
151-// License along with this library; if not, write to the Free Software
152-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
153-
154-#ifndef _OXIDE_SHARED_BROWSER_PEPPER_HOST_FACTORY_H_
155-#define _OXIDE_SHARED_BROWSER_PEPPER_HOST_FACTORY_H_
156-
157-#include "base/basictypes.h"
158-#include "base/compiler_specific.h"
159-#include "ppapi/host/host_factory.h"
160-
161-namespace content {
162-class BrowserPpapiHost;
163-}
164-
165-namespace oxide {
166-
167-class PepperHostFactoryBrowser final : public ppapi::host::HostFactory {
168- public:
169- PepperHostFactoryBrowser(content::BrowserPpapiHost* host);
170- ~PepperHostFactoryBrowser();
171-
172- scoped_ptr<ppapi::host::ResourceHost> CreateResourceHost(
173- ppapi::host::PpapiHost* host,
174- PP_Resource resource,
175- PP_Instance instance,
176- const IPC::Message& message) final;
177-
178- private:
179- content::BrowserPpapiHost* host_;
180-
181- DISALLOW_IMPLICIT_CONSTRUCTORS(PepperHostFactoryBrowser);
182-};
183-
184-} // namespace oxide
185-
186-#endif // _OXIDE_SHARED_BROWSER_PEPPER_HOST_FACTORY_H_
187
188=== added directory 'shared/browser/pepper'
189=== added file 'shared/browser/pepper/oxide_pepper_flash_browser_host.cc'
190--- shared/browser/pepper/oxide_pepper_flash_browser_host.cc 1970-01-01 00:00:00 +0000
191+++ shared/browser/pepper/oxide_pepper_flash_browser_host.cc 2015-10-08 02:28:09 +0000
192@@ -0,0 +1,137 @@
193+// vim:expandtab:shiftwidth=2:tabstop=2:
194+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
195+// Use of this source code is governed by a BSD-style license that can be
196+// found in the LICENSE file.
197+
198+#include "oxide_pepper_flash_browser_host.h"
199+
200+#include "base/logging.h"
201+#include "base/time/time.h"
202+#include "content/public/browser/browser_thread.h"
203+#include "content/public/browser/browser_ppapi_host.h"
204+#include "content/public/browser/render_process_host.h"
205+#include "content/public/browser/cookie_store_factory.h"
206+#include "ppapi/c/pp_errors.h"
207+#include "ppapi/host/dispatch_host_message.h"
208+#include "ppapi/host/host_message_context.h"
209+#include "ppapi/host/ppapi_host.h"
210+#include "ppapi/proxy/ppapi_messages.h"
211+#include "ppapi/shared_impl/time_conversion.h"
212+#include "shared/browser/oxide_browser_context.h"
213+#include "shared/browser/oxide_browser_context_delegate.h"
214+
215+namespace oxide {
216+
217+namespace {
218+
219+// Do work on the UI thread
220+int32_t GetRestrictions(int render_process_id,
221+ const GURL& document_url,
222+ const GURL& plugin_url
223+) {
224+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
225+
226+ int32_t restrictions = PP_FLASHLSORESTRICTIONS_NONE;
227+ if (!document_url.is_valid()) {
228+ return restrictions;
229+ }
230+
231+ BrowserContextIOData* io_data = nullptr;
232+ content::RenderProcessHost* render_process_host =
233+ content::RenderProcessHost::FromID(render_process_id);
234+ if (render_process_host) {
235+ io_data = BrowserContextIOData::FromResourceContext(
236+ render_process_host->GetBrowserContext()->GetResourceContext());
237+ }
238+
239+ if (!io_data) {
240+ return restrictions;
241+ }
242+
243+ // TODO(chrisccoulson): Implement PP_FLASHLSORESTRICTIONS_IN_MEMORY when
244+ // we have content settings
245+
246+ if (!io_data->CanAccessCookies(document_url, plugin_url, false)) {
247+ restrictions = PP_FLASHLSORESTRICTIONS_BLOCK;
248+ }
249+
250+ return restrictions;
251+}
252+
253+} // namespace
254+
255+
256+PepperFlashBrowserHost::PepperFlashBrowserHost(content::BrowserPpapiHost* host,
257+ PP_Instance instance,
258+ PP_Resource resource)
259+ : ResourceHost(host->GetPpapiHost(), instance, resource),
260+ host_(host),
261+ weak_factory_(this) {
262+ int unused;
263+ host->GetRenderFrameIDsForInstance(instance, &render_process_id_, &unused);
264+}
265+
266+PepperFlashBrowserHost::~PepperFlashBrowserHost() {}
267+
268+int32_t PepperFlashBrowserHost::OnResourceMessageReceived(
269+ const IPC::Message& msg,
270+ ppapi::host::HostMessageContext* context) {
271+
272+ PPAPI_BEGIN_MESSAGE_MAP(PepperFlashBrowserHost, msg)
273+ PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Flash_UpdateActivity,
274+ OnUpdateActivity)
275+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_GetLocalTimeZoneOffset,
276+ OnGetLocalTimeZoneOffset)
277+ PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(
278+ PpapiHostMsg_Flash_GetLocalDataRestrictions, OnGetLocalDataRestrictions)
279+ PPAPI_END_MESSAGE_MAP()
280+
281+ return PP_ERROR_FAILED;
282+}
283+
284+int32_t PepperFlashBrowserHost::OnUpdateActivity(
285+ ppapi::host::HostMessageContext* host_context) {
286+ return PP_OK;
287+}
288+
289+int32_t PepperFlashBrowserHost::OnGetLocalTimeZoneOffset(
290+ ppapi::host::HostMessageContext* host_context,
291+ const base::Time& t) {
292+
293+ // The reason for this processing being in the browser process is that on
294+ // Linux, the localtime calls require filesystem access prohibited by the
295+ // sandbox.
296+
297+ host_context->reply_msg = PpapiPluginMsg_Flash_GetLocalTimeZoneOffsetReply(
298+ ppapi::PPGetLocalTimeZoneOffset(t));
299+
300+ return PP_OK;
301+}
302+
303+int32_t PepperFlashBrowserHost::OnGetLocalDataRestrictions(
304+ ppapi::host::HostMessageContext* context) {
305+
306+ GURL document_url = host_->GetDocumentURLForInstance(pp_instance());
307+ GURL plugin_url = host_->GetPluginURLForInstance(pp_instance());
308+
309+ content::BrowserThread::PostTaskAndReplyWithResult(
310+ content::BrowserThread::UI,
311+ FROM_HERE,
312+ base::Bind(&GetRestrictions, render_process_id_, document_url, plugin_url),
313+ base::Bind(&PepperFlashBrowserHost::GetLocalDataRestrictions,
314+ weak_factory_.GetWeakPtr(),
315+ context->MakeReplyMessageContext()));
316+
317+ return PP_OK_COMPLETIONPENDING;
318+}
319+
320+void PepperFlashBrowserHost::GetLocalDataRestrictions(
321+ ppapi::host::ReplyMessageContext reply_context,
322+ int32_t restrictions) {
323+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
324+
325+ SendReply(reply_context,
326+ PpapiPluginMsg_Flash_GetLocalDataRestrictionsReply(restrictions));
327+}
328+
329+} // namespace oxide
330
331=== added file 'shared/browser/pepper/oxide_pepper_flash_browser_host.h'
332--- shared/browser/pepper/oxide_pepper_flash_browser_host.h 1970-01-01 00:00:00 +0000
333+++ shared/browser/pepper/oxide_pepper_flash_browser_host.h 2015-10-08 02:28:09 +0000
334@@ -0,0 +1,59 @@
335+// vim:expandtab:shiftwidth=2:tabstop=2:
336+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
337+// Use of this source code is governed by a BSD-style license that can be
338+// found in the LICENSE file.
339+
340+#ifndef _OXIDE_SHARED_BROWSER_PEPPER_FLASH_BROWSER_HOST_H_
341+#define _OXIDE_SHARED_BROWSER_PEPPER_FLASH_BROWSER_HOST_H_
342+
343+#include "base/basictypes.h"
344+#include "base/compiler_specific.h"
345+#include "base/memory/weak_ptr.h"
346+#include "ppapi/host/resource_host.h"
347+
348+class CookieSettings;
349+class GURL;
350+
351+namespace base {
352+class Time;
353+}
354+
355+namespace content {
356+class BrowserPpapiHost;
357+}
358+
359+namespace oxide {
360+
361+class BrowserContext;
362+
363+
364+class PepperFlashBrowserHost final : public ppapi::host::ResourceHost {
365+ public:
366+ PepperFlashBrowserHost(content::BrowserPpapiHost* host,
367+ PP_Instance instance,
368+ PP_Resource resource);
369+ ~PepperFlashBrowserHost();
370+
371+ private:
372+ int32_t OnResourceMessageReceived(
373+ const IPC::Message& msg,
374+ ppapi::host::HostMessageContext* context) override;
375+
376+ int32_t OnUpdateActivity(ppapi::host::HostMessageContext* host_context);
377+ int32_t OnGetLocalTimeZoneOffset(
378+ ppapi::host::HostMessageContext* host_context,
379+ const base::Time& t);
380+ int32_t OnGetLocalDataRestrictions(ppapi::host::HostMessageContext* context);
381+
382+ void GetLocalDataRestrictions(ppapi::host::ReplyMessageContext reply_context,
383+ int32_t restrictions);
384+ content::BrowserPpapiHost* host_;
385+ int render_process_id_;
386+ base::WeakPtrFactory<PepperFlashBrowserHost> weak_factory_;
387+
388+ DISALLOW_COPY_AND_ASSIGN(PepperFlashBrowserHost);
389+};
390+
391+} // namespace oxide
392+
393+#endif // _OXIDE_SHARED_BROWSER_PEPPER_FLASH_BROWSER_HOST_H_
394
395=== added file 'shared/browser/pepper/oxide_pepper_host_factory_browser.cc'
396--- shared/browser/pepper/oxide_pepper_host_factory_browser.cc 1970-01-01 00:00:00 +0000
397+++ shared/browser/pepper/oxide_pepper_host_factory_browser.cc 2015-10-08 02:28:09 +0000
398@@ -0,0 +1,77 @@
399+// vim:expandtab:shiftwidth=2:tabstop=2:
400+// Copyright (C) 2014 Canonical Ltd.
401+
402+// This library is free software; you can redistribute it and/or
403+// modify it under the terms of the GNU Lesser General Public
404+// License as published by the Free Software Foundation; either
405+// version 2.1 of the License, or (at your option) any later version.
406+
407+// This library is distributed in the hope that it will be useful,
408+// but WITHOUT ANY WARRANTY; without even the implied warranty of
409+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
410+// Lesser General Public License for more details.
411+
412+// You should have received a copy of the GNU Lesser General Public
413+// License along with this library; if not, write to the Free Software
414+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
415+
416+#include "oxide_pepper_host_factory_browser.h"
417+
418+#include "base/logging.h"
419+#include "base/memory/scoped_ptr.h"
420+#include "content/public/browser/browser_ppapi_host.h"
421+#include "ppapi/host/ppapi_host.h"
422+#include "ppapi/host/resource_host.h"
423+#include "ppapi/proxy/ppapi_messages.h"
424+#include "ppapi/shared_impl/ppapi_permissions.h"
425+
426+#include "oxide_pepper_flash_browser_host.h"
427+
428+namespace oxide {
429+
430+PepperHostFactoryBrowser::PepperHostFactoryBrowser(
431+ content::BrowserPpapiHost* host) :
432+ host_(host) {}
433+
434+PepperHostFactoryBrowser::~PepperHostFactoryBrowser() {}
435+
436+scoped_ptr<ppapi::host::ResourceHost>
437+PepperHostFactoryBrowser::CreateResourceHost(
438+ ppapi::host::PpapiHost* host,
439+ PP_Resource resource,
440+ PP_Instance instance,
441+ const IPC::Message& message
442+) {
443+ DCHECK(host == host_->GetPpapiHost());
444+
445+ if (!host_->IsValidInstance(instance)) {
446+ return nullptr;
447+ }
448+
449+ // Dev interfaces:
450+ // TODO:
451+ // PpapiHostMsg_ExtensionsCommon_Create
452+
453+ // Private interfaces:
454+ // TODO:
455+ // PpapiHostMsg_Broker_Create
456+
457+ // Flash interfaces:
458+ // TODO:
459+ // PpapiHostMsg_FlashClipboard_Create
460+ // PpapiHostMsg_FlashDRM_Create
461+ if (host_->GetPpapiHost()->permissions().HasPermission(
462+ ppapi::PERMISSION_FLASH)) {
463+ switch (message.type()) {
464+ case PpapiHostMsg_Flash_Create::ID:
465+ return scoped_ptr<ppapi::host::ResourceHost>(
466+ new PepperFlashBrowserHost(host_, instance, resource));
467+ default:
468+ ;
469+ }
470+ }
471+
472+ return nullptr;
473+}
474+
475+} // namespace oxide
476
477=== added file 'shared/browser/pepper/oxide_pepper_host_factory_browser.h'
478--- shared/browser/pepper/oxide_pepper_host_factory_browser.h 1970-01-01 00:00:00 +0000
479+++ shared/browser/pepper/oxide_pepper_host_factory_browser.h 2015-10-08 02:28:09 +0000
480@@ -0,0 +1,50 @@
481+// vim:expandtab:shiftwidth=2:tabstop=2:
482+// Copyright (C) 2014 Canonical Ltd.
483+
484+// This library is free software; you can redistribute it and/or
485+// modify it under the terms of the GNU Lesser General Public
486+// License as published by the Free Software Foundation; either
487+// version 2.1 of the License, or (at your option) any later version.
488+
489+// This library is distributed in the hope that it will be useful,
490+// but WITHOUT ANY WARRANTY; without even the implied warranty of
491+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
492+// Lesser General Public License for more details.
493+
494+// You should have received a copy of the GNU Lesser General Public
495+// License along with this library; if not, write to the Free Software
496+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
497+
498+#ifndef _OXIDE_SHARED_BROWSER_PEPPER_HOST_FACTORY_H_
499+#define _OXIDE_SHARED_BROWSER_PEPPER_HOST_FACTORY_H_
500+
501+#include "base/basictypes.h"
502+#include "base/compiler_specific.h"
503+#include "ppapi/host/host_factory.h"
504+
505+namespace content {
506+class BrowserPpapiHost;
507+}
508+
509+namespace oxide {
510+
511+class PepperHostFactoryBrowser final : public ppapi::host::HostFactory {
512+ public:
513+ PepperHostFactoryBrowser(content::BrowserPpapiHost* host);
514+ ~PepperHostFactoryBrowser();
515+
516+ scoped_ptr<ppapi::host::ResourceHost> CreateResourceHost(
517+ ppapi::host::PpapiHost* host,
518+ PP_Resource resource,
519+ PP_Instance instance,
520+ const IPC::Message& message) final;
521+
522+ private:
523+ content::BrowserPpapiHost* host_;
524+
525+ DISALLOW_COPY_AND_ASSIGN(PepperHostFactoryBrowser);
526+};
527+
528+} // namespace oxide
529+
530+#endif // _OXIDE_SHARED_BROWSER_PEPPER_HOST_FACTORY_H_
531
532=== modified file 'shared/common/oxide_constants.cc'
533--- shared/common/oxide_constants.cc 2015-09-08 12:39:14 +0000
534+++ shared/common/oxide_constants.cc 2015-10-08 02:28:09 +0000
535@@ -20,6 +20,7 @@
536 namespace switches {
537
538 const char kEnableGoogleTalkPlugin[] = "enable-google-talk-plugin";
539+const char kEnablePepperFlashPlugin[] = "enable-pepper-flash-plugin";
540 const char kFormFactor[] = "form-factor";
541 const char kFormFactorDesktop[] = "desktop";
542 const char kFormFactorTablet[] = "tablet";
543
544=== modified file 'shared/common/oxide_constants.h'
545--- shared/common/oxide_constants.h 2015-09-08 12:39:14 +0000
546+++ shared/common/oxide_constants.h 2015-10-08 02:28:09 +0000
547@@ -21,6 +21,7 @@
548 namespace switches {
549
550 extern const char kEnableGoogleTalkPlugin[];
551+extern const char kEnablePepperFlashPlugin[];
552 extern const char kFormFactor[];
553 extern const char kFormFactorDesktop[];
554 extern const char kFormFactorTablet[];
555
556=== modified file 'shared/common/oxide_content_client.cc'
557--- shared/common/oxide_content_client.cc 2015-09-23 18:25:36 +0000
558+++ shared/common/oxide_content_client.cc 2015-10-08 02:28:09 +0000
559@@ -27,6 +27,19 @@
560 #include "shared/browser/oxide_content_browser_client.h"
561 #include "shared/renderer/oxide_content_renderer_client.h"
562
563+#if defined(ENABLE_PLUGINS)
564+#include "base/command_line.h"
565+#include "base/files/file_path.h"
566+#include "base/path_service.h"
567+#include "content/public/common/pepper_plugin_info.h"
568+#include "content/public/common/webplugininfo.h"
569+#include "content/public/common/content_constants.h"
570+#include "ppapi/shared_impl/ppapi_permissions.h"
571+
572+#include "shared/common/oxide_constants.h"
573+#include "shared/common/oxide_paths.h"
574+#endif
575+
576 #include "oxide_form_factor.h"
577 #include "oxide_user_agent.h"
578
579@@ -37,7 +50,34 @@
580 }
581
582 void ContentClient::AddPepperPlugins(
583- std::vector<content::PepperPluginInfo>* plugins) {}
584+ std::vector<content::PepperPluginInfo>* plugins) {
585+#if defined(ENABLE_PLUGINS)
586+ base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
587+ if (command_line.HasSwitch(switches::kEnablePepperFlashPlugin)) {
588+ base::FilePath path;
589+ if (PathService::Get(FILE_PEPPER_FLASH_PLUGIN, &path)) {
590+ content::PepperPluginInfo pf;
591+
592+ pf.path = path;
593+ pf.is_out_of_process = true;
594+ pf.name = content::kFlashPluginName;
595+ pf.permissions = ppapi::PERMISSION_DEV |
596+ ppapi::PERMISSION_PRIVATE |
597+ ppapi::PERMISSION_BYPASS_USER_GESTURE |
598+ ppapi::PERMISSION_FLASH;
599+
600+ pf.description = "Shockwave Flash Pepper Plugin (under Oxide)";
601+ pf.mime_types.push_back(content::WebPluginMimeType(content::kFlashPluginSwfMimeType,
602+ content::kFlashPluginSwfExtension,
603+ content::kFlashPluginSwfDescription));
604+ pf.mime_types.push_back(content::WebPluginMimeType(content::kFlashPluginSplMimeType,
605+ content::kFlashPluginSplExtension,
606+ content::kFlashPluginSplDescription));
607+ plugins->push_back(pf);
608+ }
609+ }
610+#endif
611+}
612
613 std::string ContentClient::GetUserAgent() const {
614 return oxide::GetUserAgent();
615
616=== modified file 'shared/common/oxide_paths.cc'
617--- shared/common/oxide_paths.cc 2015-04-09 22:20:49 +0000
618+++ shared/common/oxide_paths.cc 2015-10-08 02:28:09 +0000
619@@ -17,14 +17,44 @@
620
621 #include "oxide_paths.h"
622
623+#include "base/files/file_path.h"
624+#include "base/files/file_util.h"
625 #include "base/path_service.h"
626
627 namespace oxide {
628
629 namespace {
630
631+const base::FilePath::CharType* kPepperFlashPluginDirs[] = {
632+ FILE_PATH_LITERAL("/usr/lib/adobe-flashplugin"),
633+ FILE_PATH_LITERAL("/opt/google/chrome/PepperFlash"),
634+};
635+const base::FilePath::CharType kPepperFlashPluginFilename[] =
636+ FILE_PATH_LITERAL("libpepflashplayer.so");
637+
638+
639 bool PathProvider(int key, base::FilePath* result) {
640 switch (key) {
641+ case DIR_PEPPER_FLASH_PLUGIN: {
642+ for (size_t i = 0; i < arraysize(kPepperFlashPluginDirs); ++i) {
643+ base::FilePath path(kPepperFlashPluginDirs[i]);
644+ if (base::PathExists(path.Append(kPepperFlashPluginFilename))) {
645+ *result = path;
646+ return true;
647+ }
648+ }
649+ return false;
650+ }
651+
652+ case FILE_PEPPER_FLASH_PLUGIN: {
653+ base::FilePath path;
654+ if (!PathService::Get(DIR_PEPPER_FLASH_PLUGIN, &path)) {
655+ return false;
656+ }
657+ *result = path.Append(kPepperFlashPluginFilename);
658+ return true;
659+ }
660+
661 default:
662 return false;
663 }
664
665=== modified file 'shared/common/oxide_paths.h'
666--- shared/common/oxide_paths.h 2015-04-09 22:20:49 +0000
667+++ shared/common/oxide_paths.h 2015-10-08 02:28:09 +0000
668@@ -23,6 +23,9 @@
669 enum {
670 PATH_START = 1000, // Same as Chrome
671
672+ DIR_PEPPER_FLASH_PLUGIN,
673+ FILE_PEPPER_FLASH_PLUGIN,
674+
675 PATH_END
676 };
677
678
679=== modified file 'shared/renderer/oxide_content_renderer_client.cc'
680--- shared/renderer/oxide_content_renderer_client.cc 2015-09-29 13:59:26 +0000
681+++ shared/renderer/oxide_content_renderer_client.cc 2015-10-08 02:28:09 +0000
682@@ -46,6 +46,10 @@
683 #include "oxide_user_script_slave.h"
684 #include "oxide_web_content_settings_client.h"
685
686+#if defined(ENABLE_PLUGINS)
687+#include "pepper/oxide_pepper_render_frame_observer.h"
688+#endif
689+
690 #if defined(ENABLE_MEDIAHUB)
691 #include "media/oxide_renderer_media_player_manager.h"
692 #include "media/oxide_web_media_player.h"
693@@ -77,6 +81,9 @@
694 content::RenderFrame* render_frame) {
695 new ScriptMessageDispatcherRenderer(render_frame);
696 new WebContentSettingsClient(render_frame);
697+#if defined(ENABLE_PLUGINS)
698+ new PepperRenderFrameObserver(render_frame);
699+#endif
700 #if defined(ENABLE_MEDIAHUB)
701 new RendererMediaPlayerManager(render_frame);
702 #endif
703
704=== added directory 'shared/renderer/pepper'
705=== added file 'shared/renderer/pepper/oxide_pepper_flash_menu_host.cc'
706--- shared/renderer/pepper/oxide_pepper_flash_menu_host.cc 1970-01-01 00:00:00 +0000
707+++ shared/renderer/pepper/oxide_pepper_flash_menu_host.cc 2015-10-08 02:28:09 +0000
708@@ -0,0 +1,213 @@
709+// vim:expandtab:shiftwidth=2:tabstop=2:
710+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
711+// Use of this source code is governed by a BSD-style license that can be
712+// found in the LICENSE file.
713+
714+#include "oxide_pepper_flash_menu_host.h"
715+
716+#include "base/strings/utf_string_conversions.h"
717+#include "content/public/common/context_menu_params.h"
718+#include "content/public/renderer/render_frame.h"
719+#include "content/public/renderer/renderer_ppapi_host.h"
720+#include "ipc/ipc_message.h"
721+#include "ppapi/c/private/ppb_flash_menu.h"
722+#include "ppapi/host/dispatch_host_message.h"
723+#include "ppapi/host/ppapi_host.h"
724+#include "ppapi/proxy/ppapi_messages.h"
725+#include "ppapi/proxy/serialized_flash_menu.h"
726+#include "ui/gfx/geometry/point.h"
727+
728+namespace {
729+
730+// Maximum depth of submenus allowed (e.g., 1 indicates that submenus are
731+// allowed, but not sub-submenus).
732+const size_t kMaxMenuDepth = 2;
733+
734+// Maximum number of entries in any single menu (including separators).
735+const size_t kMaxMenuEntries = 50;
736+
737+// Maximum total number of entries in the |menu_id_map| (see below).
738+// (Limit to 500 real entries; reserve the 0 action as an invalid entry.)
739+const size_t kMaxMenuIdMapEntries = 501;
740+
741+// Converts menu data from one form to another.
742+// - |depth| is the current nested depth (call it starting with 0).
743+// - |menu_id_map| is such that |menu_id_map[output_item.action] ==
744+// input_item.id| (where |action| is what a |MenuItem| has, |id| is what a
745+// |PP_Flash_MenuItem| has).
746+bool ConvertMenuData(const PP_Flash_Menu* in_menu,
747+ size_t depth,
748+ std::vector<content::MenuItem>* out_menu,
749+ std::vector<int32_t>* menu_id_map) {
750+ if (depth > kMaxMenuDepth || !in_menu) {
751+ return false;
752+ }
753+
754+ // Clear the output, just in case.
755+ out_menu->clear();
756+
757+ if (!in_menu->count) {
758+ return true; // Nothing else to do.
759+ }
760+ if (!in_menu->items || in_menu->count > kMaxMenuEntries) {
761+ return false;
762+ }
763+ for (uint32_t i = 0; i < in_menu->count; i++) {
764+ content::MenuItem item;
765+
766+ PP_Flash_MenuItem_Type type = in_menu->items[i].type;
767+ switch (type) {
768+ case PP_FLASH_MENUITEM_TYPE_NORMAL:
769+ item.type = content::MenuItem::OPTION;
770+ break;
771+ case PP_FLASH_MENUITEM_TYPE_CHECKBOX:
772+ item.type = content::MenuItem::CHECKABLE_OPTION;
773+ break;
774+ case PP_FLASH_MENUITEM_TYPE_SEPARATOR:
775+ item.type = content::MenuItem::SEPARATOR;
776+ break;
777+ case PP_FLASH_MENUITEM_TYPE_SUBMENU:
778+ item.type = content::MenuItem::SUBMENU;
779+ break;
780+ default:
781+ return false;
782+ }
783+ if (in_menu->items[i].name) {
784+ item.label = base::UTF8ToUTF16(in_menu->items[i].name);
785+ }
786+ if (menu_id_map->size() >= kMaxMenuIdMapEntries) {
787+ return false;
788+ }
789+ item.action = static_cast<unsigned>(menu_id_map->size());
790+ // This sets |(*menu_id_map)[item.action] = in_menu->items[i].id|.
791+ menu_id_map->push_back(in_menu->items[i].id);
792+ item.enabled = PP_ToBool(in_menu->items[i].enabled);
793+ item.checked = PP_ToBool(in_menu->items[i].checked);
794+ if (type == PP_FLASH_MENUITEM_TYPE_SUBMENU) {
795+ if (!ConvertMenuData(
796+ in_menu->items[i].submenu, depth + 1, &item.submenu, menu_id_map)) {
797+ return false;
798+ }
799+ }
800+
801+ out_menu->push_back(item);
802+ }
803+
804+ return true;
805+}
806+
807+} // namespace
808+
809+namespace oxide {
810+
811+PepperFlashMenuHost::PepperFlashMenuHost(
812+ content::RendererPpapiHost* host,
813+ PP_Instance instance,
814+ PP_Resource resource,
815+ const ppapi::proxy::SerializedFlashMenu& serial_menu)
816+ : ppapi::host::ResourceHost(host->GetPpapiHost(), instance, resource),
817+ renderer_ppapi_host_(host),
818+ showing_context_menu_(false),
819+ context_menu_request_id_(0),
820+ has_saved_context_menu_action_(false),
821+ saved_context_menu_action_(0) {
822+ menu_id_map_.push_back(0); // Reserve |menu_id_map_[0]|.
823+ if (!ConvertMenuData(serial_menu.pp_menu(), 0, &menu_data_, &menu_id_map_)) {
824+ menu_data_.clear();
825+ menu_id_map_.clear();
826+ }
827+}
828+
829+PepperFlashMenuHost::~PepperFlashMenuHost() {
830+ if (showing_context_menu_) {
831+ content::RenderFrame* render_frame =
832+ renderer_ppapi_host_->GetRenderFrameForInstance(pp_instance());
833+ if (render_frame) {
834+ render_frame->CancelContextMenu(context_menu_request_id_);
835+ }
836+ }
837+}
838+
839+int32_t PepperFlashMenuHost::OnResourceMessageReceived(
840+ const IPC::Message& msg,
841+ ppapi::host::HostMessageContext* context) {
842+ PPAPI_BEGIN_MESSAGE_MAP(PepperFlashMenuHost, msg)
843+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FlashMenu_Show,
844+ OnHostMsgShow)
845+ PPAPI_END_MESSAGE_MAP()
846+ return PP_ERROR_FAILED;
847+}
848+
849+int32_t PepperFlashMenuHost::OnHostMsgShow(
850+ ppapi::host::HostMessageContext* context,
851+ const PP_Point& location) {
852+ // Note that all early returns must do a SendMenuReply. The sync result for
853+ // this message isn't used, so to forward the error to the plugin, we need to
854+ // additionally call SendMenuReply explicitly.
855+ if (menu_data_.empty()) {
856+ SendMenuReply(PP_ERROR_FAILED, -1);
857+ return PP_ERROR_FAILED;
858+ }
859+ if (showing_context_menu_) {
860+ SendMenuReply(PP_ERROR_INPROGRESS, -1);
861+ return PP_ERROR_INPROGRESS;
862+ }
863+
864+ content::RenderFrame* render_frame =
865+ renderer_ppapi_host_->GetRenderFrameForInstance(pp_instance());
866+
867+ content::ContextMenuParams params;
868+ params.x = location.x;
869+ params.y = location.y;
870+ params.custom_context.is_pepper_menu = true;
871+ params.custom_context.render_widget_id =
872+ renderer_ppapi_host_->GetRoutingIDForWidget(pp_instance());
873+ params.custom_items = menu_data_;
874+
875+ // Transform the position to be in render frame's coordinates.
876+ gfx::Point render_frame_pt = renderer_ppapi_host_->PluginPointToRenderFrame(
877+ pp_instance(), gfx::Point(location.x, location.y));
878+ params.x = render_frame_pt.x();
879+ params.y = render_frame_pt.y();
880+
881+ showing_context_menu_ = true;
882+ context_menu_request_id_ = render_frame->ShowContextMenu(this, params);
883+
884+ // Note: the show message is sync so this OK is for the sync reply which we
885+ // don't actually use (see the comment in the resource file for this). The
886+ // async message containing the context menu action will be sent in the
887+ // future.
888+ return PP_OK;
889+}
890+
891+void PepperFlashMenuHost::OnMenuAction(int request_id, unsigned action) {
892+ // Just save the action.
893+ DCHECK(!has_saved_context_menu_action_);
894+ has_saved_context_menu_action_ = true;
895+ saved_context_menu_action_ = action;
896+}
897+
898+void PepperFlashMenuHost::OnMenuClosed(int request_id) {
899+ if (has_saved_context_menu_action_ &&
900+ saved_context_menu_action_ < menu_id_map_.size()) {
901+ SendMenuReply(PP_OK, menu_id_map_[saved_context_menu_action_]);
902+ has_saved_context_menu_action_ = false;
903+ saved_context_menu_action_ = 0;
904+ } else {
905+ SendMenuReply(PP_ERROR_USERCANCEL, -1);
906+ }
907+
908+ showing_context_menu_ = false;
909+ context_menu_request_id_ = 0;
910+}
911+
912+void PepperFlashMenuHost::SendMenuReply(int32_t result, int action) {
913+ ppapi::host::ReplyMessageContext reply_context(
914+ ppapi::proxy::ResourceMessageReplyParams(pp_resource(), 0),
915+ NULL,
916+ MSG_ROUTING_NONE);
917+ reply_context.params.set_result(result);
918+ host()->SendReply(reply_context, PpapiPluginMsg_FlashMenu_ShowReply(action));
919+}
920+
921+} // oxide
922
923=== added file 'shared/renderer/pepper/oxide_pepper_flash_menu_host.h'
924--- shared/renderer/pepper/oxide_pepper_flash_menu_host.h 1970-01-01 00:00:00 +0000
925+++ shared/renderer/pepper/oxide_pepper_flash_menu_host.h 2015-10-08 02:28:09 +0000
926@@ -0,0 +1,79 @@
927+// vim:expandtab:shiftwidth=2:tabstop=2:
928+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
929+// Use of this source code is governed by a BSD-style license that can be
930+// found in the LICENSE file.
931+
932+#ifndef _OXIDE_SHARED_PEPPER_FLASH_MENU_HOST_H_
933+#define _OXIDE_SHARED_PEPPER_FLASH_MENU_HOST_H_
934+
935+#include <vector>
936+
937+#include "base/compiler_specific.h"
938+#include "content/public/renderer/context_menu_client.h"
939+#include "ppapi/c/pp_point.h"
940+#include "ppapi/host/host_message_context.h"
941+#include "ppapi/host/resource_host.h"
942+
943+namespace content {
944+class RendererPpapiHost;
945+struct MenuItem;
946+}
947+
948+namespace ppapi {
949+namespace proxy {
950+class SerializedFlashMenu;
951+}
952+namespace hsot {
953+class HostMessageContext;
954+}
955+}
956+
957+struct PP_Point;
958+
959+namespace oxide {
960+
961+class PepperFlashMenuHost : public ppapi::host::ResourceHost,
962+ public content::ContextMenuClient {
963+ public:
964+ PepperFlashMenuHost(content::RendererPpapiHost* host,
965+ PP_Instance instance,
966+ PP_Resource resource,
967+ const ppapi::proxy::SerializedFlashMenu& serial_menu);
968+ ~PepperFlashMenuHost() override;
969+
970+ private:
971+ int32_t OnResourceMessageReceived(
972+ const IPC::Message& msg,
973+ ppapi::host::HostMessageContext* context) override;
974+
975+ int32_t OnHostMsgShow(ppapi::host::HostMessageContext* context,
976+ const PP_Point& location);
977+
978+ // ContextMenuClient implementation.
979+ virtual void OnMenuAction(int request_id, unsigned action) override;
980+ virtual void OnMenuClosed(int request_id) override;
981+
982+ void SendMenuReply(int32_t result, int action);
983+
984+ content::RendererPpapiHost* renderer_ppapi_host_;
985+
986+ bool showing_context_menu_;
987+ int context_menu_request_id_;
988+
989+ std::vector<content::MenuItem> menu_data_;
990+
991+ // We send |MenuItem|s, which have an |unsigned| "action" field instead of
992+ // an |int32_t| ID. (CONTENT also limits the range of valid values for
993+ // actions.) This maps actions to IDs.
994+ std::vector<int32_t> menu_id_map_;
995+
996+ // Used to send a single context menu "completion" upon menu close.
997+ bool has_saved_context_menu_action_;
998+ unsigned saved_context_menu_action_;
999+
1000+ DISALLOW_COPY_AND_ASSIGN(PepperFlashMenuHost);
1001+};
1002+
1003+}
1004+
1005+#endif // _OXIDE_SHARED_PEPPER_FLASH_MENU_HOST_H_
1006
1007=== added file 'shared/renderer/pepper/oxide_pepper_flash_renderer_host.cc'
1008--- shared/renderer/pepper/oxide_pepper_flash_renderer_host.cc 1970-01-01 00:00:00 +0000
1009+++ shared/renderer/pepper/oxide_pepper_flash_renderer_host.cc 2015-10-08 02:28:09 +0000
1010@@ -0,0 +1,119 @@
1011+// vim:expandtab:shiftwidth=2:tabstop=2:
1012+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
1013+// Use of this source code is governed by a BSD-style license that can be
1014+// found in the LICENSE file.
1015+
1016+#include "oxide_pepper_flash_renderer_host.h"
1017+
1018+#include "ppapi/host/dispatch_host_message.h"
1019+#include "ppapi/host/host_message_context.h"
1020+#include "ppapi/proxy/host_dispatcher.h"
1021+#include "ppapi/proxy/ppapi_messages.h"
1022+#include "ppapi/proxy/resource_message_params.h"
1023+#include "ppapi/proxy/serialized_structs.h"
1024+#include "ppapi/thunk/enter.h"
1025+#include "ppapi/thunk/ppb_image_data_api.h"
1026+#include "content/public/renderer/renderer_ppapi_host.h"
1027+#include "content/public/renderer/render_thread.h"
1028+#include "content/public/renderer/pepper_plugin_instance.h"
1029+#include "ui/gfx/geometry/rect.h"
1030+
1031+
1032+namespace oxide {
1033+
1034+PepperFlashRendererHost::PepperFlashRendererHost(
1035+ content::RendererPpapiHost* host,
1036+ PP_Instance instance,
1037+ PP_Resource resource)
1038+ : ResourceHost(host->GetPpapiHost(), instance, resource),
1039+ host_(host),
1040+ weak_factory_(this) {}
1041+
1042+PepperFlashRendererHost::~PepperFlashRendererHost() {
1043+}
1044+
1045+int32_t PepperFlashRendererHost::OnResourceMessageReceived(
1046+ const IPC::Message& msg,
1047+ ppapi::host::HostMessageContext* context) {
1048+ PPAPI_BEGIN_MESSAGE_MAP(PepperFlashRendererHost, msg)
1049+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_GetProxyForURL,
1050+ OnGetProxyForURL)
1051+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_SetInstanceAlwaysOnTop,
1052+ OnSetInstanceAlwaysOnTop)
1053+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_DrawGlyphs,
1054+ OnDrawGlyphs)
1055+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_Navigate, OnNavigate)
1056+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_IsRectTopmost,
1057+ OnIsRectTopmost)
1058+ PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Flash_InvokePrinting,
1059+ OnInvokePrinting)
1060+ PPAPI_END_MESSAGE_MAP()
1061+ return PP_ERROR_FAILED;
1062+}
1063+
1064+int32_t PepperFlashRendererHost::OnGetProxyForURL(
1065+ ppapi::host::HostMessageContext* host_context,
1066+ const std::string& url) {
1067+ GURL gurl(url);
1068+ if (!gurl.is_valid())
1069+ return PP_ERROR_FAILED;
1070+ std::string proxy;
1071+ bool result = content::RenderThread::Get()->ResolveProxy(gurl, &proxy);
1072+ if (!result)
1073+ return PP_ERROR_FAILED;
1074+ host_context->reply_msg = PpapiPluginMsg_Flash_GetProxyForURLReply(proxy);
1075+ return PP_OK;
1076+}
1077+
1078+int32_t PepperFlashRendererHost::OnSetInstanceAlwaysOnTop(
1079+ ppapi::host::HostMessageContext* host_context,
1080+ bool on_top) {
1081+ content::PepperPluginInstance* plugin_instance =
1082+ host_->GetPluginInstance(pp_instance());
1083+ if (plugin_instance)
1084+ plugin_instance->SetAlwaysOnTop(on_top);
1085+ // Since no reply is sent for this message, it doesn't make sense to return an
1086+ // error.
1087+ return PP_OK;
1088+}
1089+
1090+int32_t PepperFlashRendererHost::OnDrawGlyphs(
1091+ ppapi::host::HostMessageContext* host_context,
1092+ ppapi::proxy::PPBFlash_DrawGlyphs_Params params) {
1093+ if (params.glyph_indices.size() != params.glyph_advances.size() ||
1094+ params.glyph_indices.empty())
1095+ return PP_ERROR_FAILED;
1096+
1097+ return PP_OK;
1098+}
1099+
1100+int32_t PepperFlashRendererHost::OnNavigate(
1101+ ppapi::host::HostMessageContext* host_context,
1102+ const ppapi::URLRequestInfoData& data,
1103+ const std::string& target,
1104+ bool from_user_action) {
1105+ return PP_OK_COMPLETIONPENDING;
1106+}
1107+
1108+int32_t PepperFlashRendererHost::OnIsRectTopmost(
1109+ ppapi::host::HostMessageContext* host_context,
1110+ const PP_Rect& rect) {
1111+
1112+ content::PepperPluginInstance* plugin_instance =
1113+ host_->GetPluginInstance(pp_instance());
1114+
1115+ if (plugin_instance &&
1116+ plugin_instance->IsRectTopmost(gfx::Rect(
1117+ rect.point.x, rect.point.y, rect.size.width, rect.size.height)))
1118+ return PP_OK;
1119+
1120+ return PP_ERROR_FAILED;
1121+}
1122+
1123+int32_t PepperFlashRendererHost::OnInvokePrinting(
1124+ ppapi::host::HostMessageContext* host_context) {
1125+
1126+ return PP_OK;
1127+}
1128+
1129+} // oxide
1130
1131=== added file 'shared/renderer/pepper/oxide_pepper_flash_renderer_host.h'
1132--- shared/renderer/pepper/oxide_pepper_flash_renderer_host.h 1970-01-01 00:00:00 +0000
1133+++ shared/renderer/pepper/oxide_pepper_flash_renderer_host.h 2015-10-08 02:28:09 +0000
1134@@ -0,0 +1,72 @@
1135+// vim:expandtab:shiftwidth=2:tabstop=2:
1136+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
1137+// Use of this source code is governed by a BSD-style license that can be
1138+// found in the LICENSE file.
1139+
1140+#ifndef _OXIDE_SHARED_PEPPER_FLASH_RENDERER_HOST_H_
1141+#define _OXIDE_SHARED_PEPPER_FLASH_RENDERER_HOST_H_
1142+
1143+#include <string>
1144+#include <vector>
1145+
1146+#include "base/basictypes.h"
1147+#include "base/memory/weak_ptr.h"
1148+#include "ppapi/host/resource_host.h"
1149+
1150+struct PP_Rect;
1151+
1152+namespace ppapi {
1153+struct URLRequestInfoData;
1154+}
1155+
1156+namespace ppapi {
1157+namespace proxy {
1158+struct PPBFlash_DrawGlyphs_Params;
1159+}
1160+namespace host {
1161+class HostMessageContext;
1162+}
1163+}
1164+
1165+namespace content {
1166+class RendererPpapiHost;
1167+}
1168+
1169+
1170+namespace oxide {
1171+
1172+class PepperFlashRendererHost final : public ppapi::host::ResourceHost {
1173+ public:
1174+ PepperFlashRendererHost(content::RendererPpapiHost* host,
1175+ PP_Instance instance,
1176+ PP_Resource resource);
1177+ ~PepperFlashRendererHost();
1178+
1179+ int32_t OnResourceMessageReceived(const IPC::Message& msg,
1180+ ppapi::host::HostMessageContext* context) override;
1181+
1182+ private:
1183+ int32_t OnGetProxyForURL(ppapi::host::HostMessageContext* host_context,
1184+ const std::string& url);
1185+ int32_t OnSetInstanceAlwaysOnTop(
1186+ ppapi::host::HostMessageContext* host_context,
1187+ bool on_top);
1188+ int32_t OnDrawGlyphs(ppapi::host::HostMessageContext* host_context,
1189+ ppapi::proxy::PPBFlash_DrawGlyphs_Params params);
1190+ int32_t OnNavigate(ppapi::host::HostMessageContext* host_context,
1191+ const ppapi::URLRequestInfoData& data,
1192+ const std::string& target,
1193+ bool from_user_action);
1194+ int32_t OnIsRectTopmost(ppapi::host::HostMessageContext* host_context,
1195+ const PP_Rect& rect);
1196+ int32_t OnInvokePrinting(ppapi::host::HostMessageContext* host_context);
1197+
1198+ content::RendererPpapiHost* host_;
1199+ base::WeakPtrFactory<PepperFlashRendererHost> weak_factory_;
1200+
1201+ DISALLOW_COPY_AND_ASSIGN(PepperFlashRendererHost);
1202+};
1203+
1204+} // oxide
1205+
1206+#endif // _OXIDE_SHARED_PEPPER_FLASH_RENDERER_HOST_H_
1207
1208=== added file 'shared/renderer/pepper/oxide_pepper_render_frame_observer.cc'
1209--- shared/renderer/pepper/oxide_pepper_render_frame_observer.cc 1970-01-01 00:00:00 +0000
1210+++ shared/renderer/pepper/oxide_pepper_render_frame_observer.cc 2015-10-08 02:28:09 +0000
1211@@ -0,0 +1,45 @@
1212+// vim:expandtab:shiftwidth=2:tabstop=2:
1213+// Copyright (C) 2014 Canonical Ltd.
1214+
1215+// This library is free software; you can redistribute it and/or
1216+// modify it under the terms of the GNU Lesser General Public
1217+// License as published by the Free Software Foundation; either
1218+// version 2.1 of the License, or (at your option) any later version.
1219+
1220+// This library is distributed in the hope that it will be useful,
1221+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1222+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1223+// Lesser General Public License for more details.
1224+
1225+// You should have received a copy of the GNU Lesser General Public
1226+// License along with this library; if not, write to the Free Software
1227+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1228+
1229+#include "content/public/renderer/renderer_ppapi_host.h"
1230+#include "ppapi/host/ppapi_host.h"
1231+
1232+#include "oxide_pepper_shared_memory_message_filter.h"
1233+#include "oxide_pepper_render_frame_observer.h"
1234+#include "oxide_pepper_renderer_host_factory.h"
1235+
1236+namespace oxide {
1237+
1238+PepperRenderFrameObserver::PepperRenderFrameObserver(
1239+ content::RenderFrame* render_frame)
1240+ : RenderFrameObserver(render_frame) {}
1241+
1242+PepperRenderFrameObserver::~PepperRenderFrameObserver() {}
1243+
1244+void PepperRenderFrameObserver::DidCreatePepperPlugin(content::RendererPpapiHost* host) {
1245+
1246+ host->GetPpapiHost()->AddHostFactoryFilter(
1247+ scoped_ptr<ppapi::host::HostFactory>(
1248+ new PepperRendererHostFactory(host)));
1249+
1250+ host->GetPpapiHost()->AddInstanceMessageFilter(
1251+ scoped_ptr<ppapi::host::InstanceMessageFilter>(
1252+ new ::PepperSharedMemoryMessageFilter(host)));
1253+
1254+}
1255+
1256+} // namespace oxide
1257
1258=== added file 'shared/renderer/pepper/oxide_pepper_render_frame_observer.h'
1259--- shared/renderer/pepper/oxide_pepper_render_frame_observer.h 1970-01-01 00:00:00 +0000
1260+++ shared/renderer/pepper/oxide_pepper_render_frame_observer.h 2015-10-08 02:28:09 +0000
1261@@ -0,0 +1,46 @@
1262+// vim:expandtab:shiftwidth=2:tabstop=2:
1263+// Copyright (C) 2014 Canonical Ltd.
1264+
1265+// This library is free software; you can redistribute it and/or
1266+// modify it under the terms of the GNU Lesser General Public
1267+// License as published by the Free Software Foundation; either
1268+// version 2.1 of the License, or (at your option) any later version.
1269+
1270+// This library is distributed in the hope that it will be useful,
1271+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1272+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1273+// Lesser General Public License for more details.
1274+
1275+// You should have received a copy of the GNU Lesser General Public
1276+// License along with this library; if not, write to the Free Software
1277+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1278+
1279+#ifndef _OXIDE_SHARED_PEPPER_RENDER_FRAME_OBSERVER_H_
1280+#define _OXIDE_SHARED_PEPPER_RENDER_FRAME_OBSERVER_H_
1281+
1282+#include "base/basictypes.h"
1283+#include "base/compiler_specific.h"
1284+#include "content/public/renderer/render_frame_observer.h"
1285+
1286+
1287+namespace content {
1288+class RenderFrame;
1289+}
1290+
1291+namespace oxide {
1292+
1293+class PepperRenderFrameObserver final : public content::RenderFrameObserver {
1294+ public:
1295+ explicit PepperRenderFrameObserver(content::RenderFrame* render_frame);
1296+ ~PepperRenderFrameObserver();
1297+
1298+ void DidCreatePepperPlugin(content::RendererPpapiHost* host) override;
1299+
1300+ private:
1301+ DISALLOW_COPY_AND_ASSIGN(PepperRenderFrameObserver);
1302+};
1303+
1304+} // namespace oxide
1305+
1306+#endif // _OXIDE_SHARED_PEPPER_RENDER_FRAME_OBSERVER_H_
1307+
1308
1309=== added file 'shared/renderer/pepper/oxide_pepper_renderer_host_factory.cc'
1310--- shared/renderer/pepper/oxide_pepper_renderer_host_factory.cc 1970-01-01 00:00:00 +0000
1311+++ shared/renderer/pepper/oxide_pepper_renderer_host_factory.cc 2015-10-08 02:28:09 +0000
1312@@ -0,0 +1,66 @@
1313+// vim:expandtab:shiftwidth=2:tabstop=2:
1314+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
1315+// Use of this source code is governed by a BSD-style license that can be
1316+// found in the LICENSE file.
1317+
1318+#include "oxide_pepper_renderer_host_factory.h"
1319+#include "oxide_pepper_flash_renderer_host.h"
1320+#include "oxide_pepper_flash_menu_host.h"
1321+
1322+#include "content/public/renderer/renderer_ppapi_host.h"
1323+#include "ppapi/host/ppapi_host.h"
1324+#include "ppapi/host/resource_host.h"
1325+#include "ppapi/proxy/ppapi_messages.h"
1326+#include "ppapi/proxy/ppapi_message_utils.h"
1327+#include "ppapi/shared_impl/ppapi_permissions.h"
1328+
1329+
1330+namespace oxide {
1331+
1332+PepperRendererHostFactory::PepperRendererHostFactory(content::RendererPpapiHost* host)
1333+ : host_(host) {}
1334+
1335+PepperRendererHostFactory::~PepperRendererHostFactory()
1336+{}
1337+
1338+scoped_ptr<ppapi::host::ResourceHost> PepperRendererHostFactory::CreateResourceHost(
1339+ ppapi::host::PpapiHost* host,
1340+ PP_Resource resource,
1341+ PP_Instance instance,
1342+ const IPC::Message& message
1343+) {
1344+ DCHECK_EQ(host_->GetPpapiHost(), host);
1345+
1346+ if (!host_->IsValidInstance(instance)) {
1347+ return nullptr;
1348+ }
1349+
1350+ if (host_->GetPpapiHost()->permissions().HasPermission(
1351+ ppapi::PERMISSION_FLASH)) {
1352+ switch (message.type()) {
1353+ case PpapiHostMsg_Flash_Create::ID: {
1354+ return make_scoped_ptr(
1355+ new PepperFlashRendererHost(host_, instance, resource));
1356+ }
1357+// case PpapiHostMsg_FlashFullscreen_Create::ID: {
1358+// return scoped_ptr<ppapi::host::ResourceHost>(new PepperFlashFullscreenHost(
1359+// host_, instance, params.pp_resource()));
1360+// }
1361+ case PpapiHostMsg_FlashMenu_Create::ID: {
1362+ ppapi::proxy::SerializedFlashMenu serialized_menu;
1363+ if (ppapi::UnpackMessage<PpapiHostMsg_FlashMenu_Create>(
1364+ message, &serialized_menu)) {
1365+ return make_scoped_ptr(
1366+ new PepperFlashMenuHost(host_, instance, resource, serialized_menu));
1367+ }
1368+ break;
1369+ }
1370+ default:
1371+ ;
1372+ }
1373+ }
1374+
1375+ return scoped_ptr<ppapi::host::ResourceHost>();
1376+}
1377+
1378+} // oxide
1379
1380=== added file 'shared/renderer/pepper/oxide_pepper_renderer_host_factory.h'
1381--- shared/renderer/pepper/oxide_pepper_renderer_host_factory.h 1970-01-01 00:00:00 +0000
1382+++ shared/renderer/pepper/oxide_pepper_renderer_host_factory.h 2015-10-08 02:28:09 +0000
1383@@ -0,0 +1,44 @@
1384+// vim:expandtab:shiftwidth=2:tabstop=2:
1385+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
1386+// Use of this source code is governed by a BSD-style license that can be
1387+// found in the LICENSE file.
1388+
1389+#ifndef _OXIDE_SHARED_PEPPER_RENDERER_HOST_FACTORY_H_
1390+#define _OXIDE_SHARED_PEPPER_RENDERER_HOST_FACTORY_H_
1391+
1392+#include "base/basictypes.h"
1393+#include "base/compiler_specific.h"
1394+#include "ppapi/host/host_factory.h"
1395+#include "content/public/renderer/render_frame_observer.h"
1396+
1397+namespace ppapi {
1398+namespace host {
1399+class PpapiHost;
1400+class ResourceHost;
1401+}
1402+}
1403+
1404+namespace oxide {
1405+
1406+class PepperRendererHostFactory : public ppapi::host::HostFactory {
1407+ public:
1408+ explicit PepperRendererHostFactory(content::RendererPpapiHost* host);
1409+ ~PepperRendererHostFactory();
1410+
1411+ // HostFactory.
1412+ scoped_ptr<ppapi::host::ResourceHost> CreateResourceHost(
1413+ ppapi::host::PpapiHost* host,
1414+ PP_Resource resource,
1415+ PP_Instance instance,
1416+ const IPC::Message& message) override;
1417+
1418+ private:
1419+ // Not owned by this object.
1420+ content::RendererPpapiHost* host_;
1421+
1422+ DISALLOW_COPY_AND_ASSIGN(PepperRendererHostFactory);
1423+};
1424+
1425+} // namespace oxide
1426+
1427+#endif // _OXIDE_SHARED_PEPPER_RENDERER_HOST_FACTORY_H_
1428
1429=== added file 'shared/renderer/pepper/oxide_pepper_shared_memory_message_filter.cc'
1430--- shared/renderer/pepper/oxide_pepper_shared_memory_message_filter.cc 1970-01-01 00:00:00 +0000
1431+++ shared/renderer/pepper/oxide_pepper_shared_memory_message_filter.cc 2015-10-08 02:28:09 +0000
1432@@ -0,0 +1,72 @@
1433+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
1434+// Use of this source code is governed by a BSD-style license that can be
1435+// found in the LICENSE file.
1436+
1437+#include "chrome/renderer/pepper/pepper_shared_memory_message_filter.h"
1438+
1439+#include "base/memory/scoped_ptr.h"
1440+#include "base/memory/shared_memory.h"
1441+#include "base/process/process_handle.h"
1442+#include "content/public/common/content_client.h"
1443+#include "content/public/renderer/pepper_plugin_instance.h"
1444+#include "content/public/renderer/render_thread.h"
1445+#include "content/public/renderer/renderer_ppapi_host.h"
1446+#include "ppapi/host/ppapi_host.h"
1447+#include "ppapi/proxy/ppapi_messages.h"
1448+#include "ppapi/shared_impl/var_tracker.h"
1449+
1450+PepperSharedMemoryMessageFilter::PepperSharedMemoryMessageFilter(
1451+ content::RendererPpapiHost* host)
1452+ : InstanceMessageFilter(host->GetPpapiHost()), host_(host) {}
1453+
1454+PepperSharedMemoryMessageFilter::~PepperSharedMemoryMessageFilter() {}
1455+
1456+bool PepperSharedMemoryMessageFilter::OnInstanceMessageReceived(
1457+ const IPC::Message& msg) {
1458+ bool handled = true;
1459+ IPC_BEGIN_MESSAGE_MAP(PepperSharedMemoryMessageFilter, msg)
1460+ IPC_MESSAGE_HANDLER(PpapiHostMsg_SharedMemory_CreateSharedMemory,
1461+ OnHostMsgCreateSharedMemory)
1462+ IPC_MESSAGE_UNHANDLED(handled = false)
1463+ IPC_END_MESSAGE_MAP()
1464+ return handled;
1465+}
1466+
1467+bool PepperSharedMemoryMessageFilter::Send(IPC::Message* msg) {
1468+ return host_->GetPpapiHost()->Send(msg);
1469+}
1470+
1471+void PepperSharedMemoryMessageFilter::OnHostMsgCreateSharedMemory(
1472+ PP_Instance instance,
1473+ uint32_t size,
1474+ int* host_handle_id,
1475+ ppapi::proxy::SerializedHandle* plugin_handle) {
1476+ plugin_handle->set_null_shmem();
1477+ *host_handle_id = -1;
1478+ scoped_ptr<base::SharedMemory> shm(content::RenderThread::Get()
1479+ ->HostAllocateSharedMemoryBuffer(size)
1480+ .Pass());
1481+ if (!shm.get())
1482+ return;
1483+
1484+ base::SharedMemoryHandle host_shm_handle;
1485+ shm->ShareToProcess(base::GetCurrentProcessHandle(), &host_shm_handle);
1486+ *host_handle_id =
1487+ content::PepperPluginInstance::Get(instance)
1488+ ->GetVarTracker()
1489+ ->TrackSharedMemoryHandle(instance, host_shm_handle, size);
1490+
1491+ base::PlatformFile host_handle =
1492+#if defined(OS_WIN)
1493+ host_shm_handle;
1494+#elif defined(OS_POSIX)
1495+ host_shm_handle.fd;
1496+#else
1497+#error Not implemented.
1498+#endif
1499+ // We set auto_close to false since we need our file descriptor to
1500+ // actually be duplicated on linux. The shared memory destructor will
1501+ // close the original handle for us.
1502+ plugin_handle->set_shmem(host_->ShareHandleWithRemote(host_handle, false),
1503+ size);
1504+}
1505
1506=== added file 'shared/renderer/pepper/oxide_pepper_shared_memory_message_filter.h'
1507--- shared/renderer/pepper/oxide_pepper_shared_memory_message_filter.h 1970-01-01 00:00:00 +0000
1508+++ shared/renderer/pepper/oxide_pepper_shared_memory_message_filter.h 2015-10-08 02:28:09 +0000
1509@@ -0,0 +1,48 @@
1510+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
1511+// Use of this source code is governed by a BSD-style license that can be
1512+// found in the LICENSE file.
1513+
1514+#ifndef CHROME_RENDERER_PEPPER_PEPPER_SHARED_MEMORY_MESSAGE_FILTER_H_
1515+#define CHROME_RENDERER_PEPPER_PEPPER_SHARED_MEMORY_MESSAGE_FILTER_H_
1516+
1517+#include "base/basictypes.h"
1518+#include "base/compiler_specific.h"
1519+#include "ppapi/c/pp_instance.h"
1520+#include "ppapi/host/instance_message_filter.h"
1521+
1522+namespace content {
1523+class RendererPpapiHost;
1524+}
1525+
1526+namespace ppapi {
1527+namespace proxy {
1528+class SerializedHandle;
1529+}
1530+}
1531+
1532+// Implements the backend for shared memory messages from a plugin process.
1533+class PepperSharedMemoryMessageFilter
1534+ : public ppapi::host::InstanceMessageFilter {
1535+ public:
1536+ explicit PepperSharedMemoryMessageFilter(content::RendererPpapiHost* host);
1537+ virtual ~PepperSharedMemoryMessageFilter();
1538+
1539+ // InstanceMessageFilter:
1540+ virtual bool OnInstanceMessageReceived(const IPC::Message& msg) override;
1541+
1542+ bool Send(IPC::Message* msg);
1543+
1544+ private:
1545+ // Message handlers.
1546+ void OnHostMsgCreateSharedMemory(
1547+ PP_Instance instance,
1548+ uint32_t size,
1549+ int* host_shm_handle_id,
1550+ ppapi::proxy::SerializedHandle* plugin_shm_handle);
1551+
1552+ content::RendererPpapiHost* host_;
1553+
1554+ DISALLOW_COPY_AND_ASSIGN(PepperSharedMemoryMessageFilter);
1555+};
1556+
1557+#endif // CHROME_RENDERER_PEPPER_PEPPER_SHARED_MEMORY_MESSAGE_FILTER_H_
1558
1559=== modified file 'shared/shared.gyp'
1560--- shared/shared.gyp 2015-10-07 13:53:34 +0000
1561+++ shared/shared.gyp 2015-10-08 02:28:09 +0000
1562@@ -549,8 +549,20 @@
1563 'conditions': [
1564 ['enable_plugins==1', {
1565 'sources': [
1566- 'browser/oxide_pepper_host_factory_browser.cc',
1567- 'browser/oxide_pepper_host_factory_browser.h',
1568+ 'browser/pepper/oxide_pepper_host_factory_browser.cc',
1569+ 'browser/pepper/oxide_pepper_host_factory_browser.h',
1570+ 'browser/pepper/oxide_pepper_flash_browser_host.cc',
1571+ 'browser/pepper/oxide_pepper_flash_browser_host.h',
1572+ 'renderer/pepper/oxide_pepper_renderer_host_factory.cc',
1573+ 'renderer/pepper/oxide_pepper_renderer_host_factory.h',
1574+ 'renderer/pepper/oxide_pepper_render_frame_observer.cc',
1575+ 'renderer/pepper/oxide_pepper_render_frame_observer.h',
1576+ 'renderer/pepper/oxide_pepper_flash_renderer_host.cc',
1577+ 'renderer/pepper/oxide_pepper_flash_renderer_host.h',
1578+ 'renderer/pepper/oxide_pepper_flash_menu_host.cc',
1579+ 'renderer/pepper/oxide_pepper_flash_menu_host.h',
1580+ 'renderer/pepper/oxide_pepper_shared_memory_message_filter.cc',
1581+ 'renderer/pepper/oxide_pepper_shared_memory_message_filter.h',
1582 ],
1583 'dependencies': [
1584 '<(DEPTH)/ppapi/ppapi_internal.gyp:ppapi_host',

Subscribers

People subscribed via source and target branches