Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / browser / api / declarative_content / content_rules_registry.h
blob6063942f30571422f6582e5bf0083d1bd69c98c5
1 // Copyright (c) 2014 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.
5 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_CONTENT_CONTENT_RULES_REGISTRY_H__
6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_CONTENT_CONTENT_RULES_REGISTRY_H__
8 #include <string>
10 #include "content/public/browser/browser_thread.h"
11 #include "extensions/browser/api/declarative/rules_registry.h"
13 namespace content {
14 class BrowserContext;
15 class WebContents;
16 struct FrameNavigateParams;
17 struct LoadCommittedDetails;
20 namespace extensions {
22 // This class acts as an //extensions-side interface for ContentRulesRegistry
23 // to allow RulesRegistryService to be moved to //extensions.
24 // TODO(wjmaclean): Remove this once ContentRulesRegistry moves to
25 // //extensions.
27 // Note: when dealing with WebContents associated with OffTheRecord contexts,
28 // functions on this interface must be invoked for BOTH the Original and
29 // OffTheRecord ContentRulesRegistry instances. This is necessary because the
30 // Original ContentRulesRegistry instance handles spanning-mode incognito
31 // extensions.
32 class ContentRulesRegistry : public RulesRegistry {
33 public:
34 ContentRulesRegistry(content::BrowserContext* browser_context,
35 const std::string& event_name,
36 content::BrowserThread::ID owner_thread,
37 RulesCacheDelegate* cache_delegate,
38 int rules_registry_id)
39 : RulesRegistry(browser_context,
40 event_name,
41 owner_thread,
42 cache_delegate,
43 rules_registry_id) {}
45 // Notifies the registry that it should evaluate rules for |contents|.
46 virtual void MonitorWebContentsForRuleEvaluation(
47 content::WebContents* contents) = 0;
49 // Applies all content rules given that a tab was just navigated.
50 virtual void DidNavigateMainFrame(
51 content::WebContents* tab,
52 const content::LoadCommittedDetails& details,
53 const content::FrameNavigateParams& params) = 0;
55 protected:
56 ~ContentRulesRegistry() override {}
58 private:
59 DISALLOW_COPY_AND_ASSIGN(ContentRulesRegistry);
62 } // namespace extensions
64 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_CONTENT_CONTENT_RULES_REGISTRY_H__