summaryrefslogtreecommitdiffstats
path: root/content/plugin/plugin_main_mac.mm
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-16 17:23:58 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-16 17:23:58 +0000
commit3c5c6d8d4dd6b6b6fd3115dbbe2b155b9eb207f9 (patch)
tree6832386fa85e7dc6db0e094041b5bd3587dd7748 /content/plugin/plugin_main_mac.mm
parent0590a140d2291f2aebfb54179f1282d798faa6a8 (diff)
downloadchromium_src-3c5c6d8d4dd6b6b6fd3115dbbe2b155b9eb207f9.zip
chromium_src-3c5c6d8d4dd6b6b6fd3115dbbe2b155b9eb207f9.tar.gz
chromium_src-3c5c6d8d4dd6b6b6fd3115dbbe2b155b9eb207f9.tar.bz2
Move plugin code to content.
TBR=avi Review URL: http://codereview.chromium.org/6672048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78386 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/plugin/plugin_main_mac.mm')
-rw-r--r--content/plugin/plugin_main_mac.mm50
1 files changed, 50 insertions, 0 deletions
diff --git a/content/plugin/plugin_main_mac.mm b/content/plugin/plugin_main_mac.mm
new file mode 100644
index 0000000..15f230c
--- /dev/null
+++ b/content/plugin/plugin_main_mac.mm
@@ -0,0 +1,50 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/environment.h"
+#include "base/scoped_ptr.h"
+#include "base/string_util.h"
+#include "content/common/chrome_application_mac.h"
+#include "content/common/plugin_carbon_interpose_constants_mac.h"
+#include "content/plugin/plugin_interpose_util_mac.h"
+
+#if !defined(__LP64__)
+void TrimInterposeEnvironment() {
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+
+ std::string interpose_list;
+ if (!env->GetVar(plugin_interpose_strings::kDYLDInsertLibrariesKey,
+ &interpose_list)) {
+ NOTREACHED() << "No interposing libraries set";
+ return;
+ }
+
+ // The list is a :-separated list of paths. Because we append our interpose
+ // library just before forking in plugin_process_host.cc, the only cases we
+ // need to handle are:
+ // 1) The whole string is "<kInterposeLibraryPath>", so just clear it, or
+ // 2) ":<kInterposeLibraryPath>" is the end of the string, so trim and re-set.
+ std::string interpose_library_path(
+ plugin_interpose_strings::kInterposeLibraryPath);
+ DCHECK_GE(interpose_list.size(), interpose_library_path.size());
+ size_t suffix_offset = interpose_list.size() - interpose_library_path.size();
+ if (suffix_offset == 0 &&
+ interpose_list == interpose_library_path) {
+ env->UnSetVar(plugin_interpose_strings::kDYLDInsertLibrariesKey);
+ } else if (suffix_offset > 0 && interpose_list[suffix_offset - 1] == ':' &&
+ interpose_list.substr(suffix_offset) == interpose_library_path) {
+ std::string trimmed_list = interpose_list.substr(0, suffix_offset - 1);
+ env->SetVar(plugin_interpose_strings::kDYLDInsertLibrariesKey,
+ trimmed_list.c_str());
+ } else {
+ NOTREACHED() << "Missing Carbon interposing library";
+ }
+}
+#endif
+
+void InitializeChromeApplication() {
+ [CrApplication sharedApplication];
+
+ mac_plugin_interposing::SetUpCocoaInterposing();
+}