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_browser_main_parts.h" | 5 #include "chromecast/browser/cast_browser_main_parts.h" |
6 | 6 |
7 #include <signal.h> | 7 #include <signal.h> |
8 #include <sys/prctl.h> | 8 #include <sys/prctl.h> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 #include "content/public/common/content_switches.h" | 33 #include "content/public/common/content_switches.h" |
34 #include "media/base/browser_cdm_factory.h" | 34 #include "media/base/browser_cdm_factory.h" |
35 #include "media/base/media_switches.h" | 35 #include "media/base/media_switches.h" |
36 | 36 |
37 #if defined(OS_ANDROID) | 37 #if defined(OS_ANDROID) |
38 #include "chromecast/crash/android/crash_handler.h" | 38 #include "chromecast/crash/android/crash_handler.h" |
39 #include "components/crash/browser/crash_dump_manager_android.h" | 39 #include "components/crash/browser/crash_dump_manager_android.h" |
40 #include "net/android/network_change_notifier_factory_android.h" | 40 #include "net/android/network_change_notifier_factory_android.h" |
41 #endif | 41 #endif |
42 | 42 |
43 #if defined(USE_AURA) | |
44 #include "ui/aura/test/test_screen.h" | |
45 #include "ui/gfx/screen.h" | |
46 #endif | |
47 | |
43 namespace { | 48 namespace { |
44 | 49 |
45 #if !defined(OS_ANDROID) | 50 #if !defined(OS_ANDROID) |
46 int kSignalsToRunClosure[] = { SIGTERM, SIGINT, }; | 51 int kSignalsToRunClosure[] = { SIGTERM, SIGINT, }; |
47 | 52 |
48 // Closure to run on SIGTERM and SIGINT. | 53 // Closure to run on SIGTERM and SIGINT. |
49 base::Closure* g_signal_closure = NULL; | 54 base::Closure* g_signal_closure = NULL; |
50 | 55 |
51 void RunClosureOnSignal(int signum) { | 56 void RunClosureOnSignal(int signum) { |
52 LOG(ERROR) << "Got signal " << signum; | 57 LOG(ERROR) << "Got signal " << signum; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 LOG(ERROR) << "Could not find crash dump location."; | 192 LOG(ERROR) << "Could not find crash dump location."; |
188 } | 193 } |
189 cast_browser_process_->SetCrashDumpManager( | 194 cast_browser_process_->SetCrashDumpManager( |
190 make_scoped_ptr(new breakpad::CrashDumpManager(crash_dumps_dir))); | 195 make_scoped_ptr(new breakpad::CrashDumpManager(crash_dumps_dir))); |
191 #else | 196 #else |
192 base::FilePath home_dir; | 197 base::FilePath home_dir; |
193 CHECK(PathService::Get(DIR_CAST_HOME, &home_dir)); | 198 CHECK(PathService::Get(DIR_CAST_HOME, &home_dir)); |
194 if (!base::CreateDirectory(home_dir)) | 199 if (!base::CreateDirectory(home_dir)) |
195 return 1; | 200 return 1; |
196 #endif | 201 #endif |
202 | |
203 #if defined(USE_AURA) | |
204 // Screen can (and should) exist even with no displays connected. Its presence | |
205 // is assumed as an interface to access display information, e.g. from metrics | |
206 // code. See CastContentWindow::CreateWindowTree for update when resolution | |
207 // is available. | |
208 DCHECK(!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)); | |
209 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, | |
210 aura::TestScreen::Create(gfx::Size(0, 0))); | |
oshima
2015/03/25 22:39:55
Hmm, production code should not depend on test cod
halliwell
2015/03/26 00:28:24
Yes, sure. I filed https://code.google.com/p/chro
| |
211 #endif | |
197 return 0; | 212 return 0; |
198 } | 213 } |
199 | 214 |
200 void CastBrowserMainParts::PreMainMessageLoopRun() { | 215 void CastBrowserMainParts::PreMainMessageLoopRun() { |
201 scoped_refptr<PrefRegistrySimple> pref_registry(new PrefRegistrySimple()); | 216 scoped_refptr<PrefRegistrySimple> pref_registry(new PrefRegistrySimple()); |
202 metrics::RegisterPrefs(pref_registry.get()); | 217 metrics::RegisterPrefs(pref_registry.get()); |
203 cast_browser_process_->SetPrefService( | 218 cast_browser_process_->SetPrefService( |
204 PrefServiceHelper::CreatePrefService(pref_registry.get())); | 219 PrefServiceHelper::CreatePrefService(pref_registry.get())); |
205 | 220 |
206 #if !defined(OS_ANDROID) | 221 #if !defined(OS_ANDROID) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 NOTREACHED(); | 292 NOTREACHED(); |
278 #else | 293 #else |
279 cast_browser_process_->cast_service()->Finalize(); | 294 cast_browser_process_->cast_service()->Finalize(); |
280 cast_browser_process_->metrics_service_client()->Finalize(); | 295 cast_browser_process_->metrics_service_client()->Finalize(); |
281 cast_browser_process_.reset(); | 296 cast_browser_process_.reset(); |
282 #endif | 297 #endif |
283 } | 298 } |
284 | 299 |
285 } // namespace shell | 300 } // namespace shell |
286 } // namespace chromecast | 301 } // namespace chromecast |
OLD | NEW |