OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_RULESET_SERVICE_DE
LEGATE_H_ | |
6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_RULESET_SERVICE_DE
LEGATE_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "base/files/file.h" | |
10 #include "base/macros.h" | |
11 #include "components/subresource_filter/core/browser/ruleset_service_delegate.h" | |
12 #include "content/public/browser/notification_observer.h" | |
13 #include "content/public/browser/notification_registrar.h" | |
14 | |
15 namespace subresource_filter { | |
16 | |
17 // The content-layer specific implementation of RulesetServiceDelegate. | |
18 // | |
19 // Its main responsibility is receiving new versions of subresource filtering | |
20 // rules from the RulesetService, and distributing them to renderer processes, | |
21 // where they will be memory-mapped as-needed by the UnverifiedRulesetDealer. | |
22 // | |
23 // The distribution pipeline looks like this: | |
24 // | |
25 // RulesetService | |
26 // | | |
27 // v Browser | |
28 // RulesetServiceDelegate | |
29 // | | | |
30 // - - - - - - -|- - - - - - - |- - - - - - - - - - | |
31 // | | | | |
32 // v v | |
33 // *RulesetDealer | *RulesetDealer | |
34 // | | | | |
35 // | | | v | |
36 // v | SubresourceFilterAgent | |
37 // SubresourceFilterAgent | v | |
38 // SubresourceFilterAgent | |
39 // | | |
40 // | |
41 // Renderer #1 | Renderer #n | |
42 // | |
43 // Note: UnverifiedRulesetDealer is shortened to *RulesetDealer above. There is | |
44 // also a VerifiedRulesetDealer which is used similarly on the browser side. | |
45 class ContentRulesetServiceDelegate : public RulesetServiceDelegate, | |
46 content::NotificationObserver { | |
47 public: | |
48 ContentRulesetServiceDelegate(); | |
49 ~ContentRulesetServiceDelegate() override; | |
50 | |
51 void SetRulesetPublishedCallbackForTesting(base::Closure callback); | |
52 | |
53 // RulesetServiceDelegate: | |
54 void PostAfterStartupTask(base::Closure task) override; | |
55 void PublishNewRulesetVersion(base::File ruleset_data) override; | |
56 | |
57 private: | |
58 // content::NotificationObserver: | |
59 void Observe(int type, | |
60 const content::NotificationSource& source, | |
61 const content::NotificationDetails& details) override; | |
62 | |
63 content::NotificationRegistrar notification_registrar_; | |
64 base::File ruleset_data_; | |
65 base::Closure ruleset_published_callback_; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(ContentRulesetServiceDelegate); | |
68 }; | |
69 | |
70 } // namespace subresource_filter | |
71 | |
72 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_RULESET_SERVICE
_DELEGATE_H_ | |
OLD | NEW |