Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2618)

Unified Diff: chrome/browser/chromeos/login/merge_session_xhr_request_waiter.h

Issue 118733002: Added merge session request throttle for XHR requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698