| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef REMOTING_HOST_CONTINUE_WINDOW_H_ | 5 #ifndef REMOTING_HOST_CONTINUE_WINDOW_H_ |
| 6 #define REMOTING_HOST_CONTINUE_WINDOW_H_ | 6 #define REMOTING_HOST_CONTINUE_WINDOW_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/timer.h" |
| 11 #include "remoting/host/host_window.h" |
| 12 #include "remoting/host/ui_strings.h" |
| 9 | 13 |
| 10 namespace remoting { | 14 namespace remoting { |
| 11 | 15 |
| 12 struct UiStrings; | 16 class ContinueWindow : public HostWindow { |
| 17 public: |
| 18 virtual ~ContinueWindow(); |
| 13 | 19 |
| 14 class ContinueWindow { | 20 // HostWindow override. |
| 15 public: | 21 virtual void Start( |
| 16 // ContinueSessionCallback is called when the user clicks on the | 22 const base::WeakPtr<ClientSessionControl>& client_session_control) |
| 17 // Continue button to resume the session, or dismisses the window to | 23 OVERRIDE; |
| 18 // terminate the session. This callback is provided as a parameter to the | |
| 19 // Show() method, and will be triggered on the UI thread. | |
| 20 typedef base::Callback<void(bool)> ContinueSessionCallback; | |
| 21 | 24 |
| 22 virtual ~ContinueWindow() {} | 25 // Resumes paused client session. |
| 26 void ContinueSession(); |
| 23 | 27 |
| 24 // Show the continuation window requesting that the user approve continuing | 28 // Disconnects the client session. |
| 25 // the session. | 29 void DisconnectSession(); |
| 26 virtual void Show(const ContinueSessionCallback& callback) = 0; | |
| 27 | 30 |
| 28 // Hide the continuation window if it is visible. | 31 protected: |
| 29 virtual void Hide() = 0; | 32 explicit ContinueWindow(const UiStrings& ui_strings); |
| 30 | 33 |
| 31 static scoped_ptr<ContinueWindow> Create(const UiStrings* ui_strings); | 34 // Shows and hides the UI. |
| 35 virtual void ShowUi() = 0; |
| 36 virtual void HideUi() = 0; |
| 37 |
| 38 const UiStrings& ui_strings() const { return ui_strings_; } |
| 39 |
| 40 private: |
| 41 // Invoked periodically to ask for the local user whether the session should |
| 42 // be continued. |
| 43 void OnSessionExpired(); |
| 44 |
| 45 // Used to disconnect the client session. |
| 46 base::WeakPtr<ClientSessionControl> client_session_control_; |
| 47 |
| 48 // Used to disconnect the client session when timeout expires. |
| 49 base::OneShotTimer<ContinueWindow> disconnect_timer_; |
| 50 |
| 51 // Used to ask the local user whether the session should be continued. |
| 52 base::OneShotTimer<ContinueWindow> session_expired_timer_; |
| 53 |
| 54 // Localized UI strings. |
| 55 UiStrings ui_strings_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(ContinueWindow); |
| 32 }; | 58 }; |
| 33 | 59 |
| 34 } // namespace remoting | 60 } // namespace remoting |
| 35 | 61 |
| 36 #endif // REMOTING_HOST_CONTINUE_WINDOW_H_ | 62 #endif // REMOTING_HOST_CONTINUE_WINDOW_H_ |
| OLD | NEW |