OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/jingle_session.h" | 5 #include "remoting/protocol/jingle_session.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 case JingleMessage::SUCCESS: | 464 case JingleMessage::SUCCESS: |
465 if (state_ == CONNECTING) { | 465 if (state_ == CONNECTING) { |
466 error_ = SESSION_REJECTED; | 466 error_ = SESSION_REJECTED; |
467 } else { | 467 } else { |
468 error_ = OK; | 468 error_ = OK; |
469 } | 469 } |
470 break; | 470 break; |
471 case JingleMessage::DECLINE: | 471 case JingleMessage::DECLINE: |
472 error_ = AUTHENTICATION_FAILED; | 472 error_ = AUTHENTICATION_FAILED; |
473 break; | 473 break; |
| 474 case JingleMessage::CANCEL: |
| 475 error_ = HOST_IS_DISABLED; |
| 476 break; |
474 case JingleMessage::GENERAL_ERROR: | 477 case JingleMessage::GENERAL_ERROR: |
475 error_ = CHANNEL_CONNECTION_ERROR; | 478 error_ = CHANNEL_CONNECTION_ERROR; |
476 break; | 479 break; |
477 case JingleMessage::INCOMPATIBLE_PARAMETERS: | 480 case JingleMessage::INCOMPATIBLE_PARAMETERS: |
478 error_ = INCOMPATIBLE_PROTOCOL; | 481 error_ = INCOMPATIBLE_PROTOCOL; |
479 break; | 482 break; |
480 default: | 483 default: |
481 error_ = UNKNOWN_ERROR; | 484 error_ = UNKNOWN_ERROR; |
482 } | 485 } |
483 | 486 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 case OK: | 542 case OK: |
540 reason = JingleMessage::SUCCESS; | 543 reason = JingleMessage::SUCCESS; |
541 break; | 544 break; |
542 case SESSION_REJECTED: | 545 case SESSION_REJECTED: |
543 case AUTHENTICATION_FAILED: | 546 case AUTHENTICATION_FAILED: |
544 reason = JingleMessage::DECLINE; | 547 reason = JingleMessage::DECLINE; |
545 break; | 548 break; |
546 case INCOMPATIBLE_PROTOCOL: | 549 case INCOMPATIBLE_PROTOCOL: |
547 reason = JingleMessage::INCOMPATIBLE_PARAMETERS; | 550 reason = JingleMessage::INCOMPATIBLE_PARAMETERS; |
548 break; | 551 break; |
| 552 case HOST_IS_DISABLED: |
| 553 reason = JingleMessage::CANCEL; |
| 554 break; |
549 default: | 555 default: |
550 reason = JingleMessage::GENERAL_ERROR; | 556 reason = JingleMessage::GENERAL_ERROR; |
551 } | 557 } |
552 | 558 |
553 JingleMessage message(peer_jid_, JingleMessage::SESSION_TERMINATE, | 559 JingleMessage message(peer_jid_, JingleMessage::SESSION_TERMINATE, |
554 session_id_); | 560 session_id_); |
555 message.reason = reason; | 561 message.reason = reason; |
556 SendMessage(message); | 562 SendMessage(message); |
557 } | 563 } |
558 | 564 |
(...skipping 16 matching lines...) Expand all Loading... |
575 DCHECK_NE(state_, FAILED); | 581 DCHECK_NE(state_, FAILED); |
576 | 582 |
577 state_ = new_state; | 583 state_ = new_state; |
578 if (!state_change_callback_.is_null()) | 584 if (!state_change_callback_.is_null()) |
579 state_change_callback_.Run(new_state); | 585 state_change_callback_.Run(new_state); |
580 } | 586 } |
581 } | 587 } |
582 | 588 |
583 } // namespace protocol | 589 } // namespace protocol |
584 } // namespace remoting | 590 } // namespace remoting |
OLD | NEW |