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

Unified Diff: chrome/browser/signin/signin_cookie_changed_subscription.h

Issue 695553002: Account reconcilor: Use cookie store cookie changed subscription. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid UI/IO thread ping-pong Created 6 years, 1 month 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/signin/signin_cookie_changed_subscription.h
diff --git a/chrome/browser/signin/signin_cookie_changed_subscription.h b/chrome/browser/signin/signin_cookie_changed_subscription.h
new file mode 100644
index 0000000000000000000000000000000000000000..b6288ba40ccd4d93ae3b496e7fde1448101c1f48
--- /dev/null
+++ b/chrome/browser/signin/signin_cookie_changed_subscription.h
@@ -0,0 +1,51 @@
+// Copyright 2014 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_SIGNIN_SIGNIN_COOKIE_CHANGED_SUBSCRIPTION_H_
+#define CHROME_BROWSER_SIGNIN_SIGNIN_COOKIE_CHANGED_SUBSCRIPTION_H_
+
+#include "base/memory/weak_ptr.h"
+#include "base/threading/thread_checker.h"
+#include "components/signin/core/browser/signin_client.h"
+
+// The subscription for a cookie changed events. This class lives on the
+// main thread.
+class SigninCookieChangedSubscription
+ : public SigninClient::CookieChangedSubscription,
+ public base::SupportsWeakPtr<SigninCookieChangedSubscription> {
+ public:
+ // Holder of a cookie store cookie changed subscription.
+ struct SubscriptionHolder {
droger 2014/11/04 10:31:36 Should this be private? (To make it private you ma
msarda 2014/11/04 12:06:06 Done.
+ scoped_ptr<net::CookieStore::CookieChangedSubscription> subscription;
+ SubscriptionHolder();
+ ~SubscriptionHolder();
+ };
+
+ explicit SigninCookieChangedSubscription(
+ const net::CookieStore::CookieChangedCallback& callback);
+ ~SigninCookieChangedSubscription() override;
+
+ // Handler for cookie changed events.
+ void OnCookieChanged(const net::CanonicalCookie& cookie, bool removed);
+
+ // Registers for cookie changed events.
+ void RegisterForCookieChangedNotifications(
+ scoped_refptr<net::URLRequestContextGetter> context_getter,
+ const GURL& url,
+ const std::string& name);
+
+ private:
+ // Callback to be run on cookie changed events.
+ net::CookieStore::CookieChangedCallback callback_;
+
+ // The holder of a cookie changed subscription. Must be destroyed on the IO
+ // thread.
+ scoped_ptr<SubscriptionHolder> subscription_holder_io_;
+
+ base::ThreadChecker thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(SigninCookieChangedSubscription);
+};
+
+#endif // CHROME_BROWSER_SIGNIN_SIGNIN_COOKIE_CHANGED_SUBSCRIPTION_H_

Powered by Google App Engine
This is Rietveld 408576698