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

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

Issue 2645283007: Add the client for accessing Subresource Filter only list. (Closed)
Patch Set: . Created 3 years, 10 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
(Empty)
1 // Copyright (c) 2017 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_SUBRESOURCE_FILTER_ACTIVAT ION_RESOURCE_THROTTLE_H_
6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_ACTIVAT ION_RESOURCE_THROTTLE_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/time/time.h"
engedy 2017/02/17 20:50:52 nit: Unused include.
melandory 2017/02/28 12:16:05 Done.
14 #include "base/timer/timer.h"
15 #include "components/safe_browsing_db/database_manager.h"
16 #include "content/public/browser/navigation_throttle.h"
17 #include "url/gurl.h"
18
19 namespace subresource_filter {
20
21 // Client for accessing list with patterns to be used by the Subresource Filter.
22 class SubresourceFilterActivationNavigationThrottle
engedy 2017/02/17 20:50:53 For disambiguation from other throttles, we should
melandory 2017/02/28 12:16:05 Done.
23 : public content::NavigationThrottle,
24 public safe_browsing::SafeBrowsingDatabaseManager::Client,
25 public base::SupportsWeakPtr<
26 SubresourceFilterActivationNavigationThrottle> {
27 public:
28 SubresourceFilterActivationNavigationThrottle(
29 content::NavigationHandle* handle,
30 const scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager>&
31 database_manager);
32
33 ~SubresourceFilterActivationNavigationThrottle() override;
34
35 content::NavigationThrottle::ThrottleCheckResult WillProcessResponse()
engedy 2017/02/17 20:50:53 nit: Add above this line: // content::NavigaionT
melandory 2017/02/28 12:16:05 Done.
36 override;
37
38 // SafeBrowsingDabaseManager::Client implementation (called on IO thread):
39 void OnCheckBrowseUrlResult(
engedy 2017/02/17 20:50:53 As discussed off-line, we will have to introduce a
melandory 2017/02/28 12:16:05 Done.
40 const GURL& url,
41 safe_browsing::SBThreatType result,
42 const safe_browsing::ThreatMetadata& metadata) override;
43
44 private:
45 // Callback for when the safe browsing check has taken longer than
46 // kCheckUrlTimeoutMs.
47 void OnCheckUrlTimeout();
48
49 void CheckUrlOnIO(const GURL& url);
50
51 void OnCheckUrlResultOnUI(const GURL& url,
52 safe_browsing::SBThreatType threat_type,
53 safe_browsing::ThreatPatternType pattern_type);
54
55 // Timer to abort the safe browsing check if it takes too long.
56 base::OneShotTimer timer_;
57
58 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager_;
59
60 GURL url_being_checked_;
61
62 DISALLOW_COPY_AND_ASSIGN(SubresourceFilterActivationNavigationThrottle);
63 };
64
65 } // namespace subresource_filter
66
67 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_ACTI VATION_RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698