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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 1185333003: Implement GetSandboxType() on all platforms and implement for all process types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 #include "content/public/browser/child_process_security_policy.h" 114 #include "content/public/browser/child_process_security_policy.h"
115 #include "content/public/browser/client_certificate_delegate.h" 115 #include "content/public/browser/client_certificate_delegate.h"
116 #include "content/public/browser/render_frame_host.h" 116 #include "content/public/browser/render_frame_host.h"
117 #include "content/public/browser/render_process_host.h" 117 #include "content/public/browser/render_process_host.h"
118 #include "content/public/browser/render_view_host.h" 118 #include "content/public/browser/render_view_host.h"
119 #include "content/public/browser/resource_context.h" 119 #include "content/public/browser/resource_context.h"
120 #include "content/public/browser/site_instance.h" 120 #include "content/public/browser/site_instance.h"
121 #include "content/public/browser/web_contents.h" 121 #include "content/public/browser/web_contents.h"
122 #include "content/public/common/child_process_host.h" 122 #include "content/public/common/child_process_host.h"
123 #include "content/public/common/content_descriptors.h" 123 #include "content/public/common/content_descriptors.h"
124 #include "content/public/common/sandbox_type.h"
124 #include "content/public/common/service_registry.h" 125 #include "content/public/common/service_registry.h"
125 #include "content/public/common/url_utils.h" 126 #include "content/public/common/url_utils.h"
126 #include "content/public/common/web_preferences.h" 127 #include "content/public/common/web_preferences.h"
127 #include "device/devices_app/public/cpp/constants.h" 128 #include "device/devices_app/public/cpp/constants.h"
128 #include "device/devices_app/public/cpp/devices_app_factory.h" 129 #include "device/devices_app/public/cpp/devices_app_factory.h"
129 #include "gin/v8_initializer.h" 130 #include "gin/v8_initializer.h"
130 #include "mojo/application/public/cpp/application_delegate.h" 131 #include "mojo/application/public/cpp/application_delegate.h"
131 #include "net/base/mime_util.h" 132 #include "net/base/mime_util.h"
132 #include "net/cookies/canonical_cookie.h" 133 #include "net/cookies/canonical_cookie.h"
133 #include "net/cookies/cookie_options.h" 134 #include "net/cookies/cookie_options.h"
(...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2324 } 2325 }
2325 #endif // defined(OS_ANDROID) 2326 #endif // defined(OS_ANDROID)
2326 } 2327 }
2327 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) 2328 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
2328 2329
2329 #if defined(OS_WIN) 2330 #if defined(OS_WIN)
2330 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { 2331 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() {
2331 return chrome::kBrowserResourcesDll; 2332 return chrome::kBrowserResourcesDll;
2332 } 2333 }
2333 2334
2335 base::string16 ChromeContentBrowserClient::GetAppContainerSidForSandboxType(
2336 int sandbox_type) const {
2337 // TODO(wfh): Create specific SID for each channel.
2338 #if defined(GOOGLE_CHROME_BUILD)
2339 const wchar_t kAppContainerPrefix[] =
2340 L"S-1-15-2-3251537155-1984446955-2931258699-841473695-1938553385-"
2341 L"924012148-";
2342 #else
2343 const wchar_t kAppContainerPrefix[] =
2344 L"S-1-15-2-3251537155-1984446955-2931258699-841473695-1938553385-"
2345 L"924012149-";
2346 #endif
2347 base::string16 sid(kAppContainerPrefix);
2348
2349 // Only PPAPI and renderer processes enjoy being inside App Containers at the
2350 // moment.
2351 switch (sandbox_type) {
2352 case content::SANDBOX_TYPE_RENDERER:
2353 return sid + L"129201922";
2354 case content::SANDBOX_TYPE_PPAPI:
2355 return sid + L"129201924";
2356 }
2357
2358 return base::string16();
2359 }
2360
2334 void ChromeContentBrowserClient::PreSpawnRenderer( 2361 void ChromeContentBrowserClient::PreSpawnRenderer(
2335 sandbox::TargetPolicy* policy, 2362 sandbox::TargetPolicy* policy,
2336 bool* success) { 2363 bool* success) {
2337 // This code is duplicated in nacl_exe_win_64.cc. 2364 // This code is duplicated in nacl_exe_win_64.cc.
2338 // Allow the server side of a pipe restricted to the "chrome.nacl." 2365 // Allow the server side of a pipe restricted to the "chrome.nacl."
2339 // namespace so that it cannot impersonate other system or other chrome 2366 // namespace so that it cannot impersonate other system or other chrome
2340 // service pipes. 2367 // service pipes.
2341 sandbox::ResultCode result = policy->AddRule( 2368 sandbox::ResultCode result = policy->AddRule(
2342 sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, 2369 sandbox::TargetPolicy::SUBSYS_NAMED_PIPES,
2343 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, 2370 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY,
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 switches::kDisableWebRtcEncryption, 2521 switches::kDisableWebRtcEncryption,
2495 }; 2522 };
2496 to_command_line->CopySwitchesFrom(from_command_line, 2523 to_command_line->CopySwitchesFrom(from_command_line,
2497 kWebRtcDevSwitchNames, 2524 kWebRtcDevSwitchNames,
2498 arraysize(kWebRtcDevSwitchNames)); 2525 arraysize(kWebRtcDevSwitchNames));
2499 } 2526 }
2500 } 2527 }
2501 #endif // defined(ENABLE_WEBRTC) 2528 #endif // defined(ENABLE_WEBRTC)
2502 2529
2503 } // namespace chrome 2530 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698