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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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_SIGNIN_SIGNIN_COOKIE_CHANGED_SUBSCRIPTION_H_
6 #define CHROME_BROWSER_SIGNIN_SIGNIN_COOKIE_CHANGED_SUBSCRIPTION_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "base/threading/thread_checker.h"
10 #include "components/signin/core/browser/signin_client.h"
11
12 // The subscription for a cookie changed events. This class lives on the
13 // main thread.
14 class SigninCookieChangedSubscription
15 : public SigninClient::CookieChangedSubscription,
16 public base::SupportsWeakPtr<SigninCookieChangedSubscription> {
17 public:
18 // Holder of a cookie store cookie changed subscription.
19 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.
20 scoped_ptr<net::CookieStore::CookieChangedSubscription> subscription;
21 SubscriptionHolder();
22 ~SubscriptionHolder();
23 };
24
25 explicit SigninCookieChangedSubscription(
26 const net::CookieStore::CookieChangedCallback& callback);
27 ~SigninCookieChangedSubscription() override;
28
29 // Handler for cookie changed events.
30 void OnCookieChanged(const net::CanonicalCookie& cookie, bool removed);
31
32 // Registers for cookie changed events.
33 void RegisterForCookieChangedNotifications(
34 scoped_refptr<net::URLRequestContextGetter> context_getter,
35 const GURL& url,
36 const std::string& name);
37
38 private:
39 // Callback to be run on cookie changed events.
40 net::CookieStore::CookieChangedCallback callback_;
41
42 // The holder of a cookie changed subscription. Must be destroyed on the IO
43 // thread.
44 scoped_ptr<SubscriptionHolder> subscription_holder_io_;
45
46 base::ThreadChecker thread_checker_;
47
48 DISALLOW_COPY_AND_ASSIGN(SigninCookieChangedSubscription);
49 };
50
51 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_COOKIE_CHANGED_SUBSCRIPTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698