summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_cookie_monster_delegate.h
blob: 9ce6f939c816c406292f325d70d5e0bc1053e4a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2015 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_EXTENSIONS_EXTENSION_COOKIE_MONSTER_DELEGATE_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIE_MONSTER_DELEGATE_H_

#include "base/callback.h"
#include "base/macros.h"
#include "net/cookies/cookie_monster.h"

class Profile;

// Sends cookie-change notifications from the UI thread via
// chrome::NOTIFICATION_COOKIE_CHANGED_FOR_EXTENSIONS.
class ExtensionCookieMonsterDelegate : public net::CookieMonsterDelegate {
 public:
  explicit ExtensionCookieMonsterDelegate(Profile* profile);

  // net::CookieMonsterDelegate implementation.
  void OnCookieChanged(
      const net::CanonicalCookie& cookie,
      bool removed,
      net::CookieMonsterDelegate::ChangeCause cause) override;

 private:
  ~ExtensionCookieMonsterDelegate() override;

  void OnCookieChangedAsyncHelper(
      const net::CanonicalCookie& cookie,
      bool removed,
      net::CookieMonsterDelegate::ChangeCause cause);

  const base::Callback<Profile*(void)> profile_getter_;

  DISALLOW_COPY_AND_ASSIGN(ExtensionCookieMonsterDelegate);
};

#endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIE_MONSTER_DELEGATE_H_