| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 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_CHROMEOS_LOGIN_MERGE_SESSION_XHR_REQUEST_WAITER_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MERGE_SESSION_XHR_REQUEST_WAITER_H_ | |
| 7 | |
| 8 #include "chrome/browser/chromeos/login/merge_session_xhr_request_waiter.h" | |
| 9 | |
| 10 #include "base/bind.h" | |
| 11 #include "base/lazy_instance.h" | |
| 12 #include "base/logging.h" | |
| 13 #include "base/memory/weak_ptr.h" | |
| 14 #include "chrome/browser/chromeos/login/merge_session_throttle.h" | |
| 15 #include "chrome/browser/chromeos/login/oauth2_login_manager.h" | |
| 16 #include "chrome/browser/chromeos/login/oauth2_login_manager_factory.h" | |
| 17 | |
| 18 class Profile; | |
| 19 | |
| 20 namespace chromeos { | |
| 21 | |
| 22 class MergeSessionXHRRequestWaiter : public OAuth2LoginManager::Observer { | |
| 23 public: | |
| 24 MergeSessionXHRRequestWaiter( | |
| 25 Profile* profile, | |
| 26 const MergeSessionThrottle::CompletionCallback& callback); | |
| 27 virtual ~MergeSessionXHRRequestWaiter(); | |
| 28 | |
| 29 // Starts waiting for merge session completion for |profile_|. | |
| 30 void StartWaiting(); | |
| 31 | |
| 32 private: | |
| 33 // OAuth2LoginManager::Observer overrides. | |
| 34 virtual void OnSessionRestoreStateChanged( | |
| 35 Profile* user_profile, | |
| 36 OAuth2LoginManager::SessionRestoreState state) OVERRIDE; | |
| 37 | |
| 38 // Timeout callback. | |
| 39 void OnTimeout(); | |
| 40 | |
| 41 // Notifies callback that waiting is done. | |
| 42 void NotifyBlockingDone(); | |
| 43 | |
| 44 Profile* profile_; | |
| 45 MergeSessionThrottle::CompletionCallback callback_; | |
| 46 base::WeakPtrFactory<MergeSessionXHRRequestWaiter> weak_ptr_factory_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(MergeSessionXHRRequestWaiter); | |
| 49 }; | |
| 50 | |
| 51 } // namespace chromeos | |
| 52 | |
| 53 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MERGE_SESSION_XHR_REQUEST_WAITER_H_ | |
| OLD | NEW |