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

Side by Side Diff: components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h

Issue 2831373002: Introduce subresource_filter::ConfigurationList and make querying it cheap. (Closed)
Patch Set: Rebase. Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_SUBRESOURCE_FILTER _DRIVER_FACTORY_H_ 5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_SUBRESOURCE_FILTER _DRIVER_FACTORY_H_
6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_SUBRESOURCE_FILTER _DRIVER_FACTORY_H_ 6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_SUBRESOURCE_FILTER _DRIVER_FACTORY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/supports_user_data.h" 16 #include "base/supports_user_data.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "components/safe_browsing_db/util.h" 18 #include "components/safe_browsing_db/util.h"
19 #include "components/subresource_filter/content/browser/content_subresource_filt er_throttle_manager.h" 19 #include "components/subresource_filter/content/browser/content_subresource_filt er_throttle_manager.h"
20 #include "components/subresource_filter/core/browser/subresource_filter_features .h"
21 #include "content/public/browser/web_contents_observer.h" 20 #include "content/public/browser/web_contents_observer.h"
22 #include "ui/base/page_transition_types.h" 21 #include "ui/base/page_transition_types.h"
23 #include "url/gurl.h" 22 #include "url/gurl.h"
24 23
25 namespace content { 24 namespace content {
26 class WebContents; 25 class WebContents;
27 } // namespace content 26 } // namespace content
28 27
29 namespace safe_browsing { 28 namespace safe_browsing {
30 class SafeBrowsingServiceTest; 29 class SafeBrowsingServiceTest;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 void OnFirstSubresourceLoadDisallowed() override; 112 void OnFirstSubresourceLoadDisallowed() override;
114 bool ShouldSuppressActivation( 113 bool ShouldSuppressActivation(
115 content::NavigationHandle* navigation_handle) override; 114 content::NavigationHandle* navigation_handle) override;
116 void WillProcessResponse( 115 void WillProcessResponse(
117 content::NavigationHandle* navigation_handle) override; 116 content::NavigationHandle* navigation_handle) override;
118 117
119 ContentSubresourceFilterThrottleManager* throttle_manager() { 118 ContentSubresourceFilterThrottleManager* throttle_manager() {
120 return throttle_manager_.get(); 119 return throttle_manager_.get();
121 } 120 }
122 121
123 // TODO(https://crbug.com/708181): Allow tests to change the configuration
124 // after construction (which happens at WebContents creation) but before a
125 // navigation start. Can be removed once the Safe Browsing navigation throttle
126 // handles all activation decisions.
127 void set_configuration_for_testing(Configuration configuration) {
128 configuration_ = std::move(configuration);
129 }
130
131 SubresourceFilterClient* client() { return client_.get(); } 122 SubresourceFilterClient* client() { return client_.get(); }
132 123
133 private: 124 private:
134 friend class ContentSubresourceFilterDriverFactoryTest; 125 friend class ContentSubresourceFilterDriverFactoryTest;
135 friend class safe_browsing::SafeBrowsingServiceTest; 126 friend class safe_browsing::SafeBrowsingServiceTest;
136 127
137 void ResetActivationState(); 128 void ResetActivationState();
138 129
139 // content::WebContentsObserver: 130 // content::WebContentsObserver:
140 void DidStartNavigation( 131 void DidStartNavigation(
(...skipping 10 matching lines...) Expand all
151 ActivationList activation_list) const; 142 ActivationList activation_list) const;
152 143
153 void AddActivationListMatch(const GURL& url, ActivationList match_type); 144 void AddActivationListMatch(const GURL& url, ActivationList match_type);
154 int CalculateHitPatternForActivationList( 145 int CalculateHitPatternForActivationList(
155 ActivationList activation_list) const; 146 ActivationList activation_list) const;
156 void RecordRedirectChainMatchPattern() const; 147 void RecordRedirectChainMatchPattern() const;
157 148
158 void RecordRedirectChainMatchPatternForList( 149 void RecordRedirectChainMatchPatternForList(
159 ActivationList activation_list) const; 150 ActivationList activation_list) const;
160 151
161 Configuration configuration_;
162
163 std::unique_ptr<SubresourceFilterClient> client_; 152 std::unique_ptr<SubresourceFilterClient> client_;
164 153
165 std::unique_ptr<ContentSubresourceFilterThrottleManager> throttle_manager_; 154 std::unique_ptr<ContentSubresourceFilterThrottleManager> throttle_manager_;
166 155
167 ActivationLevel activation_level_; 156 ActivationLevel activation_level_;
168 ActivationDecision activation_decision_; 157 ActivationDecision activation_decision_;
169 bool measure_performance_; 158 bool measure_performance_;
170 159
171 // The URLs in the navigation chain. 160 // The URLs in the navigation chain.
172 std::vector<GURL> navigation_chain_; 161 std::vector<GURL> navigation_chain_;
173 162
174 URLToActivationListsMap activation_list_matches_; 163 URLToActivationListsMap activation_list_matches_;
175 164
176 DISALLOW_COPY_AND_ASSIGN(ContentSubresourceFilterDriverFactory); 165 DISALLOW_COPY_AND_ASSIGN(ContentSubresourceFilterDriverFactory);
177 }; 166 };
178 167
179 } // namespace subresource_filter 168 } // namespace subresource_filter
180 169
181 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_SUBRESOURCE_FIL TER_DRIVER_FACTORY_H_ 170 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_SUBRESOURCE_FIL TER_DRIVER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698