| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 #include "chrome/browser/local_discovery/storage/privet_filesystem_backend.h" | 246 #include "chrome/browser/local_discovery/storage/privet_filesystem_backend.h" |
| 247 #endif | 247 #endif |
| 248 | 248 |
| 249 using blink::WebWindowFeatures; | 249 using blink::WebWindowFeatures; |
| 250 using base::FileDescriptor; | 250 using base::FileDescriptor; |
| 251 using content::AccessTokenStore; | 251 using content::AccessTokenStore; |
| 252 using content::BrowserChildProcessHostIterator; | 252 using content::BrowserChildProcessHostIterator; |
| 253 using content::BrowserThread; | 253 using content::BrowserThread; |
| 254 using content::BrowserURLHandler; | 254 using content::BrowserURLHandler; |
| 255 using content::ChildProcessSecurityPolicy; | 255 using content::ChildProcessSecurityPolicy; |
| 256 using content::FileDescriptorInfo; | |
| 257 using content::QuotaPermissionContext; | 256 using content::QuotaPermissionContext; |
| 258 using content::RenderViewHost; | 257 using content::RenderViewHost; |
| 259 using content::SiteInstance; | 258 using content::SiteInstance; |
| 260 using content::WebContents; | 259 using content::WebContents; |
| 261 using extensions::APIPermission; | 260 using extensions::APIPermission; |
| 262 using extensions::Extension; | 261 using extensions::Extension; |
| 263 using extensions::InfoMap; | 262 using extensions::InfoMap; |
| 264 using extensions::Manifest; | 263 using extensions::Manifest; |
| 265 using message_center::NotifierId; | 264 using message_center::NotifierId; |
| 266 | 265 |
| 266 #if defined(OS_POSIX) |
| 267 using content::FileDescriptorInfo; |
| 268 #endif |
| 269 |
| 267 namespace { | 270 namespace { |
| 268 | 271 |
| 269 // Cached version of the locale so we can return the locale on the I/O | 272 // Cached version of the locale so we can return the locale on the I/O |
| 270 // thread. | 273 // thread. |
| 271 base::LazyInstance<std::string> g_io_thread_application_locale; | 274 base::LazyInstance<std::string> g_io_thread_application_locale; |
| 272 | 275 |
| 273 #if defined(ENABLE_PLUGINS) | 276 #if defined(ENABLE_PLUGINS) |
| 274 const char* kPredefinedAllowedFileHandleOrigins[] = { | 277 const char* kPredefinedAllowedFileHandleOrigins[] = { |
| 275 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/234789 | 278 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/234789 |
| 276 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/234789 | 279 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/234789 |
| (...skipping 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2585 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 2588 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 2586 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 2589 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
| 2587 const CommandLine& command_line, | 2590 const CommandLine& command_line, |
| 2588 int child_process_id, | 2591 int child_process_id, |
| 2589 std::vector<FileDescriptorInfo>* mappings) { | 2592 std::vector<FileDescriptorInfo>* mappings) { |
| 2590 #if defined(OS_ANDROID) | 2593 #if defined(OS_ANDROID) |
| 2591 base::FilePath data_path; | 2594 base::FilePath data_path; |
| 2592 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); | 2595 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); |
| 2593 DCHECK(!data_path.empty()); | 2596 DCHECK(!data_path.empty()); |
| 2594 | 2597 |
| 2595 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; | 2598 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; |
| 2596 base::FilePath chrome_resources_pak = | 2599 base::FilePath chrome_resources_pak = |
| 2597 data_path.AppendASCII("chrome_100_percent.pak"); | 2600 data_path.AppendASCII("chrome_100_percent.pak"); |
| 2598 base::PlatformFile f = | 2601 base::File file(chrome_resources_pak, flags); |
| 2599 base::CreatePlatformFile(chrome_resources_pak, flags, NULL, NULL); | 2602 DCHECK(file.IsValid()); |
| 2600 DCHECK(f != base::kInvalidPlatformFileValue); | |
| 2601 mappings->push_back(FileDescriptorInfo(kAndroidChrome100PercentPakDescriptor, | 2603 mappings->push_back(FileDescriptorInfo(kAndroidChrome100PercentPakDescriptor, |
| 2602 FileDescriptor(f, true))); | 2604 FileDescriptor(file.Pass()))); |
| 2603 | 2605 |
| 2604 const std::string locale = GetApplicationLocale(); | 2606 const std::string locale = GetApplicationLocale(); |
| 2605 base::FilePath locale_pak = ResourceBundle::GetSharedInstance(). | 2607 base::FilePath locale_pak = ResourceBundle::GetSharedInstance(). |
| 2606 GetLocaleFilePath(locale, false); | 2608 GetLocaleFilePath(locale, false); |
| 2607 f = base::CreatePlatformFile(locale_pak, flags, NULL, NULL); | 2609 file.Initialize(locale_pak, flags); |
| 2608 DCHECK(f != base::kInvalidPlatformFileValue); | 2610 DCHECK(file.IsValid()); |
| 2609 mappings->push_back(FileDescriptorInfo(kAndroidLocalePakDescriptor, | 2611 mappings->push_back(FileDescriptorInfo(kAndroidLocalePakDescriptor, |
| 2610 FileDescriptor(f, true))); | 2612 FileDescriptor(file.Pass()))); |
| 2611 | 2613 |
| 2612 base::FilePath resources_pack_path; | 2614 base::FilePath resources_pack_path; |
| 2613 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | 2615 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); |
| 2614 f = base::CreatePlatformFile(resources_pack_path, flags, NULL, NULL); | 2616 file.Initialize(resources_pack_path, flags); |
| 2615 DCHECK(f != base::kInvalidPlatformFileValue); | 2617 DCHECK(file.IsValid()); |
| 2616 mappings->push_back(FileDescriptorInfo(kAndroidUIResourcesPakDescriptor, | 2618 mappings->push_back(FileDescriptorInfo(kAndroidUIResourcesPakDescriptor, |
| 2617 FileDescriptor(f, true))); | 2619 FileDescriptor(file.Pass()))); |
| 2618 | 2620 |
| 2619 if (breakpad::IsCrashReporterEnabled()) { | 2621 if (breakpad::IsCrashReporterEnabled()) { |
| 2620 f = breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( | 2622 file = breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( |
| 2621 child_process_id); | 2623 child_process_id); |
| 2622 if (f == base::kInvalidPlatformFileValue) { | 2624 if (file.IsValid()) { |
| 2625 mappings->push_back(FileDescriptorInfo(kAndroidMinidumpDescriptor, |
| 2626 FileDescriptor(file.Pass()))); |
| 2627 } else { |
| 2623 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " | 2628 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " |
| 2624 "be disabled for this process."; | 2629 "be disabled for this process."; |
| 2625 } else { | |
| 2626 mappings->push_back(FileDescriptorInfo(kAndroidMinidumpDescriptor, | |
| 2627 FileDescriptor(f, true))); | |
| 2628 } | 2630 } |
| 2629 } | 2631 } |
| 2630 | 2632 |
| 2631 #else | 2633 #else |
| 2632 int crash_signal_fd = GetCrashSignalFD(command_line); | 2634 int crash_signal_fd = GetCrashSignalFD(command_line); |
| 2633 if (crash_signal_fd >= 0) { | 2635 if (crash_signal_fd >= 0) { |
| 2634 mappings->push_back(FileDescriptorInfo(kCrashDumpSignal, | 2636 mappings->push_back(FileDescriptorInfo(kCrashDumpSignal, |
| 2635 FileDescriptor(crash_signal_fd, | 2637 FileDescriptor(crash_signal_fd, |
| 2636 false))); | 2638 false))); |
| 2637 } | 2639 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2728 switches::kDisableWebRtcEncryption, | 2730 switches::kDisableWebRtcEncryption, |
| 2729 }; | 2731 }; |
| 2730 to_command_line->CopySwitchesFrom(from_command_line, | 2732 to_command_line->CopySwitchesFrom(from_command_line, |
| 2731 kWebRtcDevSwitchNames, | 2733 kWebRtcDevSwitchNames, |
| 2732 arraysize(kWebRtcDevSwitchNames)); | 2734 arraysize(kWebRtcDevSwitchNames)); |
| 2733 } | 2735 } |
| 2734 } | 2736 } |
| 2735 #endif // defined(ENABLE_WEBRTC) | 2737 #endif // defined(ENABLE_WEBRTC) |
| 2736 | 2738 |
| 2737 } // namespace chrome | 2739 } // namespace chrome |
| OLD | NEW |