| OLD | NEW |
| 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 2383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2394 for (size_t i = 0; i < extra_parts_.size(); ++i) { | 2394 for (size_t i = 0; i < extra_parts_.size(); ++i) { |
| 2395 extra_parts_[i]->GetAdditionalFileSystemBackends( | 2395 extra_parts_[i]->GetAdditionalFileSystemBackends( |
| 2396 browser_context, storage_partition_path, additional_backends); | 2396 browser_context, storage_partition_path, additional_backends); |
| 2397 } | 2397 } |
| 2398 } | 2398 } |
| 2399 | 2399 |
| 2400 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 2400 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 2401 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 2401 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
| 2402 const CommandLine& command_line, | 2402 const CommandLine& command_line, |
| 2403 int child_process_id, | 2403 int child_process_id, |
| 2404 std::vector<FileDescriptorInfo>* mappings) { | 2404 FileDescriptorInfo* mappings) { |
| 2405 #if defined(OS_ANDROID) | 2405 #if defined(OS_ANDROID) |
| 2406 base::FilePath data_path; | 2406 base::FilePath data_path; |
| 2407 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); | 2407 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); |
| 2408 DCHECK(!data_path.empty()); | 2408 DCHECK(!data_path.empty()); |
| 2409 | 2409 |
| 2410 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; | 2410 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; |
| 2411 base::FilePath chrome_resources_pak = | 2411 base::FilePath chrome_resources_pak = |
| 2412 data_path.AppendASCII("chrome_100_percent.pak"); | 2412 data_path.AppendASCII("chrome_100_percent.pak"); |
| 2413 base::File file(chrome_resources_pak, flags); | 2413 base::File file(chrome_resources_pak, flags); |
| 2414 DCHECK(file.IsValid()); | 2414 DCHECK(file.IsValid()); |
| 2415 mappings->push_back(FileDescriptorInfo(kAndroidChrome100PercentPakDescriptor, | 2415 mappings->Transfer(kAndroidChrome100PercentPakDescriptor, |
| 2416 FileDescriptor(file.Pass()))); | 2416 ScopedFD(file.TakePlatformFile())); |
| 2417 | 2417 |
| 2418 const std::string locale = GetApplicationLocale(); | 2418 const std::string locale = GetApplicationLocale(); |
| 2419 base::FilePath locale_pak = ResourceBundle::GetSharedInstance(). | 2419 base::FilePath locale_pak = ResourceBundle::GetSharedInstance(). |
| 2420 GetLocaleFilePath(locale, false); | 2420 GetLocaleFilePath(locale, false); |
| 2421 file.Initialize(locale_pak, flags); | 2421 file.Initialize(locale_pak, flags); |
| 2422 DCHECK(file.IsValid()); | 2422 DCHECK(file.IsValid()); |
| 2423 mappings->push_back(FileDescriptorInfo(kAndroidLocalePakDescriptor, | 2423 mappings->Transfer(kAndroidLocalePakDescriptor, |
| 2424 FileDescriptor(file.Pass()))); | 2424 ScopedFD(file.TakePlatformFile())); |
| 2425 | 2425 |
| 2426 base::FilePath resources_pack_path; | 2426 base::FilePath resources_pack_path; |
| 2427 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | 2427 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); |
| 2428 file.Initialize(resources_pack_path, flags); | 2428 file.Initialize(resources_pack_path, flags); |
| 2429 DCHECK(file.IsValid()); | 2429 DCHECK(file.IsValid()); |
| 2430 mappings->push_back(FileDescriptorInfo(kAndroidUIResourcesPakDescriptor, | 2430 mappings->Transfer(kAndroidUIResourcesPakDescriptor, |
| 2431 FileDescriptor(file.Pass()))); | 2431 ScopedFD(file.TakePlatformFile())); |
| 2432 | 2432 |
| 2433 if (breakpad::IsCrashReporterEnabled()) { | 2433 if (breakpad::IsCrashReporterEnabled()) { |
| 2434 file = breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( | 2434 file = breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( |
| 2435 child_process_id); | 2435 child_process_id); |
| 2436 if (file.IsValid()) { | 2436 if (file.IsValid()) { |
| 2437 mappings->push_back(FileDescriptorInfo(kAndroidMinidumpDescriptor, | 2437 mappings->Transfer(kAndroidMinidumpDescriptor, |
| 2438 FileDescriptor(file.Pass()))); | 2438 ScopedFD(file.TakePlatformFile())); |
| 2439 } else { | 2439 } else { |
| 2440 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " | 2440 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " |
| 2441 "be disabled for this process."; | 2441 "be disabled for this process."; |
| 2442 } | 2442 } |
| 2443 } | 2443 } |
| 2444 | 2444 |
| 2445 base::FilePath app_data_path; | 2445 base::FilePath app_data_path; |
| 2446 PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path); | 2446 PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path); |
| 2447 DCHECK(!app_data_path.empty()); | 2447 DCHECK(!app_data_path.empty()); |
| 2448 | 2448 |
| 2449 flags = base::File::FLAG_OPEN | base::File::FLAG_READ; | 2449 flags = base::File::FLAG_OPEN | base::File::FLAG_READ; |
| 2450 base::FilePath icudata_path = | 2450 base::FilePath icudata_path = |
| 2451 app_data_path.AppendASCII("icudtl.dat"); | 2451 app_data_path.AppendASCII("icudtl.dat"); |
| 2452 base::File icudata_file(icudata_path, flags); | 2452 base::File icudata_file(icudata_path, flags); |
| 2453 DCHECK(icudata_file.IsValid()); | 2453 DCHECK(icudata_file.IsValid()); |
| 2454 mappings->push_back(FileDescriptorInfo(kAndroidICUDataDescriptor, | 2454 mappings->Transfer(kAndroidICUDataDescriptor, |
| 2455 FileDescriptor(icudata_file.Pass()))); | 2455 ScopedFD(icudata_file.TakePlatformFile())); |
| 2456 | 2456 |
| 2457 #else | 2457 #else |
| 2458 int crash_signal_fd = GetCrashSignalFD(command_line); | 2458 int crash_signal_fd = GetCrashSignalFD(command_line); |
| 2459 if (crash_signal_fd >= 0) { | 2459 if (crash_signal_fd >= 0) { |
| 2460 mappings->push_back(FileDescriptorInfo(kCrashDumpSignal, | 2460 mappings->Share(kCrashDumpSignal, crash_signal_fd); |
| 2461 FileDescriptor(crash_signal_fd, | |
| 2462 false))); | |
| 2463 } | 2461 } |
| 2464 #endif // defined(OS_ANDROID) | 2462 #endif // defined(OS_ANDROID) |
| 2465 } | 2463 } |
| 2466 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) | 2464 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
| 2467 | 2465 |
| 2468 #if defined(OS_WIN) | 2466 #if defined(OS_WIN) |
| 2469 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { | 2467 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { |
| 2470 return chrome::kBrowserResourcesDll; | 2468 return chrome::kBrowserResourcesDll; |
| 2471 } | 2469 } |
| 2472 | 2470 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2602 switches::kDisableWebRtcEncryption, | 2600 switches::kDisableWebRtcEncryption, |
| 2603 }; | 2601 }; |
| 2604 to_command_line->CopySwitchesFrom(from_command_line, | 2602 to_command_line->CopySwitchesFrom(from_command_line, |
| 2605 kWebRtcDevSwitchNames, | 2603 kWebRtcDevSwitchNames, |
| 2606 arraysize(kWebRtcDevSwitchNames)); | 2604 arraysize(kWebRtcDevSwitchNames)); |
| 2607 } | 2605 } |
| 2608 } | 2606 } |
| 2609 #endif // defined(ENABLE_WEBRTC) | 2607 #endif // defined(ENABLE_WEBRTC) |
| 2610 | 2608 |
| 2611 } // namespace chrome | 2609 } // namespace chrome |
| OLD | NEW |