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/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
11 #include "remoting/host/host_window.h" | 11 #include "remoting/host/host_window.h" |
12 #include "remoting/host/ui_strings.h" | |
13 | 12 |
14 namespace remoting { | 13 namespace remoting { |
15 | 14 |
16 class ContinueWindow : public HostWindow { | 15 class ContinueWindow : public HostWindow { |
17 public: | 16 public: |
18 virtual ~ContinueWindow(); | 17 virtual ~ContinueWindow(); |
19 | 18 |
20 // HostWindow override. | 19 // HostWindow override. |
21 virtual void Start( | 20 virtual void Start( |
22 const base::WeakPtr<ClientSessionControl>& client_session_control) | 21 const base::WeakPtr<ClientSessionControl>& client_session_control) |
23 OVERRIDE; | 22 OVERRIDE; |
24 | 23 |
25 // Resumes paused client session. | 24 // Resumes paused client session. |
26 void ContinueSession(); | 25 void ContinueSession(); |
27 | 26 |
28 // Disconnects the client session. | 27 // Disconnects the client session. |
29 void DisconnectSession(); | 28 void DisconnectSession(); |
30 | 29 |
31 protected: | 30 protected: |
32 explicit ContinueWindow(const UiStrings& ui_strings); | 31 ContinueWindow(); |
33 | 32 |
34 // Shows and hides the UI. | 33 // Shows and hides the UI. |
35 virtual void ShowUi() = 0; | 34 virtual void ShowUi() = 0; |
36 virtual void HideUi() = 0; | 35 virtual void HideUi() = 0; |
37 | 36 |
38 const UiStrings& ui_strings() const { return ui_strings_; } | |
39 | |
40 private: | 37 private: |
41 // Invoked periodically to ask for the local user whether the session should | 38 // Invoked periodically to ask for the local user whether the session should |
42 // be continued. | 39 // be continued. |
43 void OnSessionExpired(); | 40 void OnSessionExpired(); |
44 | 41 |
45 // Used to disconnect the client session. | 42 // Used to disconnect the client session. |
46 base::WeakPtr<ClientSessionControl> client_session_control_; | 43 base::WeakPtr<ClientSessionControl> client_session_control_; |
47 | 44 |
48 // Used to disconnect the client session when timeout expires. | 45 // Used to disconnect the client session when timeout expires. |
49 base::OneShotTimer<ContinueWindow> disconnect_timer_; | 46 base::OneShotTimer<ContinueWindow> disconnect_timer_; |
50 | 47 |
51 // Used to ask the local user whether the session should be continued. | 48 // Used to ask the local user whether the session should be continued. |
52 base::OneShotTimer<ContinueWindow> session_expired_timer_; | 49 base::OneShotTimer<ContinueWindow> session_expired_timer_; |
53 | 50 |
54 // Localized UI strings. | |
55 UiStrings ui_strings_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(ContinueWindow); | 51 DISALLOW_COPY_AND_ASSIGN(ContinueWindow); |
58 }; | 52 }; |
59 | 53 |
60 } // namespace remoting | 54 } // namespace remoting |
61 | 55 |
62 #endif // REMOTING_HOST_CONTINUE_WINDOW_H_ | 56 #endif // REMOTING_HOST_CONTINUE_WINDOW_H_ |
OLD | NEW |