Chromium Code Reviews| 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_DISCONNECT_WINDOW_H_ | 5 #ifndef REMOTING_HOST_DISCONNECT_WINDOW_H_ |
| 6 #define REMOTING_HOST_DISCONNECT_WINDOW_H_ | 6 #define REMOTING_HOST_DISCONNECT_WINDOW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 | 12 |
| 13 namespace remoting { | 13 namespace remoting { |
| 14 | 14 |
| 15 struct UiStrings; | 15 struct UiStrings; |
| 16 | 16 |
| 17 class DisconnectWindow { | 17 class DisconnectWindow { |
| 18 public: | 18 public: |
| 19 enum { | 19 enum { |
| 20 kMaximumConnectedNameWidthInPixels = 400 | 20 kMaximumConnectedNameWidthInPixels = 400 |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 // DisconnectCallback is called when the user clicks on the Disconnect button | 23 // DisconnectCallback is called when the user clicks on the Disconnect button |
| 24 // to disconnect the session. This callback is provided as a parameter to the | 24 // or presses the Disconnect hot-key sequence. |
|
Jamie
2012/12/19 00:11:50
Clarify that it will also be called if the user ma
Wez
2012/12/19 00:26:06
Done.
| |
| 25 // Show() method, and will be triggered on the UI thread. | |
| 26 typedef base::Callback<void(void)> DisconnectCallback; | 25 typedef base::Callback<void(void)> DisconnectCallback; |
| 27 | 26 |
| 28 virtual ~DisconnectWindow() {} | 27 virtual ~DisconnectWindow() {} |
| 29 | 28 |
| 30 // Shows the disconnect window allowing the user to disconnect the session. | 29 // Shows the disconnect window, allowing the user to disconnect the session. |
| 31 // Returns false if the window could not be shown for any reason. The | 30 // The window will display text from |ui_strings| and |username|. |
| 32 // disconnect callback will be invoked if the user clicks the disconnect | 31 // |disconnect_callback| will be invoked on the calling UI thread when the |
| 33 // button, or if the window is closed for any reason other than Hide() being | 32 // user chooses to disconnect, or if the window is closed by any means other |
| 34 // called | 33 // than Hide(), or deletion of the DisconnectWindow instance. |
| 34 // Show returns false if the window cannot be shown, in which case the | |
| 35 // callback will not be invoked. | |
| 35 virtual bool Show(const UiStrings& ui_strings, | 36 virtual bool Show(const UiStrings& ui_strings, |
| 36 const DisconnectCallback& disconnect_callback, | 37 const DisconnectCallback& disconnect_callback, |
| 37 const std::string& username) = 0; | 38 const std::string& username) = 0; |
| 38 | 39 |
| 39 // Hides the disconnect window. The disconnect callback will not be invoked. | 40 // Hides the disconnect window. The disconnect callback will not be invoked. |
| 40 virtual void Hide() = 0; | 41 virtual void Hide() = 0; |
| 41 | 42 |
| 42 static scoped_ptr<DisconnectWindow> Create(); | 43 static scoped_ptr<DisconnectWindow> Create(); |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 } // namespace remoting | 46 } // namespace remoting |
| 46 | 47 |
| 47 #endif // REMOTING_HOST_DISCONNECT_WINDOW_H_ | 48 #endif // REMOTING_HOST_DISCONNECT_WINDOW_H_ |
| OLD | NEW |