Index: chromecast/service/cast_service_simple.cc |
diff --git a/chromecast/service/cast_service.cc b/chromecast/service/cast_service_simple.cc |
similarity index 84% |
copy from chromecast/service/cast_service.cc |
copy to chromecast/service/cast_service_simple.cc |
index f072523c460bb883fbf98487741f5d84e26d2e50..16b14b6016f3142281143ff6baf7f758df42d77d 100644 |
--- a/chromecast/service/cast_service.cc |
+++ b/chromecast/service/cast_service_simple.cc |
@@ -2,12 +2,11 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chromecast/service/cast_service.h" |
+#include "chromecast/service/cast_service_simple.h" |
#include "base/command_line.h" |
#include "base/files/file_path.h" |
#include "base/macros.h" |
-#include "base/threading/thread_checker.h" |
#include "content/public/browser/render_view_host.h" |
#include "content/public/browser/web_contents.h" |
#include "net/base/filename_util.h" |
@@ -69,26 +68,22 @@ class FillLayout : public aura::LayoutManager { |
} // namespace |
-CastService::CastService(content::BrowserContext* browser_context) |
- : browser_context_(browser_context), |
- stopped_(true), |
- thread_checker_(new base::ThreadChecker()) { |
+// static |
+CastService* CastService::Create(content::BrowserContext* browser_context) { |
+ return new CastServiceSimple(browser_context); |
} |
-CastService::~CastService() { |
- DCHECK(thread_checker_->CalledOnValidThread()); |
- DCHECK(stopped_); |
+CastServiceSimple::CastServiceSimple(content::BrowserContext* browser_context) |
+ : CastService(browser_context) { |
} |
-void CastService::Initialize() { |
- PlatformInitialize(); |
+CastServiceSimple::~CastServiceSimple() { |
} |
-void CastService::Start() { |
- DCHECK(thread_checker_->CalledOnValidThread()); |
- |
- Initialize(); |
+void CastServiceSimple::Initialize() { |
+} |
+void CastServiceSimple::StartInternal() { |
// Aura initialization |
gfx::Size initial_size = gfx::Size(1280, 720); |
// TODO(lcwu): http://crbug.com/391074. Chromecast only needs a minimal |
@@ -105,7 +100,7 @@ void CastService::Start() { |
window_tree_host_->Show(); |
// Create a WebContents |
- content::WebContents::CreateParams create_params(browser_context_, NULL); |
+ content::WebContents::CreateParams create_params(browser_context(), NULL); |
create_params.routing_id = MSG_ROUTING_NONE; |
create_params.initial_size = initial_size; |
web_contents_.reset(content::WebContents::Create(create_params)); |
@@ -122,19 +117,14 @@ void CastService::Start() { |
content::Referrer(), |
content::PAGE_TRANSITION_TYPED, |
std::string()); |
- |
- stopped_ = false; |
} |
-void CastService::Stop() { |
- DCHECK(thread_checker_->CalledOnValidThread()); |
- |
+void CastServiceSimple::StopInternal() { |
web_contents_->GetRenderViewHost()->ClosePage(); |
window_tree_host_.reset(); |
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL); |
aura::Env::DeleteInstance(); |
web_contents_.reset(); |
- stopped_ = true; |
} |
} // namespace chromecast |