Chromium Code Reviews| 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..a6d0fa1daa8e347d56ce202c33568a750990b2c6 |
| --- /dev/null |
| +++ b/chrome/browser/signin/signin_cookie_changed_subscription.h |
| @@ -0,0 +1,49 @@ |
| +// 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> { |
|
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
|
| + public: |
| + SigninCookieChangedSubscription( |
| + const net::CookieStore::CookieChangedCallback& callback); |
|
droger
2014/10/31 12:42:01
explicit.
msarda
2014/10/31 13:18:40
Done.
|
| + 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
|
| + |
| + // Sets |subscription|. |
| + void SetCookieChangedSubscription( |
| + scoped_ptr<net::CookieStore::CookieChangedSubscription> subscription); |
| + |
| + // 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 cookie changed subscription on the cookie store. |
| + scoped_ptr<net::CookieStore::CookieChangedSubscription> |
| + cookie_changed_subscription_; |
| + |
| + base::ThreadChecker thread_checker_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SigninCookieChangedSubscription); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_SIGNIN_SIGNIN_COOKIE_CHANGED_SUBSCRIPTION_H_ |