Commit 69211e8c authored by jam@chromium.org's avatar jam@chromium.org

Get the path of the plugin interposing library from the embedder, since...

Get the path of the plugin interposing library from the embedder, since they're the ones who bundle it. Make content still work without it. This allows plugins to work inside content_shell.

BUG=90448
Review URL: https://chromiumcodereview.appspot.com/10806075

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147965 0039d316-1c4b-4281-b951-d872f2087c98
parent 744ec5b2
...@@ -75,6 +75,9 @@ const char kGTalkPluginMimeType[] ="application/googletalk"; ...@@ -75,6 +75,9 @@ const char kGTalkPluginMimeType[] ="application/googletalk";
const char kGTalkPluginExtension[] = ".googletalk"; const char kGTalkPluginExtension[] = ".googletalk";
const char kGTalkPluginDescription[] = "Google Talk Plugin"; const char kGTalkPluginDescription[] = "Google Talk Plugin";
const char kInterposeLibraryPath[] =
"@executable_path/../../../libplugin_carbon_interpose.dylib";
#if defined(ENABLE_REMOTING) #if defined(ENABLE_REMOTING)
#if defined(GOOGLE_CHROME_BUILD) #if defined(GOOGLE_CHROME_BUILD)
const char kRemotingViewerPluginName[] = "Chrome Remote Desktop Viewer"; const char kRemotingViewerPluginName[] = "Chrome Remote Desktop Viewer";
...@@ -532,6 +535,10 @@ bool ChromeContentClient::GetSandboxProfileForSandboxType( ...@@ -532,6 +535,10 @@ bool ChromeContentClient::GetSandboxProfileForSandboxType(
} }
return false; return false;
} }
std::string ChromeContentClient::GetCarbonInterposePath() const {
return std::string(kInterposeLibraryPath);
}
#endif #endif
bool ChromeContentClient::GetBundledFieldTrialPepperFlash( bool ChromeContentClient::GetBundledFieldTrialPepperFlash(
......
...@@ -46,6 +46,7 @@ class ChromeContentClient : public content::ContentClient { ...@@ -46,6 +46,7 @@ class ChromeContentClient : public content::ContentClient {
virtual bool GetSandboxProfileForSandboxType( virtual bool GetSandboxProfileForSandboxType(
int sandbox_type, int sandbox_type,
int* sandbox_profile_resource_id) const OVERRIDE; int* sandbox_profile_resource_id) const OVERRIDE;
virtual std::string GetCarbonInterposePath() const OVERRIDE;
#endif #endif
// Gets information about the bundled Pepper Flash for field trial. // Gets information about the bundled Pepper Flash for field trial.
......
...@@ -261,14 +261,17 @@ bool PluginProcessHost::Init(const webkit::WebPluginInfo& info) { ...@@ -261,14 +261,17 @@ bool PluginProcessHost::Init(const webkit::WebPluginInfo& info) {
#if defined(OS_POSIX) #if defined(OS_POSIX)
base::EnvironmentVector env; base::EnvironmentVector env;
#if defined(OS_MACOSX) && !defined(__LP64__) #if defined(OS_MACOSX) && !defined(__LP64__)
// Add our interposing library for Carbon. This is stripped back out in std::string interpose_list =
// plugin_main.cc, so changes here should be reflected there. content::GetContentClient()->GetCarbonInterposePath();
std::string interpose_list(plugin_interpose_strings::kInterposeLibraryPath); if (!interpose_list.empty()) {
const char* existing_list = // Add our interposing library for Carbon. This is stripped back out in
getenv(plugin_interpose_strings::kDYLDInsertLibrariesKey); // plugin_main.cc, so changes here should be reflected there.
if (existing_list) { const char* existing_list =
interpose_list.insert(0, ":"); getenv(plugin_interpose_strings::kDYLDInsertLibrariesKey);
interpose_list.insert(0, existing_list); if (existing_list) {
interpose_list.insert(0, ":");
interpose_list.insert(0, existing_list);
}
} }
env.push_back(std::pair<std::string, std::string>( env.push_back(std::pair<std::string, std::string>(
plugin_interpose_strings::kDYLDInsertLibrariesKey, plugin_interpose_strings::kDYLDInsertLibrariesKey,
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
namespace plugin_interpose_strings { namespace plugin_interpose_strings {
const char kDYLDInsertLibrariesKey[] = "DYLD_INSERT_LIBRARIES"; const char kDYLDInsertLibrariesKey[] = "DYLD_INSERT_LIBRARIES";
const char kInterposeLibraryPath[] =
"@executable_path/../../../libplugin_carbon_interpose.dylib";
} // namespace plugin_interpose_strings } // namespace plugin_interpose_strings
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace plugin_interpose_strings { namespace plugin_interpose_strings {
extern const char kDYLDInsertLibrariesKey[]; extern const char kDYLDInsertLibrariesKey[];
extern const char kInterposeLibraryPath[];
} // namespace plugin_interpose_strings } // namespace plugin_interpose_strings
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/string_util.h" #include "base/string_util.h"
#include "content/common/plugin_carbon_interpose_constants_mac.h" #include "content/common/plugin_carbon_interpose_constants_mac.h"
#include "content/plugin/plugin_interpose_util_mac.h" #include "content/plugin/plugin_interpose_util_mac.h"
#include "content/public/common/content_client.h"
#if !defined(__LP64__) #if !defined(__LP64__)
void TrimInterposeEnvironment() { void TrimInterposeEnvironment() {
...@@ -17,7 +18,7 @@ void TrimInterposeEnvironment() { ...@@ -17,7 +18,7 @@ void TrimInterposeEnvironment() {
std::string interpose_list; std::string interpose_list;
if (!env->GetVar(plugin_interpose_strings::kDYLDInsertLibrariesKey, if (!env->GetVar(plugin_interpose_strings::kDYLDInsertLibrariesKey,
&interpose_list)) { &interpose_list)) {
NOTREACHED() << "No interposing libraries set"; LOG(INFO) << "No Carbon Interpose library found.";
return; return;
} }
...@@ -26,8 +27,8 @@ void TrimInterposeEnvironment() { ...@@ -26,8 +27,8 @@ void TrimInterposeEnvironment() {
// need to handle are: // need to handle are:
// 1) The whole string is "<kInterposeLibraryPath>", so just clear it, or // 1) The whole string is "<kInterposeLibraryPath>", so just clear it, or
// 2) ":<kInterposeLibraryPath>" is the end of the string, so trim and re-set. // 2) ":<kInterposeLibraryPath>" is the end of the string, so trim and re-set.
std::string interpose_library_path( std::string interpose_library_path =
plugin_interpose_strings::kInterposeLibraryPath); content::GetContentClient()->GetCarbonInterposePath();
DCHECK_GE(interpose_list.size(), interpose_library_path.size()); DCHECK_GE(interpose_list.size(), interpose_library_path.size());
size_t suffix_offset = interpose_list.size() - interpose_library_path.size(); size_t suffix_offset = interpose_list.size() - interpose_library_path.size();
if (suffix_offset == 0 && if (suffix_offset == 0 &&
......
...@@ -85,6 +85,10 @@ bool ContentClient::GetSandboxProfileForSandboxType( ...@@ -85,6 +85,10 @@ bool ContentClient::GetSandboxProfileForSandboxType(
int* sandbox_profile_resource_id) const { int* sandbox_profile_resource_id) const {
return false; return false;
} }
std::string ContentClient::GetCarbonInterposePath() const {
return std::string();
}
#endif #endif
} // namespace content } // namespace content
...@@ -139,6 +139,10 @@ class CONTENT_EXPORT ContentClient { ...@@ -139,6 +139,10 @@ class CONTENT_EXPORT ContentClient {
virtual bool GetSandboxProfileForSandboxType( virtual bool GetSandboxProfileForSandboxType(
int sandbox_type, int sandbox_type,
int* sandbox_profile_resource_id) const; int* sandbox_profile_resource_id) const;
// Gets the Carbon interposing path to give to DYLD. Returns an empty string
// if the embedder doesn't bundle it.
virtual std::string GetCarbonInterposePath() const;
#endif #endif
void set_browser_for_testing(ContentBrowserClient* c) { browser_ = c; } void set_browser_for_testing(ContentBrowserClient* c) { browser_ = c; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment