OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_HOST_IT2ME_IT2ME_CONFIRMATION_DIALOG_PROXY_H_ |
| 6 #define REMOTING_HOST_IT2ME_IT2ME_CONFIRMATION_DIALOG_PROXY_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/threading/non_thread_safe.h" |
| 13 #include "remoting/host/it2me/it2me_confirmation_dialog.h" |
| 14 |
| 15 namespace remoting { |
| 16 |
| 17 // A helper class to use an It2MeConfirmationDialog from a non-UI thread. |
| 18 class It2MeConfirmationDialogProxy : public It2MeConfirmationDialog { |
| 19 public: |
| 20 // |ui_task_runner| must be the UI thread. It will be used to call into the |
| 21 // wrapped dialog. |
| 22 // |dialog| is the dialog being wrapped. |
| 23 It2MeConfirmationDialogProxy( |
| 24 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 25 scoped_ptr<It2MeConfirmationDialog> dialog); |
| 26 |
| 27 ~It2MeConfirmationDialogProxy() override; |
| 28 |
| 29 // It2MeConfirmationDialog implementation. |
| 30 void Show(const It2MeConfirmationDialog::ResultCallback& callback) override; |
| 31 |
| 32 private: |
| 33 class Core; |
| 34 |
| 35 void ReportResult(It2MeConfirmationDialog::Result result); |
| 36 |
| 37 scoped_ptr<Core> core_; |
| 38 It2MeConfirmationDialog::ResultCallback callback_; |
| 39 base::WeakPtrFactory<It2MeConfirmationDialogProxy> weak_factory_; |
| 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(It2MeConfirmationDialogProxy); |
| 42 }; |
| 43 |
| 44 } // namespace remoting |
| 45 |
| 46 #endif // REMOTING_HOST_IT2ME_IT2ME_CONFIRMATION_DIALOG_PROXY_H_ |
OLD | NEW |