| 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" |
| 9 #include "chromecast/common/chromecast_config.h" |
| 8 #include "chromecast/net/network_change_notifier_cast.h" | 10 #include "chromecast/net/network_change_notifier_cast.h" |
| 9 #include "chromecast/net/network_change_notifier_factory_cast.h" | 11 #include "chromecast/net/network_change_notifier_factory_cast.h" |
| 10 #include "chromecast/service/cast_service.h" | 12 #include "chromecast/service/cast_service.h" |
| 11 #include "chromecast/shell/browser/cast_browser_context.h" | 13 #include "chromecast/shell/browser/cast_browser_context.h" |
| 14 #include "chromecast/shell/browser/devtools/remote_debugging_server.h" |
| 12 #include "chromecast/shell/browser/url_request_context_factory.h" | 15 #include "chromecast/shell/browser/url_request_context_factory.h" |
| 13 | 16 |
| 14 namespace chromecast { | 17 namespace chromecast { |
| 15 namespace shell { | 18 namespace shell { |
| 16 | 19 |
| 17 namespace { | 20 namespace { |
| 18 | 21 |
| 19 struct DefaultCommandLineSwitch { | 22 struct DefaultCommandLineSwitch { |
| 20 const char* const switch_name; | 23 const char* const switch_name; |
| 21 const char* const switch_value; | 24 const char* const switch_value; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 void CastBrowserMainParts::PreMainMessageLoopStart() { | 58 void CastBrowserMainParts::PreMainMessageLoopStart() { |
| 56 net::NetworkChangeNotifier::SetFactory( | 59 net::NetworkChangeNotifier::SetFactory( |
| 57 new NetworkChangeNotifierFactoryCast()); | 60 new NetworkChangeNotifierFactoryCast()); |
| 58 } | 61 } |
| 59 | 62 |
| 60 void CastBrowserMainParts::PostMainMessageLoopStart() { | 63 void CastBrowserMainParts::PostMainMessageLoopStart() { |
| 61 NOTIMPLEMENTED(); | 64 NOTIMPLEMENTED(); |
| 62 } | 65 } |
| 63 | 66 |
| 64 int CastBrowserMainParts::PreCreateThreads() { | 67 int CastBrowserMainParts::PreCreateThreads() { |
| 68 ChromecastConfig::Create(new PrefRegistrySimple()); |
| 65 return 0; | 69 return 0; |
| 66 } | 70 } |
| 67 | 71 |
| 68 void CastBrowserMainParts::PreMainMessageLoopRun() { | 72 void CastBrowserMainParts::PreMainMessageLoopRun() { |
| 69 url_request_context_factory_->InitializeOnUIThread(); | 73 url_request_context_factory_->InitializeOnUIThread(); |
| 70 | 74 |
| 71 browser_context_.reset(new CastBrowserContext(url_request_context_factory_)); | 75 browser_context_.reset(new CastBrowserContext(url_request_context_factory_)); |
| 76 dev_tools_.reset(new RemoteDebuggingServer()); |
| 72 | 77 |
| 73 cast_service_.reset(CastService::Create(browser_context_.get())); | 78 cast_service_.reset(CastService::Create(browser_context_.get())); |
| 74 cast_service_->Start(); | 79 cast_service_->Start(); |
| 75 } | 80 } |
| 76 | 81 |
| 77 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { | 82 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { |
| 78 base::MessageLoopForUI::current()->Run(); | 83 base::MessageLoopForUI::current()->Run(); |
| 79 return true; | 84 return true; |
| 80 } | 85 } |
| 81 | 86 |
| 82 void CastBrowserMainParts::PostMainMessageLoopRun() { | 87 void CastBrowserMainParts::PostMainMessageLoopRun() { |
| 83 cast_service_->Stop(); | 88 cast_service_->Stop(); |
| 84 browser_context_.reset(); | 89 browser_context_.reset(); |
| 85 } | 90 } |
| 86 | 91 |
| 87 } // namespace shell | 92 } // namespace shell |
| 88 } // namespace chromecast | 93 } // namespace chromecast |
| OLD | NEW |