| 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/browser/cast_browser_main_parts.h" | 5 #include "chromecast/shell/browser/cast_browser_main_parts.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
| 10 #include "chromecast/common/chromecast_config.h" | 10 #include "chromecast/common/chromecast_config.h" |
| 11 #include "chromecast/metrics/cast_metrics_service_client.h" | 11 #include "chromecast/metrics/cast_metrics_service_client.h" |
| 12 #include "chromecast/net/network_change_notifier_cast.h" | 12 #include "chromecast/net/network_change_notifier_cast.h" |
| 13 #include "chromecast/net/network_change_notifier_factory_cast.h" | 13 #include "chromecast/net/network_change_notifier_factory_cast.h" |
| 14 #include "chromecast/service/cast_service.h" | 14 #include "chromecast/service/cast_service.h" |
| 15 #include "chromecast/shell/browser/cast_browser_context.h" | 15 #include "chromecast/shell/browser/cast_browser_context.h" |
| 16 #include "chromecast/shell/browser/cast_browser_process.h" | 16 #include "chromecast/shell/browser/cast_browser_process.h" |
| 17 #include "chromecast/shell/browser/devtools/remote_debugging_server.h" | 17 #include "chromecast/shell/browser/devtools/remote_debugging_server.h" |
| 18 #include "chromecast/shell/browser/url_request_context_factory.h" | 18 #include "chromecast/shell/browser/url_request_context_factory.h" |
| 19 #include "chromecast/shell/browser/webui/webui_cast.h" | 19 #include "chromecast/shell/browser/webui/webui_cast.h" |
| 20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 22 #include "media/base/media_switches.h" | 22 #include "media/base/media_switches.h" |
| 23 | 23 |
| 24 #if defined(OS_ANDROID) | 24 #if defined(OS_ANDROID) |
| 25 #include "chromecast/crash/android/crash_handler.h" |
| 26 #include "components/crash/browser/crash_dump_manager_android.h" |
| 25 #include "net/android/network_change_notifier_factory_android.h" | 27 #include "net/android/network_change_notifier_factory_android.h" |
| 26 #endif // defined(OS_ANDROID) | 28 #endif // defined(OS_ANDROID) |
| 27 | 29 |
| 28 namespace chromecast { | 30 namespace chromecast { |
| 29 namespace shell { | 31 namespace shell { |
| 30 | 32 |
| 31 namespace { | 33 namespace { |
| 32 | 34 |
| 33 struct DefaultCommandLineSwitch { | 35 struct DefaultCommandLineSwitch { |
| 34 const char* const switch_name; | 36 const char* const switch_name; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void CastBrowserMainParts::PreMainMessageLoopRun() { | 101 void CastBrowserMainParts::PreMainMessageLoopRun() { |
| 100 url_request_context_factory_->InitializeOnUIThread(); | 102 url_request_context_factory_->InitializeOnUIThread(); |
| 101 | 103 |
| 102 cast_browser_process_->SetBrowserContext( | 104 cast_browser_process_->SetBrowserContext( |
| 103 new CastBrowserContext(url_request_context_factory_)); | 105 new CastBrowserContext(url_request_context_factory_)); |
| 104 cast_browser_process_->SetMetricsServiceClient( | 106 cast_browser_process_->SetMetricsServiceClient( |
| 105 metrics::CastMetricsServiceClient::Create( | 107 metrics::CastMetricsServiceClient::Create( |
| 106 content::BrowserThread::GetBlockingPool(), | 108 content::BrowserThread::GetBlockingPool(), |
| 107 ChromecastConfig::GetInstance()->pref_service(), | 109 ChromecastConfig::GetInstance()->pref_service(), |
| 108 cast_browser_process_->browser_context()->GetRequestContext())); | 110 cast_browser_process_->browser_context()->GetRequestContext())); |
| 111 |
| 112 #if defined(OS_ANDROID) |
| 113 base::FilePath crash_dumps_dir; |
| 114 if (!chromecast::CrashHandler::GetCrashDumpLocation(&crash_dumps_dir)) { |
| 115 LOG(ERROR) << "Could not find crash dump location."; |
| 116 } |
| 117 cast_browser_process_->SetCrashDumpManager( |
| 118 new breakpad::CrashDumpManager(crash_dumps_dir)); |
| 119 #endif |
| 120 |
| 109 cast_browser_process_->SetRemoteDebuggingServer(new RemoteDebuggingServer()); | 121 cast_browser_process_->SetRemoteDebuggingServer(new RemoteDebuggingServer()); |
| 110 | 122 |
| 111 InitializeWebUI(); | 123 InitializeWebUI(); |
| 112 | 124 |
| 113 cast_browser_process_->SetCastService(CastService::Create( | 125 cast_browser_process_->SetCastService(CastService::Create( |
| 114 cast_browser_process_->browser_context(), | 126 cast_browser_process_->browser_context(), |
| 115 url_request_context_factory_->GetSystemGetter(), | 127 url_request_context_factory_->GetSystemGetter(), |
| 116 base::Bind( | 128 base::Bind( |
| 117 &metrics::CastMetricsServiceClient::EnableMetricsService, | 129 &metrics::CastMetricsServiceClient::EnableMetricsService, |
| 118 base::Unretained(cast_browser_process_->metrics_service_client())))); | 130 base::Unretained(cast_browser_process_->metrics_service_client())))); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 133 return true; | 145 return true; |
| 134 } | 146 } |
| 135 | 147 |
| 136 void CastBrowserMainParts::PostMainMessageLoopRun() { | 148 void CastBrowserMainParts::PostMainMessageLoopRun() { |
| 137 cast_browser_process_->cast_service()->Stop(); | 149 cast_browser_process_->cast_service()->Stop(); |
| 138 cast_browser_process_.reset(); | 150 cast_browser_process_.reset(); |
| 139 } | 151 } |
| 140 | 152 |
| 141 } // namespace shell | 153 } // namespace shell |
| 142 } // namespace chromecast | 154 } // namespace chromecast |
| OLD | NEW |