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

Side by Side Diff: chrome/browser/renderer_host/safe_browsing_resource_throttle.h

Issue 586793003: Safebrowsing: Honor the metadata from malware fullhash results in SB API 3.0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 3 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 (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_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_H_ 5 #ifndef CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_H_
6 #define CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "chrome/browser/safe_browsing/database_manager.h" 14 #include "chrome/browser/safe_browsing/database_manager.h"
15 #include "chrome/browser/safe_browsing/ui_manager.h" 15 #include "chrome/browser/safe_browsing/ui_manager.h"
16 #include "content/public/browser/resource_throttle.h" 16 #include "content/public/browser/resource_throttle.h"
17 #include "content/public/common/resource_type.h"
17 18
18 class ResourceDispatcherHost; 19 class ResourceDispatcherHost;
19 20
20 namespace net { 21 namespace net {
21 class URLRequest; 22 class URLRequest;
22 } 23 }
23 24
24 // SafeBrowsingResourceThrottle checks that URLs are "safe" before navigating 25 // SafeBrowsingResourceThrottle checks that URLs are "safe" before navigating
25 // to them. To be considered "safe", a URL must not appear in the 26 // to them. To be considered "safe", a URL must not appear in the
26 // malware/phishing blacklists (see SafeBrowsingService for details). 27 // malware/phishing blacklists (see SafeBrowsingService for details).
(...skipping 15 matching lines...) Expand all
42 // Once the safe browsing check has completed, if the URL was decided to be 43 // Once the safe browsing check has completed, if the URL was decided to be
43 // dangerous, a warning page is thrown up and the request remains suspended. 44 // dangerous, a warning page is thrown up and the request remains suspended.
44 // If on the other hand the URL was decided to be safe, the request is 45 // If on the other hand the URL was decided to be safe, the request is
45 // resumed. 46 // resumed.
46 class SafeBrowsingResourceThrottle 47 class SafeBrowsingResourceThrottle
47 : public content::ResourceThrottle, 48 : public content::ResourceThrottle,
48 public SafeBrowsingDatabaseManager::Client, 49 public SafeBrowsingDatabaseManager::Client,
49 public base::SupportsWeakPtr<SafeBrowsingResourceThrottle> { 50 public base::SupportsWeakPtr<SafeBrowsingResourceThrottle> {
50 public: 51 public:
51 SafeBrowsingResourceThrottle(const net::URLRequest* request, 52 SafeBrowsingResourceThrottle(const net::URLRequest* request,
52 bool is_subresource, 53 content::ResourceType resource_type,
53 SafeBrowsingService* safe_browsing); 54 SafeBrowsingService* safe_browsing);
54 55
55 // content::ResourceThrottle implementation (called on IO thread): 56 // content::ResourceThrottle implementation (called on IO thread):
56 virtual void WillStartRequest(bool* defer) OVERRIDE; 57 virtual void WillStartRequest(bool* defer) OVERRIDE;
57 virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE; 58 virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE;
58 virtual const char* GetNameForLogging() const OVERRIDE; 59 virtual const char* GetNameForLogging() const OVERRIDE;
59 60
60 // SafeBrowsingDabaseManager::Client implementation (called on IO thread): 61 // SafeBrowsingDabaseManager::Client implementation (called on IO thread):
61 virtual void OnCheckBrowseUrlResult( 62 virtual void OnCheckBrowseUrlResult(const GURL& url,
62 const GURL& url, SBThreatType result) OVERRIDE; 63 SBThreatType result,
64 const std::string& metadata) OVERRIDE;
63 65
64 private: 66 private:
65 // Describes what phase of the check a throttle is in. 67 // Describes what phase of the check a throttle is in.
66 enum State { 68 enum State {
67 STATE_NONE, 69 STATE_NONE,
68 STATE_CHECKING_URL, 70 STATE_CHECKING_URL,
69 STATE_DISPLAYING_BLOCKING_PAGE, 71 STATE_DISPLAYING_BLOCKING_PAGE,
70 }; 72 };
71 73
72 // Describes what stage of the request got paused by the check. 74 // Describes what stage of the request got paused by the check.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 122
121 // The redirect chain for this resource 123 // The redirect chain for this resource
122 std::vector<GURL> redirect_urls_; 124 std::vector<GURL> redirect_urls_;
123 125
124 GURL url_being_checked_; 126 GURL url_being_checked_;
125 127
126 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; 128 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_;
127 scoped_refptr<SafeBrowsingUIManager> ui_manager_; 129 scoped_refptr<SafeBrowsingUIManager> ui_manager_;
128 const net::URLRequest* request_; 130 const net::URLRequest* request_;
129 bool is_subresource_; 131 bool is_subresource_;
132 bool is_subframe_;
sky 2014/09/22 21:37:27 nit: const (same may go for is_subresource_).
mattm 2014/09/22 22:22:20 Done.
130 133
131 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottle); 134 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottle);
132 }; 135 };
133 136
134 137
135 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_H_ 138 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698