Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 | |
| 13 // The subscription for a cookie changed events. This class lives on the | |
| 14 // main thread. | |
| 15 class SigninCookieChangedSubscription | |
| 16 : public SigninClient::CookieChangedSubscription, | |
| 17 public base::SupportsWeakPtr<SigninCookieChangedSubscription> { | |
|
droger
2014/10/31 12:42:01
Maybe add a comment saying that this class must on
msarda
2014/10/31 13:18:40
Is that really so important that this class suppor
droger
2014/10/31 13:56:08
No I think it is fine, especially since you pass a
| |
| 18 public: | |
| 19 SigninCookieChangedSubscription( | |
| 20 const net::CookieStore::CookieChangedCallback& callback); | |
|
droger
2014/10/31 12:42:01
explicit.
msarda
2014/10/31 13:18:40
Done.
| |
| 21 virtual ~SigninCookieChangedSubscription(); | |
|
droger
2014/10/31 12:42:01
s/virtual/override/
or maybe even better:
s/virtu
msarda
2014/10/31 13:18:40
I used override instead of virtual
| |
| 22 | |
| 23 // Sets |subscription|. | |
| 24 void SetCookieChangedSubscription( | |
| 25 scoped_ptr<net::CookieStore::CookieChangedSubscription> subscription); | |
| 26 | |
| 27 // Handler for cookie changed events. | |
| 28 void OnCookieChanged(const net::CanonicalCookie& cookie, bool removed); | |
| 29 | |
| 30 // Registers for cookie changed events. | |
| 31 void RegisterForCookieChangedNotifications( | |
| 32 scoped_refptr<net::URLRequestContextGetter> context_getter, | |
| 33 const GURL& url, | |
| 34 const std::string& name); | |
| 35 | |
| 36 private: | |
| 37 // Callback to be run on cookie changed events. | |
| 38 net::CookieStore::CookieChangedCallback callback_; | |
| 39 | |
| 40 // The cookie changed subscription on the cookie store. | |
| 41 scoped_ptr<net::CookieStore::CookieChangedSubscription> | |
| 42 cookie_changed_subscription_; | |
| 43 | |
| 44 base::ThreadChecker thread_checker_; | |
| 45 | |
| 46 DISALLOW_COPY_AND_ASSIGN(SigninCookieChangedSubscription); | |
| 47 }; | |
| 48 | |
| 49 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_COOKIE_CHANGED_SUBSCRIPTION_H_ | |
| OLD | NEW |