summaryrefslogtreecommitdiffstats
path: root/chrome/browser/content_settings/content_settings_observable_provider.h
blob: 84e0d4eaac11dff4ebf22677b19025b1cb0d7b57 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (c) 2011 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_CONTENT_SETTINGS_CONTENT_SETTINGS_OBSERVABLE_PROVIDER_H_
#define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_OBSERVABLE_PROVIDER_H_

#include <set>
#include <string>

#include "base/observer_list.h"
#include "chrome/browser/content_settings/content_settings_provider.h"
#include "chrome/browser/content_settings/content_settings_observer.h"

namespace content_settings {

class ObservableDefaultProvider : public DefaultProviderInterface {
 public:
  ObservableDefaultProvider();
  virtual ~ObservableDefaultProvider();

  void AddObserver(Observer* observer);
  void RemoveObserver(Observer* observer);

 protected:
  void NotifyObservers(ContentSettingsPattern primary_pattern,
                       ContentSettingsPattern secondary_pattern,
                       ContentSettingsType content_type,
                       std::string resource_identifier);
  void RemoveAllObservers();

 private:
  ObserverList<Observer, true> observer_list_;
};

class ObservableProvider : public ProviderInterface {
 public:
  ObservableProvider();
  virtual ~ObservableProvider();

  void AddObserver(Observer* observer);
  void RemoveObserver(Observer* observer);

 protected:
  void NotifyObservers(ContentSettingsPattern primary_pattern,
                       ContentSettingsPattern secondary_pattern,
                       ContentSettingsType content_type,
                       std::string resource_identifier);
  void RemoveAllObservers();

 private:
  ObserverList<Observer, true> observer_list_;
};

}  // namespace content_settings

#endif  // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_OBSERVABLE_PROVIDER_H_