Index: remoting/host/host_window.cc |
diff --git a/remoting/host/host_window.cc b/remoting/host/host_window.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4d47a11429d333a536d395ead6a7cd431dee22f9 |
--- /dev/null |
+++ b/remoting/host/host_window.cc |
@@ -0,0 +1,50 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "remoting/host/host_window.h" |
+ |
+#include "base/bind.h" |
+#include "base/compiler_specific.h" |
+#include "base/location.h" |
+#include "base/logging.h" |
+#include "base/single_thread_task_runner.h" |
+#include "base/utf_string_conversions.h" |
+ |
+namespace remoting { |
+ |
+HostWindow::~HostWindow() { |
+ core_->Stop(); |
+} |
+ |
+HostWindow::Core::Core( |
+ scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
+ const UiStrings& ui_strings) |
+ : caller_task_runner_(caller_task_runner), |
+ ui_task_runner_(ui_task_runner), |
+ ui_strings_(ui_strings) { |
+} |
+ |
+void HostWindow::Core::Start() { |
+ DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
+ |
+ ui_task_runner_->PostTask(FROM_HERE, |
+ base::Bind(&Core::StartOnUiThread, this)); |
+} |
+ |
+void HostWindow::Core::Stop() { |
+ DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
+ |
+ ui_task_runner_->PostTask(FROM_HERE, base::Bind(&Core::StopOnUiThread, this)); |
+} |
+ |
+HostWindow::Core::~Core() { |
+} |
+ |
+HostWindow::HostWindow(scoped_refptr<Core> core) |
+ : core_(core) { |
+ core_->Start(); |
+} |
+ |
+} // namespace remoting |