OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/browser/cast_content_browser_client.h" | 5 #include "chromecast/browser/cast_content_browser_client.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/scoped_file.h" | 11 #include "base/files/scoped_file.h" |
| 12 #include "base/i18n/icu_util.h" |
12 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
14 #include "chromecast/browser/cast_browser_context.h" | 15 #include "chromecast/browser/cast_browser_context.h" |
15 #include "chromecast/browser/cast_browser_main_parts.h" | 16 #include "chromecast/browser/cast_browser_main_parts.h" |
16 #include "chromecast/browser/cast_browser_process.h" | 17 #include "chromecast/browser/cast_browser_process.h" |
17 #include "chromecast/browser/cast_network_delegate.h" | 18 #include "chromecast/browser/cast_network_delegate.h" |
18 #include "chromecast/browser/cast_resource_dispatcher_host_delegate.h" | 19 #include "chromecast/browser/cast_resource_dispatcher_host_delegate.h" |
19 #include "chromecast/browser/devtools/cast_dev_tools_delegate.h" | 20 #include "chromecast/browser/devtools/cast_dev_tools_delegate.h" |
20 #include "chromecast/browser/geolocation/cast_access_token_store.h" | 21 #include "chromecast/browser/geolocation/cast_access_token_store.h" |
21 #include "chromecast/browser/media/cma_message_filter_host.h" | 22 #include "chromecast/browser/media/cma_message_filter_host.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 content::DevToolsManagerDelegate* | 267 content::DevToolsManagerDelegate* |
267 CastContentBrowserClient::GetDevToolsManagerDelegate() { | 268 CastContentBrowserClient::GetDevToolsManagerDelegate() { |
268 return new CastDevToolsManagerDelegate(); | 269 return new CastDevToolsManagerDelegate(); |
269 } | 270 } |
270 | 271 |
271 void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 272 void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
272 const base::CommandLine& command_line, | 273 const base::CommandLine& command_line, |
273 int child_process_id, | 274 int child_process_id, |
274 content::FileDescriptorInfo* mappings) { | 275 content::FileDescriptorInfo* mappings) { |
275 #if defined(OS_ANDROID) | 276 #if defined(OS_ANDROID) |
276 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; | 277 const int flags_open_read = base::File::FLAG_OPEN | base::File::FLAG_READ; |
277 base::FilePath pak_file; | 278 base::FilePath pak_file_path; |
278 CHECK(PathService::Get(FILE_CAST_PAK, &pak_file)); | 279 CHECK(PathService::Get(FILE_CAST_PAK, &pak_file_path)); |
279 base::File pak_with_flags(pak_file, flags); | 280 base::File pak_file(pak_file_path, flags_open_read); |
280 if (!pak_with_flags.IsValid()) { | 281 if (!pak_file.IsValid()) { |
281 NOTREACHED() << "Failed to open file when creating renderer process: " | 282 NOTREACHED() << "Failed to open file when creating renderer process: " |
282 << "cast_shell.pak"; | 283 << "cast_shell.pak"; |
283 } | 284 } |
284 mappings->Transfer( | 285 mappings->Transfer(kAndroidPakDescriptor, |
285 kAndroidPakDescriptor, | 286 base::ScopedFD(pak_file.TakePlatformFile())); |
286 base::ScopedFD(pak_with_flags.TakePlatformFile())); | |
287 | 287 |
288 if (breakpad::IsCrashReporterEnabled()) { | 288 if (breakpad::IsCrashReporterEnabled()) { |
289 base::File minidump_file( | 289 base::File minidump_file( |
290 breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( | 290 breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( |
291 child_process_id)); | 291 child_process_id)); |
292 if (!minidump_file.IsValid()) { | 292 if (!minidump_file.IsValid()) { |
293 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " | 293 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " |
294 << "be disabled for this process."; | 294 << "be disabled for this process."; |
295 } else { | 295 } else { |
296 mappings->Transfer(kAndroidMinidumpDescriptor, | 296 mappings->Transfer(kAndroidMinidumpDescriptor, |
297 base::ScopedFD(minidump_file.TakePlatformFile())); | 297 base::ScopedFD(minidump_file.TakePlatformFile())); |
298 } | 298 } |
299 } | 299 } |
| 300 |
| 301 base::FilePath app_data_path; |
| 302 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path)); |
| 303 base::FilePath icudata_path = |
| 304 app_data_path.AppendASCII(base::i18n::kIcuDataFileName); |
| 305 base::File icudata_file(icudata_path, flags_open_read); |
| 306 if (!icudata_file.IsValid()) |
| 307 NOTREACHED() << "Failed to open ICU file when creating renderer process"; |
| 308 mappings->Transfer(kAndroidICUDataDescriptor, |
| 309 base::ScopedFD(icudata_file.TakePlatformFile())); |
300 #else | 310 #else |
301 int crash_signal_fd = GetCrashSignalFD(command_line); | 311 int crash_signal_fd = GetCrashSignalFD(command_line); |
302 if (crash_signal_fd >= 0) { | 312 if (crash_signal_fd >= 0) { |
303 mappings->Share(kCrashDumpSignal, crash_signal_fd); | 313 mappings->Share(kCrashDumpSignal, crash_signal_fd); |
304 } | 314 } |
305 #endif // defined(OS_ANDROID) | 315 #endif // defined(OS_ANDROID) |
306 } | 316 } |
307 | 317 |
308 #if defined(OS_ANDROID) && defined(VIDEO_HOLE) | 318 #if defined(OS_ANDROID) && defined(VIDEO_HOLE) |
309 content::ExternalVideoSurfaceContainer* | 319 content::ExternalVideoSurfaceContainer* |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 process_type, dumps_path, false /* upload */); | 357 process_type, dumps_path, false /* upload */); |
348 // StartUploaderThread() even though upload is diferred. | 358 // StartUploaderThread() even though upload is diferred. |
349 // Breakpad-related memory is freed in the uploader thread. | 359 // Breakpad-related memory is freed in the uploader thread. |
350 crash_handler->StartUploaderThread(); | 360 crash_handler->StartUploaderThread(); |
351 return crash_handler; | 361 return crash_handler; |
352 } | 362 } |
353 #endif // !defined(OS_ANDROID) | 363 #endif // !defined(OS_ANDROID) |
354 | 364 |
355 } // namespace shell | 365 } // namespace shell |
356 } // namespace chromecast | 366 } // namespace chromecast |
OLD | NEW |