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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 #include "components/user_manager/user_manager.h" | 156 #include "components/user_manager/user_manager.h" |
157 #elif defined(OS_LINUX) | 157 #elif defined(OS_LINUX) |
158 #include "chrome/browser/chrome_browser_main_linux.h" | 158 #include "chrome/browser/chrome_browser_main_linux.h" |
159 #elif defined(OS_ANDROID) | 159 #elif defined(OS_ANDROID) |
160 #include "chrome/browser/android/new_tab_page_url_handler.h" | 160 #include "chrome/browser/android/new_tab_page_url_handler.h" |
161 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" | 161 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
162 #include "chrome/browser/chrome_browser_main_android.h" | 162 #include "chrome/browser/chrome_browser_main_android.h" |
163 #include "chrome/common/descriptors_android.h" | 163 #include "chrome/common/descriptors_android.h" |
164 #include "components/crash/browser/crash_dump_manager_android.h" | 164 #include "components/crash/browser/crash_dump_manager_android.h" |
165 #include "components/service_tab_launcher/browser/android/service_tab_launcher.h
" | 165 #include "components/service_tab_launcher/browser/android/service_tab_launcher.h
" |
| 166 #include "ui/base/resource/resource_bundle_android.h" |
166 #elif defined(OS_POSIX) | 167 #elif defined(OS_POSIX) |
167 #include "chrome/browser/chrome_browser_main_posix.h" | 168 #include "chrome/browser/chrome_browser_main_posix.h" |
168 #endif | 169 #endif |
169 | 170 |
170 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 171 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
171 #include "base/debug/leak_annotations.h" | 172 #include "base/debug/leak_annotations.h" |
172 #include "components/crash/app/breakpad_linux.h" | 173 #include "components/crash/app/breakpad_linux.h" |
173 #include "components/crash/browser/crash_handler_host_linux.h" | 174 #include "components/crash/browser/crash_handler_host_linux.h" |
174 #endif | 175 #endif |
175 | 176 |
(...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2202 DCHECK(backend->CanHandleType(storage::kFileSystemTypeExternal)); | 2203 DCHECK(backend->CanHandleType(storage::kFileSystemTypeExternal)); |
2203 additional_backends->push_back(backend); | 2204 additional_backends->push_back(backend); |
2204 #endif | 2205 #endif |
2205 | 2206 |
2206 for (size_t i = 0; i < extra_parts_.size(); ++i) { | 2207 for (size_t i = 0; i < extra_parts_.size(); ++i) { |
2207 extra_parts_[i]->GetAdditionalFileSystemBackends( | 2208 extra_parts_[i]->GetAdditionalFileSystemBackends( |
2208 browser_context, storage_partition_path, additional_backends); | 2209 browser_context, storage_partition_path, additional_backends); |
2209 } | 2210 } |
2210 } | 2211 } |
2211 | 2212 |
2212 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 2213 #if defined(OS_ANDROID) |
2213 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 2214 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
2214 const base::CommandLine& command_line, | 2215 const base::CommandLine& command_line, |
2215 int child_process_id, | 2216 int child_process_id, |
2216 FileDescriptorInfo* mappings) { | 2217 FileDescriptorInfo* mappings, |
2217 #if defined(OS_ANDROID) | 2218 std::map<int, base::MemoryMappedFile::Region>* regions) { |
2218 base::FilePath data_path; | 2219 int fd = ui::GetMainAndroidPackFd( |
2219 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); | 2220 &(*regions)[kAndroidUIResourcesPakDescriptor]); |
2220 DCHECK(!data_path.empty()); | 2221 mappings->Share(kAndroidUIResourcesPakDescriptor, fd); |
| 2222 |
| 2223 fd = ui::GetCommonResourcesPackFd( |
| 2224 &(*regions)[kAndroidChrome100PercentPakDescriptor]); |
| 2225 mappings->Share(kAndroidChrome100PercentPakDescriptor, fd); |
2221 | 2226 |
2222 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; | 2227 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; |
2223 base::FilePath chrome_resources_pak = | |
2224 data_path.AppendASCII("chrome_100_percent.pak"); | |
2225 base::File file(chrome_resources_pak, flags); | |
2226 DCHECK(file.IsValid()); | |
2227 mappings->Transfer(kAndroidChrome100PercentPakDescriptor, | |
2228 base::ScopedFD(file.TakePlatformFile())); | |
2229 | |
2230 const std::string locale = GetApplicationLocale(); | 2228 const std::string locale = GetApplicationLocale(); |
2231 base::FilePath locale_pak = ResourceBundle::GetSharedInstance(). | 2229 base::FilePath locale_pak = ResourceBundle::GetSharedInstance(). |
2232 GetLocaleFilePath(locale, false); | 2230 GetLocaleFilePath(locale, false); |
2233 file.Initialize(locale_pak, flags); | 2231 base::File file(locale_pak, flags); |
2234 DCHECK(file.IsValid()); | 2232 DCHECK(file.IsValid()); |
2235 mappings->Transfer(kAndroidLocalePakDescriptor, | 2233 mappings->Transfer(kAndroidLocalePakDescriptor, |
2236 base::ScopedFD(file.TakePlatformFile())); | 2234 base::ScopedFD(file.TakePlatformFile())); |
2237 | 2235 |
2238 base::FilePath resources_pack_path; | |
2239 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | |
2240 file.Initialize(resources_pack_path, flags); | |
2241 DCHECK(file.IsValid()); | |
2242 mappings->Transfer(kAndroidUIResourcesPakDescriptor, | |
2243 base::ScopedFD(file.TakePlatformFile())); | |
2244 | |
2245 if (breakpad::IsCrashReporterEnabled()) { | 2236 if (breakpad::IsCrashReporterEnabled()) { |
2246 file = breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( | 2237 file = breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( |
2247 child_process_id); | 2238 child_process_id); |
2248 if (file.IsValid()) { | 2239 if (file.IsValid()) { |
2249 mappings->Transfer(kAndroidMinidumpDescriptor, | 2240 mappings->Transfer(kAndroidMinidumpDescriptor, |
2250 base::ScopedFD(file.TakePlatformFile())); | 2241 base::ScopedFD(file.TakePlatformFile())); |
2251 } else { | 2242 } else { |
2252 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " | 2243 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " |
2253 "be disabled for this process."; | 2244 "be disabled for this process."; |
2254 } | 2245 } |
2255 } | 2246 } |
2256 | 2247 |
2257 base::FilePath app_data_path; | 2248 base::FilePath app_data_path; |
2258 PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path); | 2249 PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path); |
2259 DCHECK(!app_data_path.empty()); | 2250 DCHECK(!app_data_path.empty()); |
2260 #else | 2251 } |
| 2252 #elif defined(OS_POSIX) && !defined(OS_MACOSX) |
| 2253 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
| 2254 const base::CommandLine& command_line, |
| 2255 int child_process_id, |
| 2256 FileDescriptorInfo* mappings) { |
2261 int crash_signal_fd = GetCrashSignalFD(command_line); | 2257 int crash_signal_fd = GetCrashSignalFD(command_line); |
2262 if (crash_signal_fd >= 0) { | 2258 if (crash_signal_fd >= 0) { |
2263 mappings->Share(kCrashDumpSignal, crash_signal_fd); | 2259 mappings->Share(kCrashDumpSignal, crash_signal_fd); |
2264 } | 2260 } |
| 2261 } |
2265 #endif // defined(OS_ANDROID) | 2262 #endif // defined(OS_ANDROID) |
2266 } | |
2267 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) | |
2268 | 2263 |
2269 #if defined(OS_WIN) | 2264 #if defined(OS_WIN) |
2270 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { | 2265 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { |
2271 return chrome::kBrowserResourcesDll; | 2266 return chrome::kBrowserResourcesDll; |
2272 } | 2267 } |
2273 | 2268 |
2274 void ChromeContentBrowserClient::PreSpawnRenderer( | 2269 void ChromeContentBrowserClient::PreSpawnRenderer( |
2275 sandbox::TargetPolicy* policy, | 2270 sandbox::TargetPolicy* policy, |
2276 bool* success) { | 2271 bool* success) { |
2277 // This code is duplicated in nacl_exe_win_64.cc. | 2272 // This code is duplicated in nacl_exe_win_64.cc. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2434 switches::kDisableWebRtcEncryption, | 2429 switches::kDisableWebRtcEncryption, |
2435 }; | 2430 }; |
2436 to_command_line->CopySwitchesFrom(from_command_line, | 2431 to_command_line->CopySwitchesFrom(from_command_line, |
2437 kWebRtcDevSwitchNames, | 2432 kWebRtcDevSwitchNames, |
2438 arraysize(kWebRtcDevSwitchNames)); | 2433 arraysize(kWebRtcDevSwitchNames)); |
2439 } | 2434 } |
2440 } | 2435 } |
2441 #endif // defined(ENABLE_WEBRTC) | 2436 #endif // defined(ENABLE_WEBRTC) |
2442 | 2437 |
2443 } // namespace chrome | 2438 } // namespace chrome |
OLD | NEW |