Index: chrome/browser/chromeos/login/merge_session_xhr_request_waiter.h |
diff --git a/chrome/browser/chromeos/login/merge_session_xhr_request_waiter.h b/chrome/browser/chromeos/login/merge_session_xhr_request_waiter.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a8e9f48b86dca62b95c591ff2729b6710868b8c4 |
--- /dev/null |
+++ b/chrome/browser/chromeos/login/merge_session_xhr_request_waiter.h |
@@ -0,0 +1,53 @@ |
+// Copyright (c) 2013 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_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(); |
+ |
+ // Starts waiting for merge session completion for |profile_|. |
+ void StartWaiting(); |
+ |
+ private: |
+ // OAuth2LoginManager::Observer overrides. |
+ virtual void OnSessionRestoreStateChanged( |
+ Profile* user_profile, |
+ OAuth2LoginManager::SessionRestoreState state) OVERRIDE; |
+ |
+ // Timeout callback. |
+ void OnTimeout(); |
+ |
+ // Notifies callback that waiting is done. |
+ void NotifyBlockingDone(); |
+ |
+ Profile* profile_; |
+ MergeSessionThrottle::CompletionCallback callback_; |
+ base::WeakPtrFactory<MergeSessionXHRRequestWaiter> weak_ptr_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MergeSessionXHRRequestWaiter); |
+}; |
+ |
+} // namespace chromeos |
+ |
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_MERGE_SESSION_XHR_REQUEST_WAITER_H_ |