| 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/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
| 9 #include "chromecast/common/chromecast_config.h" | 9 #include "chromecast/common/chromecast_config.h" |
| 10 #include "chromecast/metrics/cast_metrics_service_client.h" |
| 10 #include "chromecast/net/network_change_notifier_cast.h" | 11 #include "chromecast/net/network_change_notifier_cast.h" |
| 11 #include "chromecast/net/network_change_notifier_factory_cast.h" | 12 #include "chromecast/net/network_change_notifier_factory_cast.h" |
| 12 #include "chromecast/service/cast_service.h" | 13 #include "chromecast/service/cast_service.h" |
| 13 #include "chromecast/shell/browser/cast_browser_context.h" | 14 #include "chromecast/shell/browser/cast_browser_context.h" |
| 14 #include "chromecast/shell/browser/devtools/remote_debugging_server.h" | 15 #include "chromecast/shell/browser/devtools/remote_debugging_server.h" |
| 15 #include "chromecast/shell/browser/url_request_context_factory.h" | 16 #include "chromecast/shell/browser/url_request_context_factory.h" |
| 16 #include "chromecast/shell/browser/webui/webui_cast.h" | 17 #include "chromecast/shell/browser/webui/webui_cast.h" |
| 17 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
| 18 | 19 |
| 19 namespace chromecast { | 20 namespace chromecast { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 68 |
| 68 int CastBrowserMainParts::PreCreateThreads() { | 69 int CastBrowserMainParts::PreCreateThreads() { |
| 69 ChromecastConfig::Create(new PrefRegistrySimple()); | 70 ChromecastConfig::Create(new PrefRegistrySimple()); |
| 70 return 0; | 71 return 0; |
| 71 } | 72 } |
| 72 | 73 |
| 73 void CastBrowserMainParts::PreMainMessageLoopRun() { | 74 void CastBrowserMainParts::PreMainMessageLoopRun() { |
| 74 url_request_context_factory_->InitializeOnUIThread(); | 75 url_request_context_factory_->InitializeOnUIThread(); |
| 75 | 76 |
| 76 browser_context_.reset(new CastBrowserContext(url_request_context_factory_)); | 77 browser_context_.reset(new CastBrowserContext(url_request_context_factory_)); |
| 78 metrics_service_client_.reset(metrics::CastMetricsServiceClient::Create( |
| 79 browser_context_->GetRequestContext())); |
| 77 dev_tools_.reset(new RemoteDebuggingServer()); | 80 dev_tools_.reset(new RemoteDebuggingServer()); |
| 78 | 81 |
| 79 InitializeWebUI(); | 82 InitializeWebUI(); |
| 80 | 83 |
| 81 cast_service_.reset(CastService::Create(browser_context_.get())); | 84 cast_service_.reset(CastService::Create(browser_context_.get())); |
| 82 cast_service_->Start(); | 85 cast_service_->Start(); |
| 83 } | 86 } |
| 84 | 87 |
| 85 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { | 88 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { |
| 86 base::MessageLoopForUI::current()->Run(); | 89 base::MessageLoopForUI::current()->Run(); |
| 87 return true; | 90 return true; |
| 88 } | 91 } |
| 89 | 92 |
| 90 void CastBrowserMainParts::PostMainMessageLoopRun() { | 93 void CastBrowserMainParts::PostMainMessageLoopRun() { |
| 91 cast_service_->Stop(); | 94 cast_service_->Stop(); |
| 92 | 95 |
| 93 cast_service_.reset(); | 96 cast_service_.reset(); |
| 94 dev_tools_.reset(); | 97 dev_tools_.reset(); |
| 98 metrics_service_client_.reset(); |
| 95 browser_context_.reset(); | 99 browser_context_.reset(); |
| 96 } | 100 } |
| 97 | 101 |
| 98 } // namespace shell | 102 } // namespace shell |
| 99 } // namespace chromecast | 103 } // namespace chromecast |
| OLD | NEW |