OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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_SUBRESOURCE_FILTER_SUBRESOURCE_FILTER_CONTENT_SETTINGS_OB SERVER_FACTORY_H_ | |
6 #define CHROME_BROWSER_SUBRESOURCE_FILTER_SUBRESOURCE_FILTER_CONTENT_SETTINGS_OB SERVER_FACTORY_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/macros.h" | |
11 #include "components/content_settings/core/browser/content_settings_observer.h" | |
12 #include "components/content_settings/core/common/content_settings.h" | |
13 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" | |
14 #include "components/keyed_service/core/keyed_service.h" | |
15 | |
16 class ContentSettingsPattern; | |
17 class HostContentSettingsMap; | |
18 class Profile; | |
19 | |
20 class SubresourceFilterContentSettingsObserver | |
msramek
2017/03/29 09:41:25
optional nit: Putting the KeyedService to the same
Charlie Harrison
2017/03/29 15:23:32
Putting this anonymous in the cc file sounds good
| |
21 : public KeyedService, | |
22 public content_settings::Observer { | |
23 public: | |
24 explicit SubresourceFilterContentSettingsObserver(Profile* profile); | |
25 ~SubresourceFilterContentSettingsObserver() override {} | |
26 | |
27 private: | |
28 // KeyedService: | |
29 void Shutdown() override; | |
30 | |
31 // content_settings::Observer: | |
32 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, | |
33 const ContentSettingsPattern& secondary_pattern, | |
34 ContentSettingsType content_type, | |
35 std::string resource_identifier) override; | |
36 | |
37 ContentSetting GetContentSettingForUrl(const GURL& url); | |
38 | |
39 HostContentSettingsMap* settings_map_; | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(SubresourceFilterContentSettingsObserver); | |
42 }; | |
43 | |
44 class SubresourceFilterContentSettingsObserverFactory | |
msramek
2017/03/29 09:41:25
I share your feeling that a KeyedService seems lik
Charlie Harrison
2017/03/29 15:23:32
Acknowledged.
| |
45 : public BrowserContextKeyedServiceFactory { | |
46 public: | |
47 static SubresourceFilterContentSettingsObserver* GetForProfile( | |
48 Profile* profile); | |
49 | |
50 static SubresourceFilterContentSettingsObserverFactory* GetInstance(); | |
51 | |
52 SubresourceFilterContentSettingsObserverFactory(); | |
53 | |
54 KeyedService* BuildServiceInstanceFor( | |
55 content::BrowserContext* profile) const override; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(SubresourceFilterContentSettingsObserverFactory); | |
58 }; | |
59 | |
60 #endif // CHROME_BROWSER_SUBRESOURCE_FILTER_SUBRESOURCE_FILTER_CONTENT_SETTINGS _OBSERVER_FACTORY_H_ | |
OLD | NEW |