Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Side by Side Diff: remoting/host/it2me_host_user_interface.h

Issue 8775021: Fix race condition disconnecting hosts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_IT2ME_HOST_USER_INTERFACE_H_ 5 #ifndef REMOTING_HOST_IT2ME_HOST_USER_INTERFACE_H_
6 #define REMOTING_HOST_IT2ME_HOST_USER_INTERFACE_H_ 6 #define REMOTING_HOST_IT2ME_HOST_USER_INTERFACE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/synchronization/waitable_event.h"
13 14
14 #include "remoting/base/scoped_thread_proxy.h" 15 #include "remoting/base/scoped_thread_proxy.h"
15 #include "remoting/host/host_status_observer.h" 16 #include "remoting/host/host_status_observer.h"
16 17
17 // Milliseconds before the continue window is shown. 18 // Milliseconds before the continue window is shown.
18 static const int kContinueWindowShowTimeoutMs = 10 * 60 * 1000; 19 static const int kContinueWindowShowTimeoutMs = 10 * 60 * 1000;
19 20
20 // Milliseconds before the continue window is automatically dismissed and 21 // Milliseconds before the continue window is automatically dismissed and
21 // the connection is closed. 22 // the connection is closed.
22 static const int kContinueWindowHideTimeoutMs = 60 * 1000; 23 static const int kContinueWindowHideTimeoutMs = 60 * 1000;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // Allow ChromotingHostTest::SetUp() to call InitFrom(). 61 // Allow ChromotingHostTest::SetUp() to call InitFrom().
61 friend class ChromotingHostTest; 62 friend class ChromotingHostTest;
62 63
63 // Used by unit-tests as an alternative to Init() so that mock versions of 64 // Used by unit-tests as an alternative to Init() so that mock versions of
64 // internal objects can be used. This takes ownership of all objects passed 65 // internal objects can be used. This takes ownership of all objects passed
65 // in. 66 // in.
66 void InitFrom(DisconnectWindow* disconnect_window, 67 void InitFrom(DisconnectWindow* disconnect_window,
67 ContinueWindow* continue_window, 68 ContinueWindow* continue_window,
68 LocalInputMonitor* monitor); 69 LocalInputMonitor* monitor);
69 70
70 void OnConnect(const std::string& username); 71 void ProcessOnClientAuthenticated(const std::string& username);
71 void OnLastDisconnect(); 72 void ProcessOnClientDisconnected();
72
73 void ProcessOnConnect(const std::string& username);
74 void ProcessOnLastDisconnect();
75 73
76 void MonitorLocalInputs(bool enable); 74 void MonitorLocalInputs(bool enable);
77 75
78 // Show or hide the Disconnect window on the UI thread. If |show| is false, 76 // Show or hide the Disconnect window on the UI thread. If |show| is false,
79 // hide the window, ignoring the |username| parameter. 77 // hide the window, ignoring the |username| parameter.
80 void ShowDisconnectWindow(bool show, const std::string& username); 78 void ShowDisconnectWindow(bool show, const std::string& username);
81 79
82 // Show or hide the Continue Sharing window on the UI thread. 80 // Show or hide the Continue Sharing window on the UI thread.
83 void ShowContinueWindow(bool show); 81 void ShowContinueWindow(bool show);
84 82
(...skipping 27 matching lines...) Expand all
112 110
113 // Timer controlling the "continue session" dialog. 111 // Timer controlling the "continue session" dialog.
114 scoped_ptr<TimerTask> timer_task_; 112 scoped_ptr<TimerTask> timer_task_;
115 113
116 ScopedThreadProxy ui_thread_proxy_; 114 ScopedThreadProxy ui_thread_proxy_;
117 115
118 // The JID of the currently-authenticated user (or an empty string if no user 116 // The JID of the currently-authenticated user (or an empty string if no user
119 // is connected). 117 // is connected).
120 std::string authenticated_jid_; 118 std::string authenticated_jid_;
121 119
120 // Event to allow the On* callbacks to block until their counterparts on the
121 // UI thread have completed.
122 base::WaitableEvent callback_complete_;
123
122 DISALLOW_COPY_AND_ASSIGN(It2MeHostUserInterface); 124 DISALLOW_COPY_AND_ASSIGN(It2MeHostUserInterface);
123 }; 125 };
124 126
125 } // namespace remoting 127 } // namespace remoting
126 128
127 #endif // REMOTING_HOST_IT2ME_HOST_USER_INTERFACE_H_ 129 #endif // REMOTING_HOST_IT2ME_HOST_USER_INTERFACE_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/host/it2me_host_user_interface.cc » ('j') | remoting/host/it2me_host_user_interface.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698