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 "chromecast/net/network_change_notifier_cast.h" | 8 #include "chromecast/net/network_change_notifier_cast.h" |
9 #include "chromecast/net/network_change_notifier_factory_cast.h" | 9 #include "chromecast/net/network_change_notifier_factory_cast.h" |
10 #include "chromecast/service/cast_service.h" | 10 #include "chromecast/service/cast_service.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 int CastBrowserMainParts::PreCreateThreads() { | 71 int CastBrowserMainParts::PreCreateThreads() { |
72 return 0; | 72 return 0; |
73 } | 73 } |
74 | 74 |
75 void CastBrowserMainParts::PreMainMessageLoopRun() { | 75 void CastBrowserMainParts::PreMainMessageLoopRun() { |
76 url_request_context_factory_->InitializeOnUIThread(); | 76 url_request_context_factory_->InitializeOnUIThread(); |
77 | 77 |
78 browser_context_.reset(new CastBrowserContext(url_request_context_factory_)); | 78 browser_context_.reset(new CastBrowserContext(url_request_context_factory_)); |
79 | 79 |
80 cast_service_.reset(new CastService(browser_context_.get())); | 80 cast_service_.reset(CastService::Create(browser_context_.get())); |
81 cast_service_->Start(); | 81 cast_service_->Start(); |
82 } | 82 } |
83 | 83 |
84 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { | 84 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { |
85 base::MessageLoopForUI::current()->Run(); | 85 base::MessageLoopForUI::current()->Run(); |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
89 void CastBrowserMainParts::PostMainMessageLoopRun() { | 89 void CastBrowserMainParts::PostMainMessageLoopRun() { |
90 cast_service_->Stop(); | 90 cast_service_->Stop(); |
91 browser_context_.reset(); | 91 browser_context_.reset(); |
92 } | 92 } |
93 | 93 |
94 // static | 94 // static |
95 CastBrowserMainParts* CastBrowserMainParts::GetInstance() { | 95 CastBrowserMainParts* CastBrowserMainParts::GetInstance() { |
96 DCHECK(instance_ != NULL); | 96 DCHECK(instance_ != NULL); |
97 return instance_; | 97 return instance_; |
98 } | 98 } |
99 | 99 |
100 } // namespace shell | 100 } // namespace shell |
101 } // namespace chromecast | 101 } // namespace chromecast |
OLD | NEW |