| 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 | |
| 24 // to disconnect the session. This callback is provided as a parameter to the | |
| 25 // Show() method, and will be triggered on the UI thread. | |
| 26 typedef base::Callback<void(void)> DisconnectCallback; | |
| 27 | |
| 28 virtual ~DisconnectWindow() {} | 23 virtual ~DisconnectWindow() {} |
| 29 | 24 |
| 30 // Shows the disconnect window allowing the user to disconnect the session. | 25 // 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 | 26 // The window will display text from |ui_strings| and |username|. |
| 32 // disconnect callback will be invoked if the user clicks the disconnect | 27 // |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 | 28 // user chooses to disconnect, or if the window is closed by any means other |
| 34 // called | 29 // than Hide(), or deletion of the DisconnectWindow instance. |
| 30 // Show returns false if the window cannot be shown, in which case the |
| 31 // callback will not be invoked. |
| 35 virtual bool Show(const UiStrings& ui_strings, | 32 virtual bool Show(const UiStrings& ui_strings, |
| 36 const DisconnectCallback& disconnect_callback, | 33 const base::Closure& disconnect_callback, |
| 37 const std::string& username) = 0; | 34 const std::string& username) = 0; |
| 38 | 35 |
| 39 // Hides the disconnect window. The disconnect callback will not be invoked. | 36 // Hides the disconnect window. The disconnect callback will not be invoked. |
| 40 virtual void Hide() = 0; | 37 virtual void Hide() = 0; |
| 41 | 38 |
| 42 static scoped_ptr<DisconnectWindow> Create(); | 39 static scoped_ptr<DisconnectWindow> Create(); |
| 43 }; | 40 }; |
| 44 | 41 |
| 45 } // namespace remoting | 42 } // namespace remoting |
| 46 | 43 |
| 47 #endif // REMOTING_HOST_DISCONNECT_WINDOW_H_ | 44 #endif // REMOTING_HOST_DISCONNECT_WINDOW_H_ |
| OLD | NEW |