1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/plugin/chrome_content_plugin_client.h"
7 #if defined(ENABLE_REMOTING)
8 #include "base/files/file_path.h"
9 #include "base/path_service.h"
10 #include "content/public/common/content_paths.h"
11 #include "media/base/media.h"
13 #include "base/logging.h"
14 #include "base/native_library.h"
15 #elif defined(OS_POSIX) && !defined(OS_MACOSX) && defined(USE_NSS_CERTS)
16 #include "crypto/nss_util.h"
20 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
21 #include "gin/v8_initializer.h"
26 void ChromeContentPluginClient::PreSandboxInitialization() {
27 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
28 gin::V8Initializer::LoadV8Snapshot();
29 gin::V8Initializer::LoadV8Natives();
32 #if defined(ENABLE_REMOTING)
34 // Load crypto libraries for the Chromoting client plugin.
35 #if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(USE_NSS_CERTS)
36 // On platforms where we use system NSS libraries, the .so's must be loaded
37 // before the sandbox is initialized.
38 crypto::ForceNSSNoDBInit();
39 crypto::EnsureNSSInit();
41 // crypt32.dll is used to decode X509 certificates for Chromoting.
42 base::NativeLibraryLoadError error
;
43 if (base::LoadNativeLibrary(base::FilePath(L
"crypt32.dll"), &error
) == NULL
)
44 LOG(ERROR
) << "Failed to load crypto32.dll: " << error
.ToString();
45 #endif // defined(OS_WIN)
47 // Initialize media libraries for the Chromoting client plugin.
48 media::InitializeMediaLibrary();
50 #endif // defined(ENABLE_REMOTING)