#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MERGE_SESSION_XHR_REQUEST_WAITER_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_MERGE_SESSION_XHR_REQUEST_WAITER_H_
#include "chrome/browser/chromeos/login/merge_session_xhr_request_waiter.h"
#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/chromeos/login/merge_session_throttle.h"
#include "chrome/browser/chromeos/login/oauth2_login_manager.h"
#include "chrome/browser/chromeos/login/oauth2_login_manager_factory.h"
class Profile;
namespace chromeos {
class MergeSessionXHRRequestWaiter : public OAuth2LoginManager::Observer {
public:
MergeSessionXHRRequestWaiter(
Profile* profile,
const MergeSessionThrottle::CompletionCallback& callback);
virtual ~MergeSessionXHRRequestWaiter();
void StartWaiting();
private:
virtual void OnSessionRestoreStateChanged(
Profile* user_profile,
OAuth2LoginManager::SessionRestoreState state) OVERRIDE;
void OnTimeout();
void NotifyBlockingDone();
Profile* profile_;
MergeSessionThrottle::CompletionCallback callback_;
base::WeakPtrFactory<MergeSessionXHRRequestWaiter> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(MergeSessionXHRRequestWaiter);
};
}
#endif