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

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

Issue 7995: Move Time, TimeDelta and TimeTicks into namespace base. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 int render_view_id); 111 int render_view_id);
112 112
113 // Bundle of SafeBrowsing state for one URL check. 113 // Bundle of SafeBrowsing state for one URL check.
114 // TODO(paulg): Make this struct private to SafeBrowsingService and maintain 114 // TODO(paulg): Make this struct private to SafeBrowsingService and maintain
115 // request mappings using CancelableRequests instead (which can 115 // request mappings using CancelableRequests instead (which can
116 // store this state for us). 116 // store this state for us).
117 struct SafeBrowsingCheck { 117 struct SafeBrowsingCheck {
118 GURL url; 118 GURL url;
119 Client* client; 119 Client* client;
120 bool need_get_hash; 120 bool need_get_hash;
121 Time start; // Time that check was sent to SB service. 121 base::Time start; // Time that check was sent to SB service.
122 TimeDelta db_time; // How long DB look-up took. 122 base::TimeDelta db_time; // How long DB look-up took.
123 UrlCheckResult result; 123 UrlCheckResult result;
124 std::vector<SBPrefix> prefix_hits; 124 std::vector<SBPrefix> prefix_hits;
125 std::vector<SBFullHashResult> full_hits; 125 std::vector<SBFullHashResult> full_hits;
126 }; 126 };
127 127
128 // API used by the SafeBrowsingProtocolManager to interface with the 128 // API used by the SafeBrowsingProtocolManager to interface with the
129 // SafeBrowsing storage system. 129 // SafeBrowsing storage system.
130 void HandleGetHashResults( 130 void HandleGetHashResults(
131 SafeBrowsingCheck* check, 131 SafeBrowsingCheck* check,
132 const std::vector<SBFullHashResult>& full_hashes, 132 const std::vector<SBFullHashResult>& full_hashes,
(...skipping 21 matching lines...) Expand all
154 // Preference handling. 154 // Preference handling.
155 static void RegisterUserPrefs(PrefService* prefs); 155 static void RegisterUserPrefs(PrefService* prefs);
156 156
157 // The SafeBrowsing system has instructed us to reset our database. 157 // The SafeBrowsing system has instructed us to reset our database.
158 void ResetDatabase(); 158 void ResetDatabase();
159 159
160 // Log the user perceived delay caused by SafeBrowsing. This delay is the time 160 // Log the user perceived delay caused by SafeBrowsing. This delay is the time
161 // delta starting from when we would have started reading data from the 161 // delta starting from when we would have started reading data from the
162 // network, and ending when the SafeBrowsing check completes indicating that 162 // network, and ending when the SafeBrowsing check completes indicating that
163 // the current page is 'safe'. 163 // the current page is 'safe'.
164 static void LogPauseDelay(TimeDelta time); 164 static void LogPauseDelay(base::TimeDelta time);
165 165
166 // We defer SafeBrowsing work for a short duration when the computer comes 166 // We defer SafeBrowsing work for a short duration when the computer comes
167 // out of a suspend state to avoid thrashing the disk. 167 // out of a suspend state to avoid thrashing the disk.
168 void OnSuspend(); 168 void OnSuspend();
169 void OnResume(); 169 void OnResume();
170 170
171 private: 171 private:
172 // Should only be called on db thread as SafeBrowsingDatabase is not 172 // Should only be called on db thread as SafeBrowsingDatabase is not
173 // threadsafe. 173 // threadsafe.
174 SafeBrowsingDatabase* GetDatabase(); 174 SafeBrowsingDatabase* GetDatabase();
175 175
176 // Called on the database thread to check a url. 176 // Called on the database thread to check a url.
177 void CheckDatabase(SafeBrowsingCheck* info, Time last_update); 177 void CheckDatabase(SafeBrowsingCheck* info, base::Time last_update);
178 178
179 // Called on the IO thread with the check result. 179 // Called on the IO thread with the check result.
180 void OnCheckDone(SafeBrowsingCheck* info); 180 void OnCheckDone(SafeBrowsingCheck* info);
181 181
182 // Called on the database thread to retrieve chunks. 182 // Called on the database thread to retrieve chunks.
183 void GetAllChunksFromDatabase(); 183 void GetAllChunksFromDatabase();
184 184
185 // Called on the IOthread with the results of all chunks. 185 // Called on the IOthread with the results of all chunks.
186 void OnGetAllChunksFromDatabase(const std::vector<SBListChunkRanges>& lists, 186 void OnGetAllChunksFromDatabase(const std::vector<SBListChunkRanges>& lists,
187 bool database_error); 187 bool database_error);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // The SafeBrowsing thread that runs database operations. 263 // The SafeBrowsing thread that runs database operations.
264 scoped_ptr<base::Thread> db_thread_; 264 scoped_ptr<base::Thread> db_thread_;
265 265
266 // Indicates if we are in the process of resetting the database. 266 // Indicates if we are in the process of resetting the database.
267 bool resetting_; 267 bool resetting_;
268 268
269 DISALLOW_EVIL_CONSTRUCTORS(SafeBrowsingService); 269 DISALLOW_EVIL_CONSTRUCTORS(SafeBrowsingService);
270 }; 270 };
271 271
272 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 272 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698