| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/shell/browser/shell_content_browser_client.h" | 5 #include "content/shell/browser/shell_content_browser_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "content/shell/android/shell_descriptors.h" | 47 #include "content/shell/android/shell_descriptors.h" |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 50 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 51 #include "base/debug/leak_annotations.h" | 51 #include "base/debug/leak_annotations.h" |
| 52 #include "components/crash/content/app/breakpad_linux.h" | 52 #include "components/crash/content/app/breakpad_linux.h" |
| 53 #include "components/crash/content/browser/crash_handler_host_linux.h" | 53 #include "components/crash/content/browser/crash_handler_host_linux.h" |
| 54 #include "content/public/common/content_descriptors.h" | 54 #include "content/public/common/content_descriptors.h" |
| 55 #endif | 55 #endif |
| 56 | 56 |
| 57 #if defined(OS_WIN) | |
| 58 #include "content/common/sandbox_win.h" | |
| 59 #include "sandbox/win/src/sandbox.h" | |
| 60 #endif | |
| 61 | |
| 62 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) | 57 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) |
| 63 #include "media/mojo/services/mojo_media_application_factory.h" | 58 #include "media/mojo/services/mojo_media_application_factory.h" |
| 64 #endif | 59 #endif |
| 65 | 60 |
| 66 namespace content { | 61 namespace content { |
| 67 | 62 |
| 68 namespace { | 63 namespace { |
| 69 | 64 |
| 70 ShellContentBrowserClient* g_browser_client; | 65 ShellContentBrowserClient* g_browser_client; |
| 71 bool g_swap_processes_for_redirect = false; | 66 bool g_swap_processes_for_redirect = false; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 const base::CommandLine& command_line, | 353 const base::CommandLine& command_line, |
| 359 int child_process_id, | 354 int child_process_id, |
| 360 content::FileDescriptorInfo* mappings) { | 355 content::FileDescriptorInfo* mappings) { |
| 361 int crash_signal_fd = GetCrashSignalFD(command_line); | 356 int crash_signal_fd = GetCrashSignalFD(command_line); |
| 362 if (crash_signal_fd >= 0) { | 357 if (crash_signal_fd >= 0) { |
| 363 mappings->Share(kCrashDumpSignal, crash_signal_fd); | 358 mappings->Share(kCrashDumpSignal, crash_signal_fd); |
| 364 } | 359 } |
| 365 } | 360 } |
| 366 #endif // defined(OS_ANDROID) | 361 #endif // defined(OS_ANDROID) |
| 367 | 362 |
| 368 #if defined(OS_WIN) | |
| 369 bool ShellContentBrowserClient::PreSpawnRenderer( | |
| 370 sandbox::TargetPolicy* policy) { | |
| 371 // Add sideloaded font files for testing. See also DIR_WINDOWS_FONTS | |
| 372 // addition in |StartSandboxedProcess|. | |
| 373 std::vector<std::string> font_files = switches::GetSideloadFontFiles(); | |
| 374 for (std::vector<std::string>::const_iterator i(font_files.begin()); | |
| 375 i != font_files.end(); | |
| 376 ++i) { | |
| 377 policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, | |
| 378 sandbox::TargetPolicy::FILES_ALLOW_READONLY, | |
| 379 base::UTF8ToWide(*i).c_str()); | |
| 380 } | |
| 381 return true; | |
| 382 } | |
| 383 #endif // OS_WIN | |
| 384 | |
| 385 ShellBrowserContext* ShellContentBrowserClient::browser_context() { | 363 ShellBrowserContext* ShellContentBrowserClient::browser_context() { |
| 386 return shell_browser_main_parts_->browser_context(); | 364 return shell_browser_main_parts_->browser_context(); |
| 387 } | 365 } |
| 388 | 366 |
| 389 ShellBrowserContext* | 367 ShellBrowserContext* |
| 390 ShellContentBrowserClient::off_the_record_browser_context() { | 368 ShellContentBrowserClient::off_the_record_browser_context() { |
| 391 return shell_browser_main_parts_->off_the_record_browser_context(); | 369 return shell_browser_main_parts_->off_the_record_browser_context(); |
| 392 } | 370 } |
| 393 | 371 |
| 394 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { | 372 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { |
| 395 return new ShellAccessTokenStore(browser_context()); | 373 return new ShellAccessTokenStore(browser_context()); |
| 396 } | 374 } |
| 397 | 375 |
| 398 ShellBrowserContext* | 376 ShellBrowserContext* |
| 399 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( | 377 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( |
| 400 BrowserContext* content_browser_context) { | 378 BrowserContext* content_browser_context) { |
| 401 if (content_browser_context == browser_context()) | 379 if (content_browser_context == browser_context()) |
| 402 return browser_context(); | 380 return browser_context(); |
| 403 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); | 381 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); |
| 404 return off_the_record_browser_context(); | 382 return off_the_record_browser_context(); |
| 405 } | 383 } |
| 406 | 384 |
| 407 } // namespace content | 385 } // namespace content |
| OLD | NEW |