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_PROXY_H_ | 5 #ifndef REMOTING_HOST_IT2ME_IT2ME_CONFIRMATION_DIALOG_PROXY_H_ |
6 #define REMOTING_HOST_IT2ME_IT2ME_CONFIRMATION_DIALOG_PROXY_H_ | 6 #define REMOTING_HOST_IT2ME_IT2ME_CONFIRMATION_DIALOG_PROXY_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
14 #include "remoting/host/it2me/it2me_confirmation_dialog.h" | 14 #include "remoting/host/it2me/it2me_confirmation_dialog.h" |
15 | 15 |
16 namespace remoting { | 16 namespace remoting { |
17 | 17 |
18 // A helper class to use an It2MeConfirmationDialog from a non-UI thread. | 18 // A helper class to use an It2MeConfirmationDialog from a non-UI thread. |
19 class It2MeConfirmationDialogProxy : public It2MeConfirmationDialog { | 19 class It2MeConfirmationDialogProxy : public It2MeConfirmationDialog { |
20 public: | 20 public: |
21 // |ui_task_runner| must be the UI thread. It will be used to call into the | 21 // |ui_task_runner| must be the UI thread. It will be used to call into the |
22 // wrapped dialog. | 22 // wrapped dialog. |dialog| is the dialog being wrapped. |
23 // |dialog| is the dialog being wrapped. | |
24 It2MeConfirmationDialogProxy( | 23 It2MeConfirmationDialogProxy( |
25 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 24 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
26 std::unique_ptr<It2MeConfirmationDialog> dialog); | 25 std::unique_ptr<It2MeConfirmationDialog> dialog); |
27 | 26 |
28 ~It2MeConfirmationDialogProxy() override; | 27 ~It2MeConfirmationDialogProxy() override; |
29 | 28 |
30 // It2MeConfirmationDialog implementation. | 29 // It2MeConfirmationDialog implementation. |
31 void Show(const std::string& remote_user_email, | 30 void Show(const std::string& remote_user_email, |
32 const It2MeConfirmationDialog::ResultCallback& callback) override; | 31 const It2MeConfirmationDialog::ResultCallback& callback) override; |
33 | 32 |
33 // Returns a cancelled result if the dialog is currently open. Should be used | |
34 // when the dialog has been invalidated, such as the connection being closed | |
35 // from the client side. | |
36 void Cancel(); | |
Sergey Ulanov
2017/01/20 20:05:43
I don't think we really need this method. The call
joedow
2017/03/14 16:46:36
Done.
| |
37 | |
34 private: | 38 private: |
35 class Core; | 39 class Core; |
36 | 40 |
37 void ReportResult(It2MeConfirmationDialog::Result result); | 41 void ReportResult(It2MeConfirmationDialog::Result result); |
38 | 42 |
39 std::unique_ptr<Core> core_; | 43 std::unique_ptr<Core> core_; |
40 It2MeConfirmationDialog::ResultCallback callback_; | 44 It2MeConfirmationDialog::ResultCallback callback_; |
41 base::WeakPtrFactory<It2MeConfirmationDialogProxy> weak_factory_; | 45 base::WeakPtrFactory<It2MeConfirmationDialogProxy> weak_factory_; |
42 | 46 |
43 DISALLOW_COPY_AND_ASSIGN(It2MeConfirmationDialogProxy); | 47 DISALLOW_COPY_AND_ASSIGN(It2MeConfirmationDialogProxy); |
44 }; | 48 }; |
45 | 49 |
46 } // namespace remoting | 50 } // namespace remoting |
47 | 51 |
48 #endif // REMOTING_HOST_IT2ME_IT2ME_CONFIRMATION_DIALOG_PROXY_H_ | 52 #endif // REMOTING_HOST_IT2ME_IT2ME_CONFIRMATION_DIALOG_PROXY_H_ |
OLD | NEW |