| Index: chrome/browser/chromeos/login/online_attempt.h
|
| diff --git a/chrome/browser/chromeos/login/online_attempt.h b/chrome/browser/chromeos/login/online_attempt.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..44fd34ff36490a55f0d1a9d7c95f6b581abba748
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/login/online_attempt.h
|
| @@ -0,0 +1,71 @@
|
| +// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ONLINE_ATTEMPT_H_
|
| +#define CHROME_BROWSER_CHROMEOS_LOGIN_ONLINE_ATTEMPT_H_
|
| +#pragma once
|
| +
|
| +#include <string>
|
| +
|
| +
|
| +#include "base/ref_counted.h"
|
| +#include "base/scoped_ptr.h"
|
| +#include "chrome/browser/chrome_thread.h"
|
| +#include "chrome/browser/chromeos/login/login_status_consumer.h"
|
| +#include "chrome/common/net/gaia/gaia_auth_consumer.h"
|
| +#include "chrome/common/net/gaia/google_service_auth_error.h"
|
| +
|
| +class GaiaAuthenticator2;
|
| +class Profile;
|
| +
|
| +namespace chromeos {
|
| +class AuthAttemptState;
|
| +class AuthAttemptStateResolver;
|
| +
|
| +class OnlineAttempt
|
| + : public base::RefCountedThreadSafe<OnlineAttempt>,
|
| + public GaiaAuthConsumer {
|
| + public:
|
| + OnlineAttempt(AuthAttemptState* current_attempt,
|
| + AuthAttemptStateResolver* callback);
|
| + virtual ~OnlineAttempt();
|
| +
|
| + // Initiate the online login attempt. Status will be recorded in
|
| + // |current_attempt|, and resolver_->Resolve() will be called on the
|
| + // IO thread when useful state is available.
|
| + void Initiate(Profile* profile);
|
| +
|
| + // Callbacks from GaiaAuthenticator2
|
| + virtual void OnClientLoginFailure(
|
| + const GoogleServiceAuthError& error);
|
| + virtual void OnClientLoginSuccess(
|
| + const GaiaAuthConsumer::ClientLoginResult& credentials);
|
| +
|
| + private:
|
| + // Milliseconds until we timeout our attempt to hit ClientLogin.
|
| + static const int kClientLoginTimeoutMs;
|
| +
|
| + void TryClientLogin();
|
| + void CancelClientLogin();
|
| +
|
| + void TriggerResolve(const GaiaAuthConsumer::ClientLoginResult& credentials,
|
| + const LoginFailure& outcome);
|
| +
|
| + AuthAttemptState* const attempt_;
|
| + AuthAttemptStateResolver* const resolver_;
|
| +
|
| + // Handles all net communications with Gaia.
|
| + scoped_ptr<GaiaAuthenticator2> gaia_authenticator_;
|
| + CancelableTask* fetch_canceler_;
|
| +
|
| + // Whether we're willing to re-try the ClientLogin attempt.
|
| + bool try_again_;
|
| +
|
| + friend class OnlineAttemptTest;
|
| + DISALLOW_COPY_AND_ASSIGN(OnlineAttempt);
|
| +};
|
| +
|
| +} // namespace chromeos
|
| +
|
| +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_ONLINE_ATTEMPT_H_
|
|
|