OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_IT2ME_CONFIRMATION_DIALOG_H_ | 5 #ifndef REMOTING_HOST_IT2ME_IT2ME_CONFIRMATION_DIALOG_H_ |
6 #define REMOTING_HOST_IT2ME_IT2ME_CONFIRMATION_DIALOG_H_ | 6 #define REMOTING_HOST_IT2ME_IT2ME_CONFIRMATION_DIALOG_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
| 9 #include <string> |
9 | 10 |
10 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | |
13 #include "base/single_thread_task_runner.h" | |
14 | 13 |
15 namespace remoting { | 14 namespace remoting { |
16 | 15 |
17 // Interface for a dialog to confirm an It2Me session with the user. | 16 // Interface for a dialog to confirm an It2Me session with the user. |
18 // All methods, with the exception of the constructor, are guaranteed to be | 17 // All methods, with the exception of the constructor, are guaranteed to be |
19 // called on the UI thread. | 18 // called on the UI thread. |
20 class It2MeConfirmationDialog { | 19 class It2MeConfirmationDialog { |
21 public: | 20 public: |
22 enum class Result { | 21 enum class Result { |
23 OK, | 22 OK, |
24 CANCEL | 23 CANCEL |
25 }; | 24 }; |
26 | 25 |
27 typedef base::Callback<void(Result)> ResultCallback; | 26 typedef base::Callback<void(Result)> ResultCallback; |
28 | 27 |
29 virtual ~It2MeConfirmationDialog() {} | 28 virtual ~It2MeConfirmationDialog() {} |
30 | 29 |
31 // Shows the dialog. |callback| will be called with the user's selection. | 30 // Shows the dialog. |callback| will be called with the user's selection. |
32 // |callback| will not be called if the dialog is destroyed. | 31 // |callback| will not be called if the dialog is destroyed. |
33 virtual void Show(const std::string& remote_user_email, | 32 virtual void Show(const std::string& remote_user_email, |
34 const ResultCallback& callback) = 0; | 33 const ResultCallback& callback) = 0; |
35 }; | 34 }; |
36 | 35 |
37 // Used to create an platform specific instance of It2MeConfirmationDialog. | 36 // Used to create a platform specific instance of It2MeConfirmationDialog. |
38 class It2MeConfirmationDialogFactory { | 37 class It2MeConfirmationDialogFactory { |
39 public: | 38 public: |
40 It2MeConfirmationDialogFactory(); | 39 It2MeConfirmationDialogFactory(); |
41 virtual ~It2MeConfirmationDialogFactory(); | 40 virtual ~It2MeConfirmationDialogFactory(); |
42 | 41 |
43 virtual std::unique_ptr<It2MeConfirmationDialog> Create(); | 42 virtual std::unique_ptr<It2MeConfirmationDialog> Create(); |
44 | 43 |
45 DISALLOW_COPY_AND_ASSIGN(It2MeConfirmationDialogFactory); | 44 DISALLOW_COPY_AND_ASSIGN(It2MeConfirmationDialogFactory); |
46 }; | 45 }; |
47 | 46 |
48 } // namespace remoting | 47 } // namespace remoting |
49 | 48 |
50 #endif // REMOTING_HOST_IT2ME_IT2ME_CONFIRMATION_DIALOG_H_ | 49 #endif // REMOTING_HOST_IT2ME_IT2ME_CONFIRMATION_DIALOG_H_ |
OLD | NEW |