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