Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Unified Diff: components/subresource_filter/content/browser/content_ruleset_service.h

Issue 2731283009: Swap ownership of RulesetService and the content delegate (Closed)
Patch Set: engedy review Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/subresource_filter/content/browser/content_ruleset_service.h
diff --git a/components/subresource_filter/content/browser/content_ruleset_service_delegate.h b/components/subresource_filter/content/browser/content_ruleset_service.h
similarity index 78%
rename from components/subresource_filter/content/browser/content_ruleset_service_delegate.h
rename to components/subresource_filter/content/browser/content_ruleset_service.h
index ba5338c6fcdf18bbb4b24780a7aa434b667ab625..734e81dc783ddc8a7642634b7c5e104333551ea2 100644
--- a/components/subresource_filter/content/browser/content_ruleset_service_delegate.h
+++ b/components/subresource_filter/content/browser/content_ruleset_service.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_RULESET_SERVICE_DELEGATE_H_
-#define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_RULESET_SERVICE_DELEGATE_H_
+#ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_RULESET_SERVICE_H_
+#define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_RULESET_SERVICE_H_
#include "base/callback.h"
#include "base/files/file.h"
@@ -14,7 +14,11 @@
namespace subresource_filter {
-// The content-layer specific implementation of RulesetServiceDelegate.
+class RulesetService;
+struct UnindexedRulesetInfo;
+
+// The content-layer specific implementation of RulesetServiceDelegate. Owns the
+// underlying RulesetService.
//
// Its main responsibility is receiving new versions of subresource filtering
// rules from the RulesetService, and distributing them to renderer processes,
@@ -42,11 +46,11 @@ namespace subresource_filter {
//
// Note: UnverifiedRulesetDealer is shortened to *RulesetDealer above. There is
// also a VerifiedRulesetDealer which is used similarly on the browser side.
-class ContentRulesetServiceDelegate : public RulesetServiceDelegate,
- content::NotificationObserver {
+class ContentRulesetService : public RulesetServiceDelegate,
+ content::NotificationObserver {
public:
- ContentRulesetServiceDelegate();
- ~ContentRulesetServiceDelegate() override;
+ ContentRulesetService();
+ ~ContentRulesetService() override;
void SetRulesetPublishedCallbackForTesting(base::Closure callback);
@@ -54,6 +58,12 @@ class ContentRulesetServiceDelegate : public RulesetServiceDelegate,
void PostAfterStartupTask(base::Closure task) override;
void PublishNewRulesetVersion(base::File ruleset_data) override;
+ void set_ruleset_service(std::unique_ptr<RulesetService> ruleset_service);
+
+ // Forwards calls to the underlying ruleset_service_.
+ void IndexAndStoreAndPublishRulesetIfNeeded(
+ const UnindexedRulesetInfo& unindex_ruleset_info);
+
private:
// content::NotificationObserver:
void Observe(int type,
@@ -64,9 +74,11 @@ class ContentRulesetServiceDelegate : public RulesetServiceDelegate,
base::File ruleset_data_;
base::Closure ruleset_published_callback_;
- DISALLOW_COPY_AND_ASSIGN(ContentRulesetServiceDelegate);
+ std::unique_ptr<RulesetService> ruleset_service_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentRulesetService);
};
} // namespace subresource_filter
-#endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_RULESET_SERVICE_DELEGATE_H_
+#endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_RULESET_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698