| 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 "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 int child_process_id, | 379 int child_process_id, |
| 380 content::FileDescriptorInfo* mappings) { | 380 content::FileDescriptorInfo* mappings) { |
| 381 int crash_signal_fd = GetCrashSignalFD(command_line); | 381 int crash_signal_fd = GetCrashSignalFD(command_line); |
| 382 if (crash_signal_fd >= 0) { | 382 if (crash_signal_fd >= 0) { |
| 383 mappings->Share(kCrashDumpSignal, crash_signal_fd); | 383 mappings->Share(kCrashDumpSignal, crash_signal_fd); |
| 384 } | 384 } |
| 385 } | 385 } |
| 386 #endif // defined(OS_ANDROID) | 386 #endif // defined(OS_ANDROID) |
| 387 | 387 |
| 388 #if defined(OS_WIN) | 388 #if defined(OS_WIN) |
| 389 void ShellContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy, | 389 bool ShellContentBrowserClient::PreSpawnRenderer( |
| 390 bool* success) { | 390 sandbox::TargetPolicy* policy) { |
| 391 // Add sideloaded font files for testing. See also DIR_WINDOWS_FONTS | 391 // Add sideloaded font files for testing. See also DIR_WINDOWS_FONTS |
| 392 // addition in |StartSandboxedProcess|. | 392 // addition in |StartSandboxedProcess|. |
| 393 std::vector<std::string> font_files = switches::GetSideloadFontFiles(); | 393 std::vector<std::string> font_files = switches::GetSideloadFontFiles(); |
| 394 for (std::vector<std::string>::const_iterator i(font_files.begin()); | 394 for (std::vector<std::string>::const_iterator i(font_files.begin()); |
| 395 i != font_files.end(); | 395 i != font_files.end(); |
| 396 ++i) { | 396 ++i) { |
| 397 policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, | 397 policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, |
| 398 sandbox::TargetPolicy::FILES_ALLOW_READONLY, | 398 sandbox::TargetPolicy::FILES_ALLOW_READONLY, |
| 399 base::UTF8ToWide(*i).c_str()); | 399 base::UTF8ToWide(*i).c_str()); |
| 400 } | 400 } |
| 401 return true; |
| 401 } | 402 } |
| 402 #endif // OS_WIN | 403 #endif // OS_WIN |
| 403 | 404 |
| 404 ShellBrowserContext* ShellContentBrowserClient::browser_context() { | 405 ShellBrowserContext* ShellContentBrowserClient::browser_context() { |
| 405 return shell_browser_main_parts_->browser_context(); | 406 return shell_browser_main_parts_->browser_context(); |
| 406 } | 407 } |
| 407 | 408 |
| 408 ShellBrowserContext* | 409 ShellBrowserContext* |
| 409 ShellContentBrowserClient::off_the_record_browser_context() { | 410 ShellContentBrowserClient::off_the_record_browser_context() { |
| 410 return shell_browser_main_parts_->off_the_record_browser_context(); | 411 return shell_browser_main_parts_->off_the_record_browser_context(); |
| 411 } | 412 } |
| 412 | 413 |
| 413 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { | 414 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { |
| 414 return new ShellAccessTokenStore(browser_context()); | 415 return new ShellAccessTokenStore(browser_context()); |
| 415 } | 416 } |
| 416 | 417 |
| 417 ShellBrowserContext* | 418 ShellBrowserContext* |
| 418 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( | 419 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( |
| 419 BrowserContext* content_browser_context) { | 420 BrowserContext* content_browser_context) { |
| 420 if (content_browser_context == browser_context()) | 421 if (content_browser_context == browser_context()) |
| 421 return browser_context(); | 422 return browser_context(); |
| 422 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); | 423 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); |
| 423 return off_the_record_browser_context(); | 424 return off_the_record_browser_context(); |
| 424 } | 425 } |
| 425 | 426 |
| 426 } // namespace content | 427 } // namespace content |
| OLD | NEW |