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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_service.h

Issue 18346: Adds support for multiple malware/phishing resources in a page (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // The Safe Browsing service is responsible for downloading anti-phishing and 5 // The Safe Browsing service is responsible for downloading anti-phishing and
6 // anti-malware tables and checking urls against them. 6 // anti-malware tables and checking urls against them.
7 7
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
9 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 9 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // Called when the result of checking a URL is known. 50 // Called when the result of checking a URL is known.
51 virtual void OnUrlCheckResult(const GURL& url, UrlCheckResult result) = 0; 51 virtual void OnUrlCheckResult(const GURL& url, UrlCheckResult result) = 0;
52 52
53 // Called when the user has made a decision about how to handle the 53 // Called when the user has made a decision about how to handle the
54 // SafeBrowsing interstitial page. 54 // SafeBrowsing interstitial page.
55 virtual void OnBlockingPageComplete(bool proceed) = 0; 55 virtual void OnBlockingPageComplete(bool proceed) = 0;
56 }; 56 };
57 57
58 // Structure used to pass parameters between the IO and UI thread when 58 // Structure used to pass parameters between the IO and UI thread when
59 // interacting with the blocking page. 59 // interacting with the blocking page.
60 struct BlockingPageParam { 60 struct UnsafeResource {
61 GURL url; 61 GURL url;
62 bool proceed; 62 ResourceType::Type resource_type;
63 UrlCheckResult result; 63 UrlCheckResult threat_type;
64 Client* client; 64 Client* client;
65 int render_process_host_id; 65 int render_process_host_id;
66 int render_view_id; 66 int render_view_id;
67 ResourceType::Type resource_type;
68 }; 67 };
69 68
70 // Creates the safe browsing service. Need to initialize before using. 69 // Creates the safe browsing service. Need to initialize before using.
71 SafeBrowsingService(); 70 SafeBrowsingService();
72 ~SafeBrowsingService(); 71 ~SafeBrowsingService();
73 72
74 // Initializes the service. io_loop is the message loop that the 73 // Initializes the service. io_loop is the message loop that the
75 // caller of this service (ResourceDispatcherHost) wants to be notified on 74 // caller of this service (ResourceDispatcherHost) wants to be notified on
76 // for check results. db_loop is the message loop for the thread to do 75 // for check results. db_loop is the message loop for the thread to do
77 // the database work. 76 // the database work.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 const std::vector<SBFullHashResult>& full_hashes, 134 const std::vector<SBFullHashResult>& full_hashes,
136 bool can_cache); 135 bool can_cache);
137 void HandleChunk(const std::string& list, std::deque<SBChunk>* chunks); 136 void HandleChunk(const std::string& list, std::deque<SBChunk>* chunks);
138 void HandleChunkDelete(std::vector<SBChunkDelete>* chunk_deletes); 137 void HandleChunkDelete(std::vector<SBChunkDelete>* chunk_deletes);
139 138
140 // Update management. 139 // Update management.
141 void UpdateStarted(); 140 void UpdateStarted();
142 void UpdateFinished(bool update_succeeded); 141 void UpdateFinished(bool update_succeeded);
143 142
144 // The blocking page on the UI thread has completed. 143 // The blocking page on the UI thread has completed.
145 void OnBlockingPageDone(const BlockingPageParam& param); 144 void OnBlockingPageDone(const std::vector<UnsafeResource>& resources,
145 bool proceed);
146 146
147 // Called when the SafeBrowsingProtocolManager has received updated MAC keys. 147 // Called when the SafeBrowsingProtocolManager has received updated MAC keys.
148 void OnNewMacKeys(const std::string& client_key, 148 void OnNewMacKeys(const std::string& client_key,
149 const std::string& wrapped_key); 149 const std::string& wrapped_key);
150 150
151 // Notification from the advanced options UI. 151 // Notification from the advanced options UI.
152 void OnEnable(bool enabled); 152 void OnEnable(bool enabled);
153 bool enabled() const { return enabled_; } 153 bool enabled() const { return enabled_; }
154 154
155 // Called by the database (on the db thread) when a chunk insertion is 155 // Called by the database (on the db thread) when a chunk insertion is
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 const std::vector<SBFullHashResult>& full_hashes); 235 const std::vector<SBFullHashResult>& full_hashes);
236 236
237 void HandleOneCheck(SafeBrowsingCheck* check, 237 void HandleOneCheck(SafeBrowsingCheck* check,
238 const std::vector<SBFullHashResult>& full_hashes); 238 const std::vector<SBFullHashResult>& full_hashes);
239 239
240 // Runs on the database thread to inform the database we've resumed from a low 240 // Runs on the database thread to inform the database we've resumed from a low
241 // power state. 241 // power state.
242 void HandleResume(); 242 void HandleResume();
243 243
244 // Invoked on the UI thread to show the blocking page. 244 // Invoked on the UI thread to show the blocking page.
245 void DoDisplayBlockingPage(const BlockingPageParam& param); 245 void DoDisplayBlockingPage(const UnsafeResource& resource);
246 246
247 // During a reset or the initial load we may have to queue checks until the 247 // During a reset or the initial load we may have to queue checks until the
248 // database is ready. This method is run once the database has loaded (or if 248 // database is ready. This method is run once the database has loaded (or if
249 // we shut down SafeBrowsing before the database has finished loading). 249 // we shut down SafeBrowsing before the database has finished loading).
250 void RunQueuedClients(); 250 void RunQueuedClients();
251 251
252 void OnUpdateComplete(bool update_succeeded); 252 void OnUpdateComplete(bool update_succeeded);
253 253
254 MessageLoop* io_loop_; 254 MessageLoop* io_loop_;
255 255
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 Client* client; 302 Client* client;
303 GURL url; 303 GURL url;
304 base::Time start; 304 base::Time start;
305 } QueuedCheck; 305 } QueuedCheck;
306 std::deque<QueuedCheck> queued_checks_; 306 std::deque<QueuedCheck> queued_checks_;
307 307
308 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService); 308 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService);
309 }; 309 };
310 310
311 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 311 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_blocking_page.cc ('k') | chrome/browser/safe_browsing/safe_browsing_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698