OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CHROME_CONTENT_RULES_R
EGISTRY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CHROME_CONTENT_RULES_R
EGISTRY_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CHROME_CONTENT_RULES_R
EGISTRY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CHROME_CONTENT_RULES_R
EGISTRY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 public content::NotificationObserver { | 63 public content::NotificationObserver { |
64 public: | 64 public: |
65 // For testing, |ui_part| can be NULL. In that case it constructs the | 65 // For testing, |ui_part| can be NULL. In that case it constructs the |
66 // registry with storage functionality suspended. | 66 // registry with storage functionality suspended. |
67 ChromeContentRulesRegistry(content::BrowserContext* browser_context, | 67 ChromeContentRulesRegistry(content::BrowserContext* browser_context, |
68 RulesCacheDelegate* cache_delegate); | 68 RulesCacheDelegate* cache_delegate); |
69 | 69 |
70 // ChromeContentRulesRegistry implementation: | 70 // ChromeContentRulesRegistry implementation: |
71 // Applies all content rules given an update (CSS match change or | 71 // Applies all content rules given an update (CSS match change or |
72 // page navigation, for now) from the renderer. | 72 // page navigation, for now) from the renderer. |
73 virtual void Apply( | 73 void Apply(content::WebContents* contents, |
74 content::WebContents* contents, | 74 const std::vector<std::string>& matching_css_selectors) override; |
75 const std::vector<std::string>& matching_css_selectors) override; | |
76 | 75 |
77 // Applies all content rules given that a tab was just navigated. | 76 // Applies all content rules given that a tab was just navigated. |
78 virtual void DidNavigateMainFrame( | 77 void DidNavigateMainFrame( |
79 content::WebContents* tab, | 78 content::WebContents* tab, |
80 const content::LoadCommittedDetails& details, | 79 const content::LoadCommittedDetails& details, |
81 const content::FrameNavigateParams& params) override; | 80 const content::FrameNavigateParams& params) override; |
82 | 81 |
83 // Implementation of RulesRegistry: | 82 // Implementation of RulesRegistry: |
84 virtual std::string AddRulesImpl( | 83 std::string AddRulesImpl( |
85 const std::string& extension_id, | 84 const std::string& extension_id, |
86 const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) override; | 85 const std::vector<linked_ptr<RulesRegistry::Rule>>& rules) override; |
87 virtual std::string RemoveRulesImpl( | 86 std::string RemoveRulesImpl( |
88 const std::string& extension_id, | 87 const std::string& extension_id, |
89 const std::vector<std::string>& rule_identifiers) override; | 88 const std::vector<std::string>& rule_identifiers) override; |
90 virtual std::string RemoveAllRulesImpl( | 89 std::string RemoveAllRulesImpl(const std::string& extension_id) override; |
91 const std::string& extension_id) override; | |
92 | 90 |
93 // content::NotificationObserver implementation. | 91 // content::NotificationObserver implementation. |
94 virtual void Observe(int type, | 92 void Observe(int type, |
95 const content::NotificationSource& source, | 93 const content::NotificationSource& source, |
96 const content::NotificationDetails& details) override; | 94 const content::NotificationDetails& details) override; |
97 | 95 |
98 // Returns true if this object retains no allocated data. Only for debugging. | 96 // Returns true if this object retains no allocated data. Only for debugging. |
99 bool IsEmpty() const; | 97 bool IsEmpty() const; |
100 | 98 |
101 protected: | 99 protected: |
102 virtual ~ChromeContentRulesRegistry(); | 100 ~ChromeContentRulesRegistry() override; |
103 | 101 |
104 // Virtual for testing: | 102 // Virtual for testing: |
105 virtual base::Time GetExtensionInstallationTime( | 103 virtual base::Time GetExtensionInstallationTime( |
106 const std::string& extension_id) const; | 104 const std::string& extension_id) const; |
107 | 105 |
108 private: | 106 private: |
109 friend class DeclarativeChromeContentRulesRegistryTest; | 107 friend class DeclarativeChromeContentRulesRegistryTest; |
110 | 108 |
111 std::set<ContentRule*> GetMatches( | 109 std::set<ContentRule*> GetMatches( |
112 const RendererContentMatchData& renderer_data) const; | 110 const RendererContentMatchData& renderer_data) const; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 content::NotificationRegistrar registrar_; | 143 content::NotificationRegistrar registrar_; |
146 | 144 |
147 scoped_refptr<InfoMap> extension_info_map_; | 145 scoped_refptr<InfoMap> extension_info_map_; |
148 | 146 |
149 DISALLOW_COPY_AND_ASSIGN(ChromeContentRulesRegistry); | 147 DISALLOW_COPY_AND_ASSIGN(ChromeContentRulesRegistry); |
150 }; | 148 }; |
151 | 149 |
152 } // namespace extensions | 150 } // namespace extensions |
153 | 151 |
154 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CHROME_CONTENT_RULE
S_REGISTRY_H_ | 152 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CHROME_CONTENT_RULE
S_REGISTRY_H_ |
OLD | NEW |