| 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/shell/app/cast_main_delegate.h" | 5 #include "chromecast/shell/app/cast_main_delegate.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" |
| 7 #include "base/cpu.h" | 8 #include "base/cpu.h" |
| 8 #include "base/logging.h" | 9 #include "base/logging.h" |
| 9 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 10 #include "base/posix/global_descriptors.h" | 11 #include "base/posix/global_descriptors.h" |
| 11 #include "chromecast/common/cast_paths.h" | 12 #include "chromecast/common/cast_paths.h" |
| 12 #include "chromecast/common/cast_resource_delegate.h" | 13 #include "chromecast/common/cast_resource_delegate.h" |
| 13 #include "chromecast/common/global_descriptors.h" | 14 #include "chromecast/common/global_descriptors.h" |
| 14 #include "chromecast/shell/browser/cast_content_browser_client.h" | 15 #include "chromecast/shell/browser/cast_content_browser_client.h" |
| 15 #include "chromecast/shell/renderer/cast_content_renderer_client.h" | 16 #include "chromecast/shell/renderer/cast_content_renderer_client.h" |
| 16 #include "content/public/browser/browser_main_runner.h" | 17 #include "content/public/browser/browser_main_runner.h" |
| 17 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 19 | 20 |
| 21 #if defined(OS_ANDROID) |
| 22 #include "chromecast/crash/android/crash_handler.h" |
| 23 #endif // defined(OS_ANDROID) |
| 24 |
| 20 namespace chromecast { | 25 namespace chromecast { |
| 21 namespace shell { | 26 namespace shell { |
| 22 | 27 |
| 23 CastMainDelegate::CastMainDelegate() { | 28 CastMainDelegate::CastMainDelegate() { |
| 24 } | 29 } |
| 25 | 30 |
| 26 CastMainDelegate::~CastMainDelegate() { | 31 CastMainDelegate::~CastMainDelegate() { |
| 27 } | 32 } |
| 28 | 33 |
| 29 bool CastMainDelegate::BasicStartupComplete(int* exit_code) { | 34 bool CastMainDelegate::BasicStartupComplete(int* exit_code) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 49 | 54 |
| 50 void CastMainDelegate::PreSandboxStartup() { | 55 void CastMainDelegate::PreSandboxStartup() { |
| 51 #if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) | 56 #if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) |
| 52 // Create an instance of the CPU class to parse /proc/cpuinfo and cache the | 57 // Create an instance of the CPU class to parse /proc/cpuinfo and cache the |
| 53 // results. This data needs to be cached when file-reading is still allowed, | 58 // results. This data needs to be cached when file-reading is still allowed, |
| 54 // since base::CPU expects to be callable later, when file-reading is no | 59 // since base::CPU expects to be callable later, when file-reading is no |
| 55 // longer allowed. | 60 // longer allowed. |
| 56 base::CPU cpu_info; | 61 base::CPU cpu_info; |
| 57 #endif | 62 #endif |
| 58 | 63 |
| 64 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); |
| 65 std::string process_type = |
| 66 command_line->GetSwitchValueASCII(switches::kProcessType); |
| 67 |
| 68 #if defined(OS_ANDROID) |
| 69 base::FilePath log_file; |
| 70 PathService::Get(FILE_CAST_ANDROID_LOG, &log_file); |
| 71 chromecast::CrashHandler::Initialize(process_type, log_file); |
| 72 #endif // defined(OS_ANDROID) |
| 73 |
| 59 InitializeResourceBundle(); | 74 InitializeResourceBundle(); |
| 60 } | 75 } |
| 61 | 76 |
| 62 int CastMainDelegate::RunProcess( | 77 int CastMainDelegate::RunProcess( |
| 63 const std::string& process_type, | 78 const std::string& process_type, |
| 64 const content::MainFunctionParams& main_function_params) { | 79 const content::MainFunctionParams& main_function_params) { |
| 65 #if defined(OS_ANDROID) | 80 #if defined(OS_ANDROID) |
| 66 if (!process_type.empty()) | 81 if (!process_type.empty()) |
| 67 return -1; | 82 return -1; |
| 68 | 83 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 131 } |
| 117 | 132 |
| 118 content::ContentRendererClient* | 133 content::ContentRendererClient* |
| 119 CastMainDelegate::CreateContentRendererClient() { | 134 CastMainDelegate::CreateContentRendererClient() { |
| 120 renderer_client_.reset(new CastContentRendererClient); | 135 renderer_client_.reset(new CastContentRendererClient); |
| 121 return renderer_client_.get(); | 136 return renderer_client_.get(); |
| 122 } | 137 } |
| 123 | 138 |
| 124 } // namespace shell | 139 } // namespace shell |
| 125 } // namespace chromecast | 140 } // namespace chromecast |
| OLD | NEW |