| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/protocol/validating_authenticator.h" | 5 #include "remoting/protocol/validating_authenticator.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 return; | 102 return; |
| 103 | 103 |
| 104 case Result::ERROR_INVALID_CREDENTIALS: | 104 case Result::ERROR_INVALID_CREDENTIALS: |
| 105 rejection_reason_ = Authenticator::INVALID_CREDENTIALS; | 105 rejection_reason_ = Authenticator::INVALID_CREDENTIALS; |
| 106 break; | 106 break; |
| 107 | 107 |
| 108 case Result::ERROR_INVALID_ACCOUNT: | 108 case Result::ERROR_INVALID_ACCOUNT: |
| 109 rejection_reason_ = Authenticator::INVALID_ACCOUNT; | 109 rejection_reason_ = Authenticator::INVALID_ACCOUNT; |
| 110 break; | 110 break; |
| 111 | 111 |
| 112 case Result::ERROR_TOO_MANY_CONNECTIONS: |
| 113 rejection_reason_ = Authenticator::TOO_MANY_CONNECTIONS; |
| 114 break; |
| 115 |
| 112 case Result::ERROR_REJECTED_BY_USER: | 116 case Result::ERROR_REJECTED_BY_USER: |
| 113 rejection_reason_ = Authenticator::REJECTED_BY_USER; | 117 rejection_reason_ = Authenticator::REJECTED_BY_USER; |
| 114 break; | 118 break; |
| 115 } | 119 } |
| 116 | 120 |
| 117 state_ = Authenticator::REJECTED; | 121 state_ = Authenticator::REJECTED; |
| 118 resume_callback.Run(); | 122 resume_callback.Run(); |
| 119 } | 123 } |
| 120 | 124 |
| 121 void ValidatingAuthenticator::UpdateState( | 125 void ValidatingAuthenticator::UpdateState( |
| 122 const base::Closure& resume_callback) { | 126 const base::Closure& resume_callback) { |
| 123 DCHECK_EQ(state_, PROCESSING_MESSAGE); | 127 DCHECK_EQ(state_, PROCESSING_MESSAGE); |
| 124 | 128 |
| 125 // Update our current state before running |resume_callback|. | 129 // Update our current state before running |resume_callback|. |
| 126 state_ = current_authenticator_->state(); | 130 state_ = current_authenticator_->state(); |
| 127 if (state_ == REJECTED) { | 131 if (state_ == REJECTED) { |
| 128 rejection_reason_ = current_authenticator_->rejection_reason(); | 132 rejection_reason_ = current_authenticator_->rejection_reason(); |
| 129 } | 133 } |
| 130 | 134 |
| 131 resume_callback.Run(); | 135 resume_callback.Run(); |
| 132 } | 136 } |
| 133 | 137 |
| 134 } // namespace protocol | 138 } // namespace protocol |
| 135 } // namespace remoting | 139 } // namespace remoting |
| OLD | NEW |