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 #include "remoting/host/it2me/it2me_confirmation_dialog_proxy.h" | 5 #include "remoting/host/it2me/it2me_confirmation_dialog_proxy.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 const std::string& remote_user_email, | 95 const std::string& remote_user_email, |
96 const It2MeConfirmationDialog::ResultCallback& callback) { | 96 const It2MeConfirmationDialog::ResultCallback& callback) { |
97 DCHECK(core_->caller_task_runner()->BelongsToCurrentThread()); | 97 DCHECK(core_->caller_task_runner()->BelongsToCurrentThread()); |
98 | 98 |
99 callback_ = callback; | 99 callback_ = callback; |
100 core_->ui_task_runner()->PostTask( | 100 core_->ui_task_runner()->PostTask( |
101 FROM_HERE, base::Bind(&Core::Show, base::Unretained(core_.get()), | 101 FROM_HERE, base::Bind(&Core::Show, base::Unretained(core_.get()), |
102 remote_user_email)); | 102 remote_user_email)); |
103 } | 103 } |
104 | 104 |
| 105 void It2MeConfirmationDialogProxy::Cancel() { |
| 106 DCHECK(core_->caller_task_runner()->BelongsToCurrentThread()); |
| 107 |
| 108 if (callback_) { |
| 109 core_->caller_task_runner()->PostTask( |
| 110 FROM_HERE, base::Bind(base::ResetAndReturn(&callback_), |
| 111 It2MeConfirmationDialog::Result::CANCEL)); |
| 112 } |
| 113 } |
| 114 |
105 void It2MeConfirmationDialogProxy::ReportResult( | 115 void It2MeConfirmationDialogProxy::ReportResult( |
106 It2MeConfirmationDialog::Result result) { | 116 It2MeConfirmationDialog::Result result) { |
107 DCHECK(core_->caller_task_runner()->BelongsToCurrentThread()); | 117 DCHECK(core_->caller_task_runner()->BelongsToCurrentThread()); |
108 base::ResetAndReturn(&callback_).Run(result); | 118 |
| 119 if (callback_) { |
| 120 base::ResetAndReturn(&callback_).Run(result); |
| 121 } |
109 } | 122 } |
110 | 123 |
111 } // namespace remoting | 124 } // namespace remoting |
OLD | NEW |