Chromium Code Reviews| Index: remoting/host/host_window.h |
| diff --git a/remoting/host/host_window.h b/remoting/host/host_window.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7e5ac6ed0361a48fd41b52220f4845781a28336f |
| --- /dev/null |
| +++ b/remoting/host/host_window.h |
| @@ -0,0 +1,104 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
|
Sergey Ulanov
2013/04/02 19:04:22
2013
alexeypa (please no reviews)
2013/04/03 20:26:43
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef REMOTING_HOST_HOST_WINDOW_H_ |
| +#define REMOTING_HOST_HOST_WINDOW_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/callback.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/threading/non_thread_safe.h" |
| +#include "remoting/host/ui_strings.h" |
| + |
| +namespace base { |
| +class SingleThreadTaskRunner; |
| +} |
| + |
| +namespace remoting { |
| + |
| +struct UiStrings; |
| + |
| +// Wraps a platform-specific implementation of HostWindow::Core managing its |
| +// life time. |
| +class HostWindow : public base::NonThreadSafe { |
| + public: |
| + ~HostWindow(); |
| + |
| + // Creates a platform-specific instance of the continue window. |
| + // |continue_callback| is called when the user clicks on the |
| + // Continue button to resume the session, or dismisses the window to |
| + // disconnect the session. |
| + static scoped_ptr<HostWindow> CreateContinueWindow( |
| + scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| + const base::Callback<void(bool)>& continue_callback, |
| + const UiStrings& ui_strings); |
| + |
| + // Creates a platform-specific instance of the disconnect window. |
| + // |disconnect_callback| is called when the user clicks on the Disconnect |
| + // button to disconnect the session. |
| + static scoped_ptr<HostWindow> CreateDisconnectWindow( |
| + scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| + const base::Closure& disconnect_callback, |
| + const std::string& username, |
| + const UiStrings& ui_strings); |
| + |
| + // HostWindow is a base class for all platform-dependent implementation of |
| + // the disconnect and continue windows. |
| + class Core : public base::RefCountedThreadSafe<Core> { |
| + public: |
| + Core(scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| + const UiStrings& ui_strings); |
| + |
| + void Start(); |
| + void Stop(); |
| + |
| + protected: |
| + friend class base::RefCountedThreadSafe<Core>; |
| + virtual ~Core(); |
| + |
| + virtual void StartOnUiThread() = 0; |
| + virtual void StopOnUiThread() = 0; |
| + |
| + const scoped_refptr<base::SingleThreadTaskRunner>& |
| + caller_task_runner() const { |
| + return caller_task_runner_; |
| + } |
| + |
| + const scoped_refptr<base::SingleThreadTaskRunner>& |
| + ui_task_runner() const { |
| + return ui_task_runner_; |
| + } |
| + |
| + const UiStrings& ui_strings() const { return ui_strings_; } |
| + |
| + private: |
| + // Task runner on which public methods of this class must be called. |
| + scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; |
| + |
| + // Task runner on which |window_| is created. |
| + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| + |
| + // Localized strings. |
| + const UiStrings ui_strings_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(Core); |
| + }; |
| + |
| + private: |
| + HostWindow(scoped_refptr<Core> core); |
| + |
| + scoped_refptr<Core> core_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(HostWindow); |
| +}; |
| + |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_HOST_HOST_WINDOW_H_ |