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

Side by Side Diff: content/plugin/plugin_main_mac.mm

Issue 303293002: Initialize the bootstrap sandbox in the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename constant Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/common/sandbox_type_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <AppKit/AppKit.h> 5 #import <AppKit/AppKit.h>
6 #include <servers/bootstrap.h>
6 7
7 #include "base/environment.h" 8 #include "base/environment.h"
9 #include "base/mac/mach_logging.h"
8 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
10 #include "content/common/plugin_carbon_interpose_constants_mac.h" 12 #include "content/common/plugin_carbon_interpose_constants_mac.h"
13 #include "content/common/sandbox_init_mac.h"
11 #include "content/plugin/plugin_interpose_util_mac.h" 14 #include "content/plugin/plugin_interpose_util_mac.h"
12 #include "content/public/common/content_client.h" 15 #include "content/public/common/content_client.h"
13 16
14 namespace content { 17 namespace content {
15 18
16 #if !defined(__LP64__) 19 #if !defined(__LP64__)
17 void TrimInterposeEnvironment() { 20 void TrimInterposeEnvironment() {
18 scoped_ptr<base::Environment> env(base::Environment::Create()); 21 scoped_ptr<base::Environment> env(base::Environment::Create());
19 22
20 std::string interpose_list; 23 std::string interpose_list;
(...skipping 18 matching lines...) Expand all
39 interpose_list.substr(suffix_offset) == interpose_library_path) { 42 interpose_list.substr(suffix_offset) == interpose_library_path) {
40 std::string trimmed_list = interpose_list.substr(0, suffix_offset - 1); 43 std::string trimmed_list = interpose_list.substr(0, suffix_offset - 1);
41 env->SetVar(kDYLDInsertLibrariesKey, trimmed_list.c_str()); 44 env->SetVar(kDYLDInsertLibrariesKey, trimmed_list.c_str());
42 } else { 45 } else {
43 NOTREACHED() << "Missing Carbon interposing library"; 46 NOTREACHED() << "Missing Carbon interposing library";
44 } 47 }
45 } 48 }
46 #endif 49 #endif
47 50
48 void InitializeChromeApplication() { 51 void InitializeChromeApplication() {
52 // The bootstrap sandbox has taken over the bootstrap port. However, NPAPI
53 // plugins request servers with the BOOTSTRAP_PER_PID_SERVICE flag. This
54 // will fail, since the browser will be forwarding the message on behalf of
55 // the plugin, and the browser has already created these per-pid services
56 // for itself.
57 //
58 // Instead, request the real bootstrap port from the sandbox server, which
59 // can then be used by the plugin.
60 mach_port_t new_bootstrap_port = MACH_PORT_NULL;
61 kern_return_t kr = bootstrap_look_up(bootstrap_port,
62 kBootstrapPortNameForNPAPIPlugins, &new_bootstrap_port);
63 BOOTSTRAP_LOG_IF(ERROR, kr != KERN_SUCCESS, kr)
64 << "Failed to look up original bootstrap port.";
65 if (kr == KERN_SUCCESS) {
66 bootstrap_port = new_bootstrap_port;
67 kr = task_set_bootstrap_port(mach_task_self(), new_bootstrap_port);
68 MACH_LOG_IF(ERROR, kr != KERN_SUCCESS, kr)
69 << "Failed to reset TASK_BOOTSTRAP_PORT.";
70 }
71
72
49 [NSApplication sharedApplication]; 73 [NSApplication sharedApplication];
50 mac_plugin_interposing::SetUpCocoaInterposing(); 74 mac_plugin_interposing::SetUpCocoaInterposing();
51 } 75 }
52 76
53 } // namespace content 77 } // namespace content
OLDNEW
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/common/sandbox_type_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698