OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 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 CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_LOGIN_FAILURE_H_ |
| 6 #define CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_LOGIN_FAILURE_H_ |
| 7 |
| 8 #include "talk/base/common.h" |
| 9 #include "talk/xmpp/xmppengine.h" |
| 10 |
| 11 namespace buzz { |
| 12 class CaptchaChallenge; |
| 13 } |
| 14 |
| 15 namespace notifier { |
| 16 |
| 17 class LoginFailure { |
| 18 public: |
| 19 enum LoginError { |
| 20 // Check the xmpp_error for more information |
| 21 XMPP_ERROR, |
| 22 |
| 23 // If the certificate has expired, it usually means that the |
| 24 // computer's clock isn't set correctly. |
| 25 CERTIFICATE_EXPIRED_ERROR, |
| 26 |
| 27 // Apparently, there is a proxy that needs authentication information. |
| 28 PROXY_AUTHENTICATION_ERROR, |
| 29 }; |
| 30 |
| 31 LoginFailure(LoginError error); |
| 32 LoginFailure(LoginError error, |
| 33 buzz::XmppEngine::Error xmpp_error, |
| 34 int subcode); |
| 35 LoginFailure(LoginError error, |
| 36 buzz::XmppEngine::Error xmpp_error, |
| 37 int subcode, |
| 38 const buzz::CaptchaChallenge& captcha); |
| 39 |
| 40 // Used as the first level of error information |
| 41 LoginError error() const { |
| 42 return error_; |
| 43 } |
| 44 |
| 45 // Returns the XmppEngine only. Valid if and only if error() == XMPP_ERROR |
| 46 // |
| 47 // Handler should mimic logic from PhoneWindow::ShowConnectionError |
| 48 // (except that the DiagnoseConnectionError has already been done). |
| 49 buzz::XmppEngine::Error xmpp_error() const; |
| 50 |
| 51 // Returns the captcha challenge. Valid if and only if |
| 52 // xmpp_error is buzz::XmppEngine::ERROR_UNAUTHORIZED or |
| 53 // buzz::XmppEngine::ERROR_MISSING_USERNAME |
| 54 // |
| 55 // See PhoneWindow::HandleConnectionPasswordError for how to handle this |
| 56 // (after the if (..) { LoginAccountAndConnectionSetting(); ...} because |
| 57 // that is done by SingleLoginAttempt. |
| 58 const buzz::CaptchaChallenge& captcha() const; |
| 59 |
| 60 private: |
| 61 LoginError error_; |
| 62 buzz::XmppEngine::Error xmpp_error_; |
| 63 int subcode_; |
| 64 scoped_ptr<buzz::CaptchaChallenge> captcha_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(LoginFailure); |
| 67 }; |
| 68 } // namespace notifier |
| 69 #endif // CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_LOGIN_FAILURE_H_ |
OLD | NEW |