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

Unified Diff: chrome/renderer/pepper/ppb_nacl_private_impl.cc

Issue 10173029: Add a PPB_Flash_Print interface and implement in Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/pepper/ppb_nacl_private_impl.h ('k') | chrome/renderer/pepper/ppb_pdf_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/pepper/ppb_nacl_private_impl.cc
diff --git a/chrome/renderer/chrome_ppapi_interfaces.cc b/chrome/renderer/pepper/ppb_nacl_private_impl.cc
similarity index 67%
rename from chrome/renderer/chrome_ppapi_interfaces.cc
rename to chrome/renderer/pepper/ppb_nacl_private_impl.cc
index cbd9d7d9639116946b844ea60457f9f5aaa59a80..00b4f1442828e00eb62c33c198397e211fc53ca9 100644
--- a/chrome/renderer/chrome_ppapi_interfaces.cc
+++ b/chrome/renderer/pepper/ppb_nacl_private_impl.cc
@@ -2,55 +2,44 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/renderer/chrome_ppapi_interfaces.h"
+#include "chrome/renderer/pepper/ppb_nacl_private_impl.h"
+
+#ifndef DISABLE_NACL
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/rand_util_c.h"
-#include "base/utf_string_conversions.h"
#include "chrome/common/render_messages.h"
-#include "chrome/renderer/chrome_ppb_pdf_impl.h"
#include "content/public/common/content_switches.h"
#include "content/public/renderer/render_thread.h"
#include "ipc/ipc_sync_message_filter.h"
-#include "ppapi/c/private/ppb_nacl_private.h"
-#include "ppapi/c/private/ppb_pdf.h"
-#include "webkit/plugins/ppapi/ppapi_interface_factory.h"
-
-#if !defined(DISABLE_NACL)
#include "native_client/src/shared/imc/nacl_imc.h"
+#include "ppapi/c/private/ppb_nacl_private.h"
#include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h"
-#endif
#if defined(OS_WIN)
#include "content/public/common/sandbox_init.h"
#endif
-using content::RenderThread;
-
-namespace chrome {
-
-#if !defined(DISABLE_NACL)
namespace {
+
base::LazyInstance<scoped_refptr<IPC::SyncMessageFilter> >
g_background_thread_sender = LAZY_INSTANCE_INITIALIZER;
-} // namespace
// Launch NaCl's sel_ldr process.
bool LaunchSelLdr(const char* alleged_url, int socket_count,
void* imc_handles, void* nacl_process_handle,
int* nacl_process_id) {
std::vector<nacl::FileDescriptor> sockets;
- IPC::Message::Sender* sender = RenderThread::Get();
- if (sender == NULL) {
+ IPC::Message::Sender* sender = content::RenderThread::Get();
+ if (sender == NULL)
sender = g_background_thread_sender.Pointer()->get();
- }
- if (!sender->Send(
- new ChromeViewHostMsg_LaunchNaCl(
- GURL(alleged_url), socket_count, &sockets))) {
+
+ if (!sender->Send(new ChromeViewHostMsg_LaunchNaCl(
+ GURL(alleged_url), socket_count, &sockets)))
return false;
- }
+
CHECK(static_cast<int>(sockets.size()) == socket_count);
for (int i = 0; i < socket_count; i++) {
static_cast<nacl::Handle*>(imc_handles)[i] =
@@ -78,7 +67,7 @@ bool Are3DInterfacesDisabled() {
void EnableBackgroundSelLdrLaunch() {
g_background_thread_sender.Get() =
- RenderThread::Get()->GetSyncMessageFilter();
+ content::RenderThread::Get()->GetSyncMessageFilter();
}
int BrokerDuplicateHandle(void* source_handle,
@@ -95,7 +84,7 @@ int BrokerDuplicateHandle(void* source_handle,
#endif
}
-const PPB_NaCl_Private ppb_nacl = {
+const PPB_NaCl_Private nacl_interface = {
&LaunchSelLdr,
&UrandomFD,
&Are3DInterfacesDisabled,
@@ -103,24 +92,10 @@ const PPB_NaCl_Private ppb_nacl = {
&BrokerDuplicateHandle,
};
-class PPB_NaCl_Impl {
- public:
- // Returns a pointer to the interface implementing PPB_NaCl_Private that is
- // exposed to the plugin.
- static const PPB_NaCl_Private* GetInterface() {
- return &ppb_nacl;
- }
-};
-#endif // DISABLE_NACL
+} // namespace
-const void* ChromePPAPIInterfaceFactory(const std::string& interface_name) {
-#if !defined(DISABLE_NACL)
- if (interface_name == PPB_NACL_PRIVATE_INTERFACE)
- return chrome::PPB_NaCl_Impl::GetInterface();
-#endif // DISABLE_NACL
- if (interface_name == PPB_PDF_INTERFACE)
- return chrome::PPB_PDF_Impl::GetInterface();
- return NULL;
+const PPB_NaCl_Private* PPB_NaCl_Private_Impl::GetInterface() {
+ return &nacl_interface;
}
-} // namespace chrome
+#endif // DISABLE_NACL
« no previous file with comments | « chrome/renderer/pepper/ppb_nacl_private_impl.h ('k') | chrome/renderer/pepper/ppb_pdf_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698